Skip to content

Commit

Permalink
generalize
Browse files Browse the repository at this point in the history
  • Loading branch information
billera committed Feb 8, 2024
1 parent 2b3fed5 commit de3d070
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/masks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@ function left_to_right_mask(L::T, R::T; step::T = 10) where T <: Integer
mask = ones(L,R) .* -Inf32
for i in 1:R
for j in 1:L
mask[j,i] = j < 10*(i-1) ? -Inf : 0
mask[j,i] = j < step*(i-1) ? -Inf : 0
end
end
return mask
end


function virtual_residues(S::AbstractArray, T::Tuple{AbstractArray, AbstractArray}; step = 10)
function virtual_residues(S::AbstractArray, T::Tuple{AbstractArray, AbstractArray}; step = 10, rand_start = false)
Nr = size(S,2)
vr = 1:step:Nr
start = 1
if rand_start
start = sample(1:step)
end
vr = start:step:Nr
S_virt = S[:,vr,:]
T_virt = (T[1][:,:,vr,:], T[2][:,:,vr,:])
return S_virt, T_virt
Expand Down

0 comments on commit de3d070

Please sign in to comment.