Skip to content

ntpstats.spectrum

Power spectral densities of clock data (IEEE Std 1139, NIST SP 1065 section 6).

One-sided PSDs, in the usual time-and-frequency units:

  • S_x(f): phase (time) fluctuations, s²/Hz;
  • S_y(f): fractional frequency, 1/Hz; S_y = (2πf)² S_x;
  • L(f): single-sideband phase noise of a carrier nu0, L(f) = S_phi(f)/2 = (2π nu0)² S_x(f) / 2, usually in dBc/Hz.

Estimation is Welch's method (Hann window, 50 % overlap) or sine multitaper (Riedel & Sidorenko 1995), on each gap-free stretch of the data; stretches are combined by weighting with their number of segments. S_y is taken from first differences of the phase, which keeps leakage small for the steep spectra of random-walk FM. Log-spaced frequency bins average the raw ordinates and carry their degrees of freedom, so they can be used in fits.

Spectrum dataclass

lf_dbc(nu0)

L(f) in dBc/Hz for a carrier nu0 (Hz), from a phase spectrum.

psd(values, tau0, nperseg=None, method='welch', tapers=5, min_run=None)

PSD of an evenly sampled sequence with NaN gaps (units²/Hz).

nperseg defaults to the longest power of two that gives at least eight segments in the longest stretch (Welch) or the whole stretch (multitaper). Stretches shorter than nperseg are skipped.

log_bins(sp, per_decade=10)

Average ordinates in log-spaced bins; dof adds up. Low bins with one ordinate are kept as is.

phase_psd(x, tau0, **kw)

S_x(f) of phase data (s), linear trend (frequency offset) removed per stretch.

frequency_psd(x, tau0, **kw)

S_y(f) from first differences of phase data, y = Δx/τ0.

series_spectrum(series, kind='y', tau0=None, max_gap=3.0, per_decade=10, **kw)

Spectrum of a :class:TimeSeries offset (resampled to a uniform grid; gaps stay gaps).