hippke / tls

Transit Least Squares: An optimized transit-fitting algorithm to search for periodic transits of small planets
MIT License
48 stars 25 forks source link

Binning in the phase folded plot. #81

Closed MilevaE closed 4 years ago

MilevaE commented 4 years ago

Hi,

in many cases, the binning can help us to see the features of a lightcurve, specially when we have shallow transits. In particular I would like to implement this in the phase folded plot, but I do not find a clear way to do it.. any suggestions?

Thanks!

hippke commented 4 years ago

This is a good feature request. I added an example here. Is this what you are looking for?

MilevaE commented 4 years ago

That's exactly what I need! Thanks a lot Hippke! :)

MilevaE commented 4 years ago

Hi!,

please, let me ask an extra question here. In the code you set in the example:

from scipy import stats
bins = 500
bin_means, bin_edges, binnumber = stats.binned_statistic(
    results.folded_phase,
    results.folded_y,
    statistic='mean',
    bins=bins)
bin_stds, _, _ = stats.binned_statistic(
    results.folded_phase,
    results.folded_y,
    statistic='std',
    bins=bins)
bin_width = (bin_edges[1] - bin_edges[0])
bin_centers = bin_edges[1:] - bin_width/2

The bin is set to 500, however I'm bit struggle to understand which is the equivalence in time.. I mean, for example, in a TESS lightcurve, where the cadence is 2 min and I want to bin by 10 min in the phase folded lightcurve

Thanks a lot in advance!

hippke commented 4 years ago

The total length of the dataset (e.g., 1000 days) is binned into 500 bins. So each bin is worth 2 days.