cuperiod.LightCurve

class cuperiod.LightCurve(time, value, error=None, domain=Domain.MAGNITUDE, meta=<factory>)[source]

Bases: object

A single band’s time series.

Parameters:
  • time (numpy.ndarray) – Observation times (JD/HJD/BJD), float64. Units are days throughout cuPeriod.

  • value (numpy.ndarray) – Brightness in magnitudes or flux (see domain).

  • error (numpy.ndarray, optional) – 1-sigma uncertainty on value. None means unweighted.

  • domain (Domain, default Domain.MAGNITUDE) – Whether value is a magnitude or a flux.

  • meta (Mapping, optional) – Free-form metadata (e.g. object id, band name) carried through results.

Notes

Arrays are coerced to contiguous float64 and length-checked on construction. Non-finite points are not removed here; call finite() for that.

property n: int

Number of points.

property baseline: float

Time span max(time) - min(time) in days (0.0 if empty).

classmethod from_arrays(time, value, error=None, *, domain=Domain.MAGNITUDE, meta=None)[source]

Build from raw array-likes.

Parameters:
  • time (object)

  • value (object)

  • error (object | None)

  • domain (Domain)

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

Return type:

LightCurve

classmethod from_dataframe(df, *, columns=None, domain=None, meta=None)[source]

Build from a pandas DataFrame with column auto-detection.

Parameters:
  • df (pd.DataFrame)

  • columns (ColumnMap | None)

  • domain (Domain | None)

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

Return type:

LightCurve

classmethod from_file(path, *, columns=None, domain=None, meta=None)[source]

Build from a CSV/ECSV/FITS/Parquet file with column auto-detection.

Parameters:
  • path (str | Path)

  • columns (ColumnMap | None)

  • domain (Domain | None)

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

Return type:

LightCurve

classmethod from_fits(path, *, hdu=1, columns=None, domain=None, meta=None)[source]

Build from a binary-table FITS file (hdu selects the extension).

Parameters:
  • path (str | Path)

  • hdu (int | str)

  • columns (ColumnMap | None)

  • domain (Domain | None)

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

Return type:

LightCurve

finite()[source]

Return a copy with non-finite points (and non-positive errors) removed.

Drops samples where time or value is NaN/inf, and — when errors are present — where the error is non-finite or <= 0 (an unusable weight).

Return type:

LightCurve

as_flux(*, zeropoint=0.0)[source]

Convert to the flux domain (no-op if already flux).

Uses flux = 10 ** (-0.4 * (mag - zeropoint)) and propagates the error as flux_err = 0.4 ln(10) * flux * mag_err.

Parameters:

zeropoint (float)

Return type:

LightCurve

as_magnitude(*, zeropoint=0.0)[source]

Convert to the magnitude domain (no-op if already magnitude).

Uses mag = -2.5 log10(flux) + zeropoint and propagates the error as mag_err = (2.5 / ln 10) * flux_err / flux. Non-positive flux has no real magnitude; those points become non-finite (without a spurious NumPy warning) and are removed by finite().

Parameters:

zeropoint (float)

Return type:

LightCurve

in_domain(domain, *, zeropoint=0.0)[source]

Return this light curve converted to domain.

Parameters:
  • domain (Domain)

  • zeropoint (float)

Return type:

LightCurve