Classical Lomb-Scargle and FFT¶
Using the classes presented below, several periodograms can be calculated:
All the presented classes inherit from the PeriodBase class.
The Fourier Transform¶
- class PyAstronomy.pyTiming.pyPeriod.Fourier(lc, norm='Leahy')¶
This class computes the Fast Fourier Transform (FFT) of the input data.
This is actually a wrapper around numpy’s FFT routines. The constructor takes the light curve, lc (TimeSeries instance), as input. The optional argument specifies the normalization of the Fourier Power. Currently, only the normalization according to [Leahy83] is supported, which in the case of purely Poissonian noise results in a mean power of 2.
- Parameters
- lcTimeSeries instance
The light curve to be analyzed.
- normoptional, string
Normalization method; currently, only default (“Leahy”) is supported.
Methods
FAP
(Pn)Obtain the false-alarm probability (FAP).
Prob
(Pn)Returns the probability to obtain a power larger than the threshold, Pn.
plot
(*args, **kwargs)Creates a matplotlib figure and axes class instance to visualize the result.
powerLevel
(FAPlevel)Power threshold for FAP level.
stats
(Pn)Obtain basic statistics for power threshold.
prob
probInv
- FAP(Pn)¶
Obtain the false-alarm probability (FAP).
The FAP denotes the probability that at least one out of M independent power values in a prescribed search band of a power spectrum computed from a white-noise time series is as large as or larger than the threshold, Pn. It is assessed through
\[FAP(Pn) = 1 - (1-Prob(P>Pn))^M \; ,\]where “Prob(P>Pn)” depends on the type of periodogram and normalization and is calculated by using the prob method; M is the number of independent power values and is computed internally.
- Parameters
- Pnfloat
Power threshold.
- Returns
- FAPfloat
False alarm probability.
- Prob(Pn)¶
Returns the probability to obtain a power larger than the threshold, Pn.
In the calculations, the noise is assumed to be Poisson-distributed.
Note
According to [vdK] the probability to obtain a power larger than a given threshold from the noise is given by
\[Prob(p>Pn) = Q(M \times W \times Pn, 2 \times M \times W)\]where \(Q(\chi^2, \nu)\) is the cumulative \(\chi^2\) distribution with \(\nu\) d.o.f.
- Parameters
- Pnfloat
Power threshold.
- Returns
- FAPfloat
The probability to obtain a power larger than the specified threshold from noise.
- plot(*args, **kwargs)¶
Creates a matplotlib figure and axes class instance to visualize the result.
- Parameters:
FAPlevels - optional, List of false-alarm probability (FAP) levels
*args - optional, Arguments passed to plot method of axes class.
**kwargs - optional, Keyword arguments passed plot method to axes class.
This method provides a quick and simple way to visualize the results of the a periodogram calculation.
- Returns:
The created Figure and Axes class instances.
- powerLevel(FAPlevel)¶
Power threshold for FAP level.
- Parameters
- FAPlevelfloat or array
“False Alarm Probability” threshold
- Returns
- Thresholdfloat or array
The power threshold pertaining to a specified false-alarm probability (FAP). Powers exceeding this threshold have FAPs smaller than FAPlevel.
- stats(Pn)¶
Obtain basic statistics for power threshold.
- Parameters
- Pnfloat
Power threshold.
- Returns
- Statisticsdictionary
A dictionary containing {‘Pn’: Pn, ‘FAP’: FAP(Pn) , ‘Prob’: Prob(Pn)} for the specified power threshold, Pn.
The Lomb-Scargle-Periodogram (fast)¶
- class PyAstronomy.pyTiming.pyPeriod.LombScargle(lc, ofac, hifac)¶
Calculate the Lomb-Scargle periodogram.
The constructor of LombScargle takes a TimeSeries instance, i.e., a light curve object, as first argument. It then computes the usual Lomb-Scargle periodogram using a fast algorithm. The frequency array is constructed on the fly based on the oversampling keywords, which are mandatory in this case. The power is normalized according to the prescription of [HB86].
The result, i.e., the power, is stored in the class attribute power.
Note
Adapted from routine of the same routine in [NR] , based on period.pro by Han Wen, August 1996.
- Parameters
- lcTimesSeries instance
The light curve to be analyzed.
- ofacint
Oversampling factor.
- hifacfloat
Maximum frequency freq = hifac * (average Nyquist frequency).
Methods
FAP
(Pn)Obtain the false-alarm probability (FAP).
Prob
(Pn)Outdated -- use "prob" instaed.
ProbInv
(Prob)Outdated -- use "probInv" instaed
plot
(*args, **kwargs)Creates a matplotlib figure and axes class instance to visualize the result.
powerLevel
(FAPlevel)Power threshold for FAP level.
prob
(Pn)Returns the probability to obtain a power larger than the threshold.
probInv
(Prob)Returns the minimum power for a given probability level Prob.
stats
(Pn)Obtain basic statistics for power threshold.
- FAP(Pn)¶
Obtain the false-alarm probability (FAP).
The FAP denotes the probability that at least one out of M independent power values in a prescribed search band of a power spectrum computed from a white-noise time series is as large as or larger than the threshold, Pn. It is assessed through
\[FAP(Pn) = 1 - (1-Prob(P>Pn))^M \; ,\]where “Prob(P>Pn)” depends on the type of periodogram and normalization and is calculated by using the prob method; M is the number of independent power values and is computed internally.
- Parameters
- Pnfloat
Power threshold.
- Returns
- FAPfloat
False alarm probability.
- Prob(Pn)¶
Outdated – use “prob” instaed.
- ProbInv(Prob)¶
Outdated – use “probInv” instaed
- plot(*args, **kwargs)¶
Creates a matplotlib figure and axes class instance to visualize the result.
- Parameters:
FAPlevels - optional, List of false-alarm probability (FAP) levels
*args - optional, Arguments passed to plot method of axes class.
**kwargs - optional, Keyword arguments passed plot method to axes class.
This method provides a quick and simple way to visualize the results of the a periodogram calculation.
- Returns:
The created Figure and Axes class instances.
- powerLevel(FAPlevel)¶
Power threshold for FAP level.
- Parameters
- FAPlevelfloat or array
“False Alarm Probability” threshold
- Returns
- Thresholdfloat or array
The power threshold pertaining to a specified false-alarm probability (FAP). Powers exceeding this threshold have FAPs smaller than FAPlevel.
- prob(Pn)¶
Returns the probability to obtain a power larger than the threshold.
Compute the probability of obtaining a power value as large or larger the the threshold based on the noise, which is assumes to be Gaussian.
Note
LombScargle calculates the quantity (N-1)/2.*p=p’ (in the formalism of [ZK09]), which is de facto the normalization prescription of [HB86]. In this scheme the probability P(p’>Pn) is given by the following statement:
\[P(p'>Pn) = \left(1 - 2 \frac{Pn}{N-1} \right)^{(N-3)/2}\]If properly normalized to the population variance of the time series, which must be known a priori (usually not the case), the power \(p/p_n=p"\) is a direct measure of the SNR as proposed by [Scargle82]:
\[P(p">Pn) = exp(-Pn) \; .\]This formula is often used erroneously in this context.
- Parameters
- Pnfloat
Power threshold
- Returns
- FAPfloat
False alarm probability.
- probInv(Prob)¶
Returns the minimum power for a given probability level Prob.
This is the inverse of prob(Pn).
- Parameters
- Probfloat
Probability
- Returns
- MPLfloat
Minimum power level required.
- stats(Pn)¶
Obtain basic statistics for power threshold.
- Parameters
- Pnfloat
Power threshold.
- Returns
- Statisticsdictionary
A dictionary containing {‘Pn’: Pn, ‘FAP’: FAP(Pn) , ‘Prob’: Prob(Pn)} for the specified power threshold, Pn.