function seems redundant with `calc_ccf_chunk()` with `calc_ccf_var = True`
hematthi opened this issue · 0 comments
hematthi commented
EchelleCCFs.jl/src/convenience/ccf_chunk.jl
Lines 108 to 137 in a639217
""" `calc_ccf_and_var_chunk( chunk, ccf_plan )` | |
Convenience function to compute CCF and variance of each "CCF pixel" for one chunk of spectrum, evaluated using mask_shape and line list from `ccf_plan`. | |
# Inputs: | |
- `ccf_out`: `AbstractArray` to store output | |
- `ccf_var_out`: `AbstractArray` to store output | |
- `chunk`: ChunkOfSpectrum to compute CCF for | |
- `ccf_plan`: for now, just a BasicCCFPlan that provides line_list, mask_shape and other parameters for calculating CCF | |
# Optional Arguments: | |
- `var`: `AbstractArray` with variance to use for each pixel (overides value in chunk) | |
`- `assume_sorted`: if true, skips checking the line_list is sorted by wavelength | |
# Returns Named Tuple with: | |
- `ccf_out`: | |
- `ccf_var_out`: | |
""" | |
function calc_ccf_and_var_chunk(chunk::AbstractChunkOfSpectrum, plan::PlanT = BasicCCFPlan() | |
; var::AbstractVector{T} = chunk.var, ccf_var_scale::Real = 1.0, Δfwhm::Real = 0, | |
assume_sorted::Bool = false ) where { T<:Real, PlanT<:AbstractCCFPlan } | |
@assert assume_sorted || issorted( plan.line_list.λ ) | |
if Δfwhm > 0 | |
this_plan_for_chunk = copy(plan) | |
increase_mask_fwhm!(this_plan_for_chunk,Δfwhm) | |
else | |
this_plan_for_chunk = plan | |
end | |
len_v_grid = calc_length_ccf_v_grid(plan) | |
ccf_out = zeros(len_v_grid) | |
ccf_var_out = zeros(len_v_grid) | |
calc_ccf_and_var_chunk!(ccf_out, ccf_var_out, chunk, this_plan_for_chunk, var=var, ccf_var_scale=ccf_var_scale, assume_sorted=true ) | |
return (ccf=ccf_out, ccf_var=ccf_var_out) | |
end |
Could replace everything in this function with one call to
calc_ccf_chunk(...; ..., calc_ccf_var = True)