cuperiod.LightCurve¶
- class cuperiod.LightCurve(time, value, error=None, domain=Domain.MAGNITUDE, meta=<factory>)[source]¶
Bases:
objectA 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 (seedomain).error (
numpy.ndarray, optional) – 1-sigma uncertainty onvalue.Nonemeans unweighted.domain (
Domain, defaultDomain.MAGNITUDE) – Whethervalueis 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:
- classmethod from_dataframe(df, *, columns=None, domain=None, meta=None)[source]¶
Build from a pandas
DataFramewith column auto-detection.- Parameters:
- Return type:
- classmethod from_file(path, *, columns=None, domain=None, meta=None)[source]¶
Build from a CSV/ECSV/FITS/Parquet file with column auto-detection.
- Parameters:
- Return type:
- classmethod from_fits(path, *, hdu=1, columns=None, domain=None, meta=None)[source]¶
Build from a binary-table FITS file (
hduselects the extension).- Parameters:
- Return type:
- 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:
- 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 asflux_err = 0.4 ln(10) * flux * mag_err.- Parameters:
zeropoint (float)
- Return type:
- as_magnitude(*, zeropoint=0.0)[source]¶
Convert to the magnitude domain (no-op if already magnitude).
Uses
mag = -2.5 log10(flux) + zeropointand propagates the error asmag_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 byfinite().- Parameters:
zeropoint (float)
- Return type: