Skip to content

Periodogram

light_curve.Periodogram

Bases: light_curve.light_curve_ext._FeatureEvaluator

Peaks of Lomb–Scargle periodogram and periodogram as a meta-feature

Periodogram \(P(\omega)\) is an estimate of spectral density of unevenly time series. peaks argument corresponds to a number of the most significant spectral density peaks to return. For each peak its period and "signal to noise" ratio is returned:

\[ \mathrm{signal~to~noise~of~peak} \equiv \frac{P(\omega_\mathrm{peak}) - \langle P(\omega) \rangle}{\sigma\_{P(\omega)}}. \]

[Periodogram] can accept other features for feature extraction from periodogram as it was time series without observation errors (unity weights are used if required). You can even pass one [Periodogram] to another one if you are crazy enough

  • Depends on: time, magnitude
  • Minimum number of observations: as required by sub-features, but at least two
  • Number of features: \(2 \times \mathrm{peaks}\) plus sub-features

Parameters:

Name Type Description Default
peaks int or None

Number of peaks to find, default is 1

required
resolution float or None

Resolution of frequency grid, default is 10

required
max_freq_factor float or None

Mulitplier for Nyquist frequency, default is 1

required
nyquist str or float or None

Type of Nyquist frequency. Could be one of: - 'average': "Average" Nyquist frequency - 'median': Nyquist frequency is defined by median time interval between observations - float: Nyquist frequency is defined by given quantile of time intervals between observations Default is 'average'

required
freqs array - like or None

Explicid and fixed frequency grid (angular frequency, radians/time unit). If given, resolution, max_freq_factor and nyquist are being ignored. For fast=True the only supported type of the grid is np.linspace(0.0, max_freq, 2**k+1), where k is an integer. For fast=False any grid is accepted, but linear grids, like np.linspace(min_freq, max_freq, n), apply some computational optimisations.

required
fast bool or None

Use "Fast" (approximate and FFT-based) or direct periodogram algorithm, default is True

required
features iterable or None

Features to extract from periodogram considering it as a time-series, default is None which means no additional features Features to extract from periodogram considering it as a time-series

required
normalization str

Normalization of the periodogram power. Affects power(), freq_power(), and feature extraction via __call__(). Let P be the raw power and n the number of observations. Must be one of: - 'psd': Raw power P, unnormalized (default). Consistent with scipy.signal.lombscargle(normalize=False) on variance-normalized data, but differs from astropy's 'psd' convention - 'standard': P_std = P * 2 / (n - 1), values in [0, 1]. Matches astropy's 'standard' normalization - 'model': P_std / (1 - P_std), values in [0, inf). Matches astropy's 'model' normalization - 'log': -ln(1 - P_std), values in [0, inf). Matches astropy's 'log' normalization Default is 'psd'

required
transform None

Not supported for Periodogram, peaks are not transformed, but you still may apply transformation for the underlying features with thier constructors

required

Attributes:

Name Type Description
names list of str

Feature names

descriptions list of str

Feature descriptions

freq_power(t, m, *, cast=False)

Get periodogram as a pair of frequencies and power values

Parameters

t : np.ndarray of np.float32 or np.float64 Time array m : np.ndarray of np.float32 or np.float64 Magnitude (flux) array cast : bool, optional Cast inputs to np.ndarray objects of the same dtype

Returns

freq : np.ndarray of np.float32 or np.float64 Frequency grid power : np.ndarray of np.float32 or np.float64 Periodogram power

power(t, m, *, cast=False)

Get periodogram power

Parameters

t : np.ndarray of np.float32 or np.float64 Time array m : np.ndarray of np.float32 or np.float64 Magnitude (flux) array cast : bool, optional Cast inputs to np.ndarray objects of the same dtype

Returns

power : np.ndarray of np.float32 or np.float64 Periodogram power

Examples:

>>> import numpy as np
>>> from light_curve import Periodogram
>>> periodogram = Periodogram(peaks=2, resolution=20.0, max_freq_factor=2.0,
...                           nyquist='average', fast=True)
>>> t = np.linspace(0, 10, 101)
>>> m = np.sin(2*np.pi * t / 0.7) + 0.5 * np.cos(2*np.pi * t / 3.3)
>>> peaks = periodogram(t, m, sorted=True)[::2]
>>> frequency, power = periodogram.freq_power(t, m)

freq_power method descriptor

Angular frequencies and periodogram values

power method descriptor

Periodogram values