Skip to main content

Module non_uniformly_sampled

Module non_uniformly_sampled 

Source
Expand description

Spectral estimation for non-uniformly sampled data.

Ordinary FFT spectra assume evenly spaced samples. When samples fall at irregular times (missed measurements, event-driven sensors, astronomical observations) the usual tools are:

  • the Lomb-Scargle periodogram (lomb_scargle), which fits a sinusoid by least squares at each trial frequency. It is equivalent to the classical periodogram for even sampling, copes with arbitrary gaps, and with irregular times is not subject to the usual Nyquist aliasing, so frequencies far above the average sampling rate can still be detected;
  • the non-uniform discrete Fourier transform (non_uniform_dft), a direct evaluation of Σ y[n] e^{-j2π f t[n]} at arbitrary frequencies;
  • a three-parameter least-squares sinusoid fit (fit_sinusoid) giving the amplitude and phase at one frequency.

All routines cost O(N · F) (samples times frequencies).

See the book entry Power spectra: periodogram, Welch, spectrogram and Lomb-Scargle.

Structs§

SinusoidFit
The result of fitting offset + amplitude · cos(2π f t + phase) to the samples.

Functions§

fit_sinusoid
Least-squares fit of a constant plus a sinusoid of known frequency f (cycles per unit time).
lomb_scargle
The Lomb-Scargle periodogram of samples y taken at times t, at the given angular frequencies (radians per unit time).
lomb_scargle_frequency_grid
A sensible frequency grid (cycles per unit time, excluding zero) for lomb_scargle: spacing 1 / (oversampling · T) for a record of duration T, extending to max_frequency.
non_uniform_dft
Non-uniform discrete Fourier transform: X(f) = Σ y[n] e^{-j2π f t[n]} at each frequency (in cycles per unit time).
non_uniformly_sampled_spectrum
Lomb-Scargle power at frequencies given in cycles per unit time (Hz when t is in seconds). This is the spectrum of irregularly sampled data as a function of ordinary frequency.