Search code examples
python-3.xnumpystatisticsfftastropy

Lomb Scargle phase


Is there any way I can extract the phase from the Lomb Scargle periodogram? I'm using the LombScargle implementation from gatspy.

from gatspy.periodic import LombScargleFast

model = LombScargleFast().fit(t, y)
periods, power = model.periodogram_auto()
frequencies = 1 / periods
fig, ax = plt.subplots()
ax.plot(frequencies, power)
plt.show()

Power gives me an absolute value. Any way I can extract the phase for each frequency as I can for a discrete fourier transform.


Solution

  • The Lomb-Scargle method produces a periodogram, i.e., powers at each frequency. This is in order to be able to be performant, compared to directly least-squares fitting a sinusoidal model. I don't know about gatspy, but astropy does allow you to compute the best phase for a specific frequency of interest, see http://docs.astropy.org/en/stable/stats/lombscargle.html#the-lomb-scargle-model . I imagine doing this for many frequencies is many times slower than computing the periodogram.

    -EDIT-

    The docs outline moved to: https://docs.astropy.org/en/stable/timeseries/lombscargle.html