How do I bin a messy phase folded lightcurve? This is one of the phase folded generated plots for a variable star. I plotted the phase using the period extracted by Lomb-Scargle Periodogram algorithm. I need to bin them say by ~100 or so. Kindly help me out. Phase Folded Light Curve

This is the periodigram obtained using Lomb-Scargle method. Lomb-Scargle Periodogram

  • 3
    $\begingroup$ I would have expected a much smoother curve. IMO, either it has not been folded properly or the curve is dominated by statistical errors (i.e. no detection) $\endgroup$
    – Prallax
    Aug 17, 2021 at 12:00
  • 1
    $\begingroup$ Another reason could it be noise destruction. $\endgroup$
    – Lariliss
    Aug 17, 2021 at 13:51
  • $\begingroup$ I plotted the periodogram and got the frequency as I expected. When I plotted the phase folded curve, I got this. $\endgroup$ Aug 17, 2021 at 18:16
  • 1
    $\begingroup$ If you'd like, you can post more information, like a few lines of the code you used to obtain it, the plot of the peridogram and a plot of the original data (possibly dot-plots, not line-plots, for visual clarity). I'm not an expert, but I'd be happy to help you pinpoint the problem $\endgroup$
    – Prallax
    Aug 17, 2021 at 19:03
  • $\begingroup$ Yes, I've edited the question. I have added the periodogram. $\endgroup$ Aug 18, 2021 at 4:27

1 Answer 1


tl;dr: try a finer frequency grid to obtain the correct period, bin it with the function astropy.timeseries.aggregate_downsample

Before addressing the binning, you have to obtain a correct phase folded plot. You rightly call it "messy", the most likely reason is that the period you chose is wrong (assuming the data actually contains a periodic signal with good S/N).

I understand you might not want to share your code. I will then make some assumptions:

  • you are using python, matplotlib and astropy
  • you have computed the peridogram using astropy.timeseries.LombScargle
  • you have used the default normalization='standard'
  • you have taken the frequency of the highest peak on the plot you posted and used it to phase-fold the data

In general, blindly taking the highest peak of the peridogram that comes out of the Lomb-Scargle is often not the best approach. In particular in this case the highest peak has a value of about $\approx 0.020$, which is definitely low. The correct period usually comes with peridogram values higher than $0.4$ (the maximum is $1$). But don't take this as a rule. You may use the method false_alarm_probability to better quantify the probability that the peak is significant and not random.

I believe that you have not found the correct period because you have used a too coarse frequency grid. The period lies between the points and you have missed it. Use a much finer frequency grid and you might be able to see a new peak appearing, very high and narrow. Alternatively, if you don't want to choose the spacing yourself, you may use the autopower method, that should find the best frequency grid for you.

After you have found the correct period and your folded curve makes sense, binning is the easiest part, there is a function that does just that: astropy.timeseries.aggregate_downsample.

Everything that I just said (and much more) is explained in the documentation of astropy, which is really complete and easy to understand. I cannot stress it enough, read the documentation and you will find that most of the problems you may encounter are already addressed there:

astropy: Lomb-Scargle

astropy: Time Series

And a more technical paper that explains the capabilities and limitations of the Lomb-Scargle, I suggest you keep it as a reference:

Understanding the Lomb-Scargle Periodogram

  • 2
    $\begingroup$ The Vanderplas paper is excellent. $\endgroup$
    – ProfRob
    Aug 18, 2021 at 7:24
  • 2
    $\begingroup$ @ProfRob I just discovered it this morning, I am really impressed $\endgroup$
    – Prallax
    Aug 18, 2021 at 7:24
  • $\begingroup$ There are some interesting things here: vanderplas.com Though not about Astronomy per se I linked to their github in this SO answer. Also, there are some other Lomb-Scargle questions and periodogram questions that may also be in need of additional attention. $\endgroup$
    – uhoh
    Aug 19, 2021 at 0:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .