Lomb-Scargle periodograms¶
Fast algorithm for spectral analysis of unevenly sampled data
The Lomb-Scargle method performs spectral analysis on unevenly sampled data and is known to be a powerful way to find, and test the significance of, weak periodic signals. The method has previously been thought to be ‘slow’, requiring of order 10(2)N(2) operations to analyze N data points. We show that Fast Fourier Transforms (FFTs) can be used in a novel way to make the computation of order 10(2)N log N. Despite its use of the FFT, the algorithm is in no way equivalent to conventional FFT periodogram analysis.
- Keywords:
- DATA SAMPLING, FAST FOURIER TRANSFORMATIONS, SPECTRUM ANALYSIS, SIGNAL PROCESSING
Example:
>>> import numpy
>>> import lombscargle
>>> x = numpy.arange(10)
>>> y = numpy.sin(x)
>>> fx,fy, nout, jmax, prob = lombscargle.fasper(x,y, 6., 6.)
- Reference:
- Press, W. H. & Rybicki, G. B. 1989 ApJ vol. 338, p. 277-280. Fast algorithm for spectral analysis of unevenly sampled data bib code: 1989ApJ...338..277P
-
YSOVAR.lombscargle.
fasper
(x, y, ofac, hifac, MACC=4)¶ function fasper
Given abscissas x (which need not be equally spaced) and ordinates y, and given a desired oversampling factor
ofac
(a typical value being 4 or larger). This routine creates an arraywk1
with a sequence ofnout
increasing frequencies (not angular frequencies) up tohifac
times the “average” Nyquist frequency, and creates an arraywk2
with the values of the Lomb normalized periodogram at those frequencies. The arraysx
andy
are not altered. This routine also returnsjmax
such thatwk2[jmax]
is the maximum element inwk2
, andprob
, an estimate of the significance of that maximum against the hypothesis of random noise. A small value ofprob
indicates that a significant periodic signal is present.- Reference:
- Press, W. H. & Rybicki, G. B. 1989 ApJ vol. 338, p. 277-280. Fast algorithm for spectral analysis of unevenly sampled data (1989ApJ...338..277P)
- History:
- 02/23/2009, v1.0, MF
- Translation of IDL code (orig. Numerical recipies)
Parameters: X : array
Abscissas (e.g. an array of times).
Y : array
Ordinates (e.g. corresponding counts).
Ofac : integer
Oversampling factor.
Hifac : float
Hifac * “average” Nyquist frequency = highest frequency for which values of the Lomb normalized periodogram will be calculated.
Returns: Wk1 : array
Lomb periodogram frequencies.
Wk2 : array
corresponding values of the Lomb periodogram.
Nout : tuple
Wk1 & Wk2 dimensions (number of calculated frequencies)
Jmax : integer
The array index corresponding to the MAX( Wk2 ).
Prob : float
False Alarm Probability of the largest Periodogram value
MACC : integer
Number of interpolation points per 1/4 cycle of highest frequency
-
YSOVAR.lombscargle.
getSignificance
(wk1, wk2, nout, ofac)¶ returns the peak false alarm probabilities
Hence the lower is the probability and the more significant is the peak
-
YSOVAR.lombscargle.
lombscargle
(time, mag, maxper=15.0, oversamp=4, maxfreq=1.0)¶ calculate Lomb-Scargle periodograms for all sources
A new column is added to the datatable that contains the result. (If the column exists before, it is overwritten).
Parameters: time : np.ndarray
times of observation
mag : np.ndarray
Observed magnitudes
maxper : float
periods above this value will be ignored
oversamp : integer
oversampling factor
maxfreq : float
max freq of LS periodogram is maxfreq * “average” Nyquist frequency For very inhomogenously sampled data, values > 1 can be useful
Returns: period1: float :
Period with highest probability in the allowed range
sig1: float :
Value of the Lomb-Scargle-Periodogram at that position
fap: float :
corresponding false-alarm probability