Fitting process

Fitting process (Execution flag = 2)

gsf fits synthetic data points (generated from model templates) to input observed data points based on minimization of the following equation (as in posterior_flexible.py);

\[resid_i = (f_\mathrm{model,i} - f_\mathrm{obs,i}) / \sigma_\mathrm{obs,i}\]

where \(i\) runs over \(n\) data points, and \(f\) as flux and \(\sigma\) as 1-sigma error.

Then, log likelihood is calculated as;

\[lnlike = -0.5 \left[ \sum_{i}^{n} \left( resid_i^2 + ln (2 \pi \sigma_i^2) \right) - 2 \chi_\mathrm{ln\ nd} \right]\]

where \(\chi_\mathrm{ln\ nd}\) add the contribution from non-detection data points (\(f/\sigma<SN_\mathrm{limit}\));

\[\chi_\mathrm{ln\ nd} = \sum_{i}^{n} ln \left( \sqrt{ \frac{\pi}{2}} \sigma_\mathrm{obs,i} \left(1 + \mathrm{erf} (\frac{\sigma_i SN_\mathrm{limit} - f_\mathrm{model,i}}{\sqrt{2}\sigma_i}) \right) \right)\]

where erf is the error function. (See Appendix in Sawicki 2012 for the mathematical proof for the non-detection part.)

Then log posterior is calculated by;

\[lnpost = lnlike + lnprior\]

where lnprior is log prior (see Prior).