MNGuenther / allesfitter

allesfitter is a convenient wrapper around the packages ellc (light curve and RV models), dynesty (static and dynamic nested sampling) emcee (Markov Chain Monte Carlo sampling) and celerite (Gaussian Process models).
MIT License
60 stars 36 forks source link

Question: how to parameterize polynomial baseline functions? #34

Closed jpdeleon closed 2 years ago

jpdeleon commented 3 years ago

I searched but couldn't find in examples and documentation a params.csv file that uses hybrid_poly_2 (and higher order ones) baseline function. I tried to generate the params.csv file using the GUI but when, for example, hybrid_poly_2 is selected, no relevant parameter appears in the generated params.csv. Actually, why no parameter is specified in params.csv when using any hybrid_* baseline functions?

Anyway, I proceeded to run allesfitter.show_initial_guess but it appears from the resulting plots that the baseline function is constant despite changing the order of hybrid_poly_* baseline function in the settings.csv file. hybrid_spline however works fine.

MNGuenther commented 2 years ago

Hi @jpdeleon, thanks a lot for raising this -- and apologies that this fell through the cracks so far.

Just to explaind: All baseline options with hybrid_* will not show up with parameters anywhere in allesfitter. That is because they are fitted using leastsquares optimization directly with scipy (and other) modules. For example, the hybrid_offset will simply subtract the median of the residuals. The hybrid_spline and hybrid_poly will be optimised by scipy itself. It is super rare that this "fails" and I have only seen it once so far: in the presence of extremely rapid systematic noise such as pulsations of <1 hour periods. In that case, scipy gets confused and sees the whole pattern as white noise. That is why it then draws a straight line through it all instead of trying to take it out.

I will close this for now, as it is highly case specific. If this still persists or reoccured for you, please send along a Dropbox/Google Drive link to your folder via email and I will look into it!