Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update documentation to consistently describe and name all arguments #71

Open
hematthi opened this issue May 30, 2022 · 5 comments
Open
Labels
documentation Improvements or additions to documentation

Comments

@hematthi
Copy link
Collaborator

""" `calc_order_ccfs_chunklist ( chunklist_timeseries, list_of_ccf_plans )`
Convenience function to compute separate CCFs for each chunk (potentially an order or view around one or two lines) in a spectrum.
CCF is evaluated using line list and mask_shape provided by the ccf plan for each chunk.
# Inputs:
- `chunklist_timeseries`:
- `list_of_ccf_plans`: ccf plans (one for each chunk)
# Optional Arguments:
- `assume_sorted`: if true, skips checking the line_list is sorted by wavelength
# Return:
A 2-d array containing the CCF at each (velocity, chunk)
"""
function calc_order_ccfs_chunklist!(chunk_ccfs_out::AbstractArray{T1,2}, chunk_list::AbstractChunkList,
plan_for_chunk::AbstractVector{PlanT} = BasicCCFPlan(); assume_sorted::Bool = false ) where {
T1<:Real, PlanT<:AbstractCCFPlan }
num_chunks = length(chunk_list)
@assert length(plan_for_chunk) == num_chunks
@assert size(chunk_ccfs_out,2) == num_chunks
@assert assume_sorted || issorted( first(plan_for_chunk).line_list.λ )
num_vels = maximum(map(chid->calc_length_ccf_v_grid(plan_for_chunk[chid]), 1:num_chunks ))
@assert size(chunk_ccfs_out,1) == num_vels
#flush(stdout); println("num_vels = ",num_vels," num_chunks = ", num_chunks, " length(chunk_list.data)=", length(chunk_list.data)); flush(stdout);
for chid in 1:num_chunks
# chunk_ccfs_out[:,i] .=
#flush(stdout); println("chid = ", chid); flush(stdout);
calc_ccf_chunk!(view(chunk_ccfs_out, 1:num_vels, chid ), chunk_list.data[chid], plan_for_chunk[chid], assume_sorted=assume_sorted )
end
return chunk_ccfs_out
end

@hematthi hematthi added the documentation Improvements or additions to documentation label May 30, 2022
@hematthi
Copy link
Collaborator Author

""" `calc_order_ccfs_chunklist ( chunklist_timeseries, list_of_ccf_plans )`
Convenience function to compute separate CCFs for each chunk (potentially an order or view around one or two lines) in a spectrum.
CCF is evaluated using line list and mask_shape provided by the ccf plan for each chunk.
# Inputs:
- `chunklist_timeseries`:
- `list_of_ccf_plans`: ccf plans (one for each chunk)
# Optional Arguments:
- `assume_sorted`: if true, skips checking the line_list is sorted by wavelength
# Return:
A 2-d array containing the CCF at each (velocity, chunk)
"""
function calc_order_ccfs_chunklist(chunk_list::AbstractChunkList,
plan_for_chunk::AbstractVector{PlanT} = BasicCCFPlan();
Δfwhm::Real = 0, assume_sorted::Bool = false ) where {
PlanT<:AbstractCCFPlan }
num_chunks = length(chunk_list)
@assert length(plan_for_chunk) == num_chunks
@assert assume_sorted || issorted( first(plan_for_chunk).line_list.λ )
num_vels = maximum(map(chid->calc_length_ccf_v_grid(plan_for_chunk[chid]), 1:num_chunks ))
if Δfwhm > 0
this_plan_for_chunk = copy(plan_for_chunk)
#increase_mask_fwhm!(this_plan_for_chunk,Δfwhm)
map(chid->increase_mask_fwhm!(this_plan_for_chunk[chid],Δfwhm), 1:num_chunks )
else
this_plan_for_chunk = plan_for_chunk
end
chunk_ccfs_out = zeros( num_vels, num_chunks )
calc_order_ccfs_chunklist!(chunk_ccfs_out, chunk_list, this_plan_for_chunk, assume_sorted=assume_sorted )
return chunk_ccfs_out
end

@hematthi
Copy link
Collaborator Author

""" `calc_order_ccfs_chunklist ( chunklist_timeseries, list_of_ccf_plans )`
Convenience function to compute separate CCFs for each chunk (potentially an order or view around one or two lines) in a spectrum.
CCF is evaluated using line list and mask_shape provided by the ccf plan for each chunk.
# Inputs:
- `chunklist_timeseries`:
- `list_of_ccf_plans`: ccf plans (one for each chunk)
# Optional Arguments:
- `assume_sorted`: if true, skips checking the line_list is sorted by wavelength
# Return:
A 2-d array containing the CCF at each (velocity, chunk)
"""
function calc_order_ccf_and_vars_chunklist!(chunk_ccfs_out::AbstractArray{T1,2}, chunk_ccf_vars_out::AbstractArray{T1,2}, chunk_list::AbstractChunkList,
plan_for_chunk::AbstractVector{PlanT} = BasicCCFPlan(); assume_sorted::Bool = false ) where {
T1<:Real, PlanT<:AbstractCCFPlan }
num_chunks = length(chunk_list)
@assert length(plan_for_chunk) == num_chunks
@assert size(chunk_ccfs_out,2) == num_chunks
@assert assume_sorted || issorted( first(plan_for_chunk).line_list.λ )
num_vels = maximum(map(chid->calc_length_ccf_v_grid(plan_for_chunk[chid]), 1:num_chunks ))
@assert size(chunk_ccfs_out,1) == num_vels
for chid in 1:num_chunks
calc_ccf_and_var_chunk!(view(chunk_ccfs_out, 1:num_vels, chid ), view(chunk_ccf_vars_out, 1:num_vels, chid ),
chunk_list.data[chid], plan_for_chunk[chid], assume_sorted=assume_sorted )
end
return (ccfs=chunk_ccfs_out, ccf_vars=chunk_ccf_vars_out)
end

@hematthi
Copy link
Collaborator Author

""" `calc_order_ccfs_chunklist ( chunklist_timeseries, list_of_ccf_plans )`
Convenience function to compute separate CCFs for each chunk (potentially an order or view around one or two lines) in a spectrum.
CCF is evaluated using line list and mask_shape provided by the ccf plan for each chunk.
# Inputs:
- `chunklist_timeseries`:
- `list_of_ccf_plans`: ccf plans (one for each chunk)
# Optional Arguments:
- `assume_sorted`: if true, skips checking the line_list is sorted by wavelength
# Return:
A 2-d array containing the CCF at each (velocity, chunk)
"""
function calc_order_ccf_and_vars_chunklist(chunk_list::AbstractChunkList,
plan_for_chunk::AbstractVector{PlanT} = BasicCCFPlan();
Δfwhm::Real = 0, assume_sorted::Bool = false ) where {
PlanT<:AbstractCCFPlan }
num_chunks = length(chunk_list)
@assert length(plan_for_chunk) == num_chunks
@assert assume_sorted || issorted( first(plan_for_chunk).line_list.λ )
if Δfwhm > 0
this_plan_for_chunk = copy(plan_for_chunk)
#increase_mask_fwhm!(this_plan_for_chunk,Δfwhm)
map(chid->increase_mask_fwhm!(this_plan_for_chunk[chid],Δfwhm), 1:num_chunks )
else
this_plan_for_chunk = plan_for_chunk
end
num_vels = maximum(map(chid->calc_length_ccf_v_grid(plan_for_chunk[chid]), 1:num_chunks ))
chunk_ccfs_out = zeros( num_vels, num_chunks )
chunk_ccf_vars_out = zeros( num_vels, num_chunks )
calc_order_ccf_and_vars_chunklist!(chunk_ccfs_out, chunk_ccf_vars_out, chunk_list, this_plan_for_chunk, assume_sorted=assume_sorted )
return (ccfs=chunk_ccfs_out, ccf_vars=chunk_ccf_vars_out)
end

@hematthi
Copy link
Collaborator Author

""" `calc_order_ccf_chunklist_timeseries( chunklist_timeseries, ccf_plan )`
Convenience function to compute separate CCFs for each chunk (potentially an order or view around one or two lines) of each spectrum in a timeseries.
CCF is evaluated using line list and mask_shape provided by the ccf plan for each chunk.
Uses multiple threads if avaliable.
# Inputs:
- chunklist_timeseries
# Optional Arguments:
- ccf_plan (BasicCCFPlan())
# Return:
A 3-d array containing the CCF at each (velocity, chunk, spectrum)
Note that the ccf_plan provided is used as a template for creating a custom ccf_plan for each chunk that
only includes lines that reliably appear in that order for all spectra in the chunklist_timeseries.
"""
function calc_order_ccf_chunklist_timeseries(clt::AbstractChunkListTimeseries,
plan::PlanT = BasicCCFPlan(); verbose::Bool = false ,
Δfwhm::AbstractVector{T} = zeros(0)
) where { PlanT<:AbstractCCFPlan, T<:Real }

@hematthi
Copy link
Collaborator Author

hematthi commented Jun 1, 2022

""" `calc_order_ccf_and_var_chunklist_timeseries( chunklist_timeseries, ccf_plan )`
Convenience function to compute separate CCFs for each chunk (potentially an order or view around one or two lines) of each spectrum in a timeseries.
CCF is evaluated using line list and mask_shape provided by the ccf plan for each chunk.
Uses multiple threads if avaliable.
# Inputs:
- chunklist_timeseries
# Optional Arguments:
- ccf_plan (BasicCCFPlan())
# Return:
A 3-d array containing the CCF at each (velocity, chunk, spectrum)
Note that the ccf_plan provided is used as a template for creating a custom ccf_plan for each chunk that
only includes lines that reliably appear in that order for all spectra in the chunklist_timeseries.
"""
function calc_order_ccf_and_var_chunklist_timeseries(clt::AbstractChunkListTimeseries,
plan::PlanT = BasicCCFPlan(); verbose::Bool = false,
ccf_var_scale::Real = 1.0, Δfwhm::AbstractVector{T} = zeros(0)
) where {
PlanT<:AbstractCCFPlan, T<:Real }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant