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

calc_ccf_covar and calc_ccf_var can both be true in if-elseif condition #70

Open
hematthi opened this issue May 30, 2022 · 0 comments
Open

Comments

@hematthi
Copy link
Collaborator

if calc_ccf_covar
if length(Δfwhm) == length(clt)
list_of_ccf_and_covar = @threaded map(obsid->calc_ccf_and_covar_chunklist(clt.chunk_list[obsid], plan_for_chunk, ccf_var_scale=ccf_var_scale, Δfwhm=Δfwhm[obsid], assume_sorted=true ), 1:length(clt) )
else
list_of_ccf_and_covar = @threaded map(obsid->calc_ccf_and_covar_chunklist(clt.chunk_list[obsid], plan_for_chunk, ccf_var_scale=ccf_var_scale, assume_sorted=true ), 1:length(clt) )
end
nvs = length(first(list_of_ccf_and_covar).ccf)
ccfs_out = zeros(nvs,length(clt))
ccf_covars_out = zeros(nvs,nvs,length(clt))
for obsid in 1:length(clt)
ccfs_out[:,obsid] .= list_of_ccf_and_covar[obsid].ccf
ccf_covars_out[:,:,obsid] .= list_of_ccf_and_covar[obsid].ccf_covar
end
return (ccfs=ccfs_out, ccf_covars=ccf_covars_out)
elseif calc_ccf_var
if length(Δfwhm) == length(clt)
list_of_ccf_and_var = @threaded map(obsid->calc_ccf_and_var_chunklist(clt.chunk_list[obsid], plan_for_chunk, ccf_var_scale=ccf_var_scale, Δfwhm=Δfwhm[obsid], assume_sorted=true ), 1:length(clt) )
else
list_of_ccf_and_var = @threaded map(obsid->calc_ccf_and_var_chunklist(clt.chunk_list[obsid], plan_for_chunk, ccf_var_scale=ccf_var_scale, assume_sorted=true ), 1:length(clt) )
end
nvs = length(first(list_of_ccf_and_var).ccf)
ccfs_out = zeros(nvs,length(clt))
ccf_vars_out = zeros(nvs,length(clt))
for obsid in 1:length(clt)
ccfs_out[:,obsid] .= list_of_ccf_and_var[obsid].ccf
ccf_vars_out[:,obsid] .= list_of_ccf_and_var[obsid].ccf_var
end
return (ccfs=ccfs_out, ccf_vars=ccf_vars_out)
else

calc_ccf_covar and calc_ccf_var are independently set and can both be true... maybe this is OK if you would rather compute covar

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

No branches or pull requests

1 participant