varistar is a Python package for working with photometric time series of variable stars. It grew out of the analysis code I wrote during my machine-learning internship (with professor Alejandro García-Varela) at Universidad de los Andes and turned into a proper, documented package on PyPI.
pip install varistar
# or
uv add varistar
How it is organized
The package is built around three objects:
TimeSeries: raw photometry. Loading from OGLE, TESS, Gaia DR3, CSV files or plain arrays, plus cleaning (sigma and outlier clipping, binning) and descriptive statistics.LightCurve: wraps aTimeSeriesfor period finding, phase folding and model fitting.TestGroup: runs the same steps over many stars at once for batch workflows.
from varistar import TimeSeries, LightCurve
ts = TimeSeries(magnitude="mag I", time_scale="HJD")
ts.load_data_from_df(df, data_id="star_001")
lc = LightCurve(ts)
lc.find_best_period()
lc.plot_best()
Features
- Period finding with several backends: Lomb-Scargle (default), PDM, PDM2 and Spectrum Resampling, which bootstraps the period to give an uncertainty.
find_best_period()also checks for harmonic aliases and phase coverage, and flags results that look non-periodic or not dominant. - Phase folding and models: Fourier series and Gaussian models (single, double and super-Gaussian) fitted to the folded curve.
- Classification: variability indices and eclipsing-binary detection.
- ML feature pipeline: feature extraction and clustering over groups of stars.
- Visualization: publication-styled static figures and interactive plots.
I have used it for RR Lyrae work, including distance estimates to the SMC with Gaia DR3 data, and its object-oriented design later served as the model for my tokamak analysis package, aug.
Documentation, tutorials and the API reference are at docs.jjsm.science/astrophysics/varistar.