Base classes¶
Some commonly needed functionality and data structures are implemented by the below listed classes.
The TimeSeries base class¶
This class provides an interface for a time series, viz., a time, flux, and (optionally) an error array.
- class PyAstronomy.pyTiming.pyPeriod.TimeSeries(time, flux, error=None)¶
A container class that holds the observed light curve.
- Parameters
- timearray
The time array.
- fluxarray
The observed flux/data.
- errorarray, optional
The error of the data values.
Methods
Calculate the average Nyquist frequency.
- returnNyquist()¶
Calculate the average Nyquist frequency.
- Returns
- Nyquist frequencyfloat
Half the sampling frequency of the time series.
The PeriodBase Base class¶
This class provides functionality and an interface needed in every periodogram class. The latter are to inherit from this class so that the functionality and interface can be shared.
- class PyAstronomy.pyTiming.pyPeriod.PeriodBase¶
Base class for all periodograms.
This class provides the framework for all periodograms within pyPeriod package.
PeriodBase has a plot method, which can be used to provide a quick-look of the result. The significance of a feature with a power Pn can be assessed using the prob and FAP methods.
- Attributes
- powerarray
The periodogram power.
- freqarray
The frequencies at which the power are evaluated.
Methods
FAP
(Pn)Obtain the false-alarm probability (FAP).
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.
- 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.