RvSpectML / EchelleCCFs.jl

Computes Cross Correlation Functions (CCFs) with RvSpectML
https://rvspectml.github.io/RvSpectML-Overview/
MIT License
3 stars 4 forks source link

CCF normalization changes when calculating variances #6

Open alexander-wise opened 3 years ago

alexander-wise commented 3 years ago

ccf_total(clt, mask, pipeline_plan, recalc=true, calc_ccf_var=true) and ccf_total(clt, mask, pipeline_plan, recalc=true, calc_ccf_var=false)

give ccfs with different normalizations (i.e. identical module some normalization factor). In one test, the normalization factor was 332 and the number of lines in the 1-D mask was 282, so I suspect but have not verified that 332 may be the number of lines in the 2-D mask. For consistency, we might want to make the default normalizations the same for these two function calls.

eford commented 3 years ago

If/when someone make the fitting so robust that it can work robustly using the CCFs from calc_ccf_var=false, then I agree it would be nice to have them use the same normalization convention.
Until there, there's a reason for the differing conventions... When setting calc_ccf_var=true, it's ok that the CCF values are small, so since they can be compared to the variances. Keeping them as is good if we want to add CCFs to provide an input to a likelihood.
But when setting calc_ccf_var=false, the small values of the CCF led to the RV fitting routines giving useless results (e.g., all very near zero). As a quick fix, I simply normalized by the number of lines, so that the RV fitting routines would work. In this case, we couldn't turn the CCFs into a likelihood anyway, since we didn't have measurement uncertianties. So I didn't see a big down side. Of course, a better solution would be to adjust the way the fitting is done (e.g., change convergence criteria, or probably better change to using a fitter that's linear once conditioned on a few parameters and then only have to explore one or two non-linear parameters, etc.)