You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
) where { T1<:Real, A1<:AbstractArray{T1,1}, T2<:Real, A2<:AbstractArray{T2,2}, PlanT<:AbstractCCFPlan }
num_lines_in_mask =length(plan.line_list)
@assert num_lines_in_mask >=1
@assertsize(projection,1) ==length(λs)
@assertsize(projection,2) ==1# Keep until implement CCF w/ multiple masks simultaneously
projection .=zero(eltype(projection)) # Important to zero out projection before accumulating there!
# set indexing variables
p =1
p_left_edge_of_current_line =1
λsle_cur = λs[p]-0.5*(λs[p+1]-λs[p]) # Current pixel's left edge
λsre_cur =0.5*(λs[p]+λs[p+1]) # Current pixel's left edge
#@assert issorted( plan.line_list.λ ) # Moved outside of inner loop
m =searchsortedfirst(plan.line_list.λ, λsle_cur/shift_factor)
while m <=length(plan.line_list.λ) &&λ_min(plan.mask_shape,plan.line_list.λ[m]) * shift_factor < λsle_cur # only includemask entry if it fit entirely in chunk
m +=1
end
if m >length(plan.line_list.λ) # Return early if no lines fall within chunk's lambda's
return projection
else
#println("# Starting with mask entry at λ=", plan.line_list.λ[m], " for chunk with λ= ",first(λs)," - ",last(λs))
end
on_mask =false
mask_mid = plan.line_list.λ[m] * shift_factor
mask_hi =λ_max(plan.mask_shape,plan.line_list.λ[m]) * shift_factor # current line's upper limit
mask_lo =λ_min(plan.mask_shape,plan.line_list.λ[m]) * shift_factor # current line's lower limit
c_mps = speed_of_light_mps
mask_weight = plan.line_list.weight[m]
# loop through lines in mask, weight mask by fraction of PSF falling in each wavelength bin and divide by Δlnλ for pixel
while m <= num_lines_in_mask
if!on_mask
if λsre_cur > mask_lo
if λsre_cur > mask_hi # Pixel overshot this mask entry, so weight based on mask filling only a portion of the pixel,
if mask_lo < λsle_cur # If the lines overlap, we may have moved past the left edge of the new line. In that case go back to the left edge of the previous line.
p = p_left_edge_of_current_line
λsle_cur = p>1?0.5*(λs[p]+λs[p-1]) : λs[p]-0.5*(λs[p+1]-λs[p]) # Current pixel's left edge
λsre_cur =0.5*(λs[p]+λs[p+1]) # Current pixel's right edge
end
else# We're done with all lines, can return early
break
end
else# This pixel is entirely within the mask
# assumes plan.mask_shape is normalized to integrate to unity and flux is constant within pixel
#For Tophat: projection[p,1] += mask_weight # Add the full mask weight
EchelleCCFs.jl/src/ccf/calc_ccf.jl
Lines 304 to 413 in a639217
The text was updated successfully, but these errors were encountered: