cuperiod.Periodogram

class cuperiod.Periodogram(method, backend, frequency, period, power, objective_sense, n_samples, baseline, extras=<factory>, meta=<factory>)[source]

Bases: object

A computed periodogram for a single light curve and method.

Parameters:
  • method (str)

  • backend (str)

  • frequency (NDArray[float64])

  • period (NDArray[float64])

  • power (NDArray[float64])

  • objective_sense (Literal['max', 'min'])

  • n_samples (int)

  • baseline (float)

  • extras (Mapping[str, NDArray[float64]])

  • meta (Mapping[str, Any])

method, backend

The method name and the concrete backend that produced this spectrum.

Type:

str

frequency, period, power

The raw spectrum, ascending in frequency (period = 1/frequency).

Type:

numpy.ndarray

objective_sense

Whether peaks are maxima or minima of power.

Type:

{"max", "min"}

n_samples

Number of finite light-curve points used.

Type:

int

baseline

Time baseline in days (sets the Rayleigh resolution 1/baseline).

Type:

float

extras

Per-grid method-specific arrays, aligned with frequency.

Type:

Mapping[str, numpy.ndarray]

meta

Free-form metadata carried from the light curve.

Type:

Mapping

classmethod from_spectrum(*, method, backend, frequency, power, objective_sense, n_samples, baseline, extras=None, meta=None)[source]

Build a Periodogram, sorting everything into ascending frequency.

Parameters:
  • method (str)

  • backend (str)

  • frequency (NDArray[float64])

  • power (NDArray[float64])

  • objective_sense (Literal['max', 'min'])

  • n_samples (int)

  • baseline (float)

  • extras (Mapping[str, NDArray[float64]] | None)

  • meta (Mapping[str, Any] | None)

Return type:

Periodogram

property size: int

Number of grid samples.

best_periods(n=10, *, min_separation_rayleigh=3.0, alias_diverse=False, harmonic_max=8)[source]

Return the n most significant peaks.

Parameters:
  • n (int, default 10) – Maximum number of peaks.

  • min_separation_rayleigh (float, default 3.0) – Minimum peak separation in Rayleigh widths (1/baseline).

  • alias_diverse (bool, default False) – If True, skip candidates alias- or harmonic-related to a chosen peak (recommended for box searches).

  • harmonic_max (int, default 8) – Highest harmonic order considered when alias_diverse is set.

Returns:

list of Peak – Ranked most-significant first.

Return type:

list[Peak]

best_period()[source]

The single most significant period in days (NaN if none is finite).

Return type:

float

downsample(n_points=2000)[source]

Peak-preserving downsample of (frequency, power) to n_points.

Parameters:

n_points (int)

Return type:

tuple[NDArray[float32], NDArray[float32]]

to_dict(*, n_best=10, include_raw=False)[source]

Serialize to a plain dict (peaks always; raw spectrum optional).

Parameters:
  • n_best (int)

  • include_raw (bool)

Return type:

dict[str, Any]