skills/timeseries/multiband-lomb-scargle-period/SKILL.md
Estimate periodicity from irregularly sampled multi-band time series using the multiband Lomb-Scargle periodogram, then phase-fold observations
npx skillsauth add wenmin-wu/ds-skills timeseries-multiband-lomb-scargle-periodInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
For irregularly sampled multi-band time series (e.g. photometric light curves), the multiband Lomb-Scargle periodogram estimates the dominant period by jointly fitting all bands. After finding the best period, phase-fold observations (time mod period) to expose the underlying shape. The period and phase-folded features are powerful for classification of periodic signals.
import numpy as np
from gatspy.periodic import LombScargleMultiband
def estimate_period(times, values, errors, bands, t_min=0.1, t_max=10.0):
"""Estimate period from multi-band irregular time series.
Args:
times: observation timestamps
values: measured values (flux)
errors: measurement uncertainties
bands: passband identifiers per observation
t_min, t_max: period search range
"""
model = LombScargleMultiband(fit_period=True)
model.optimizer.set(
period_range=(t_min, t_max),
first_pass_coverage=5)
model.fit(times, values, dy=errors, filts=bands)
return model.best_period
def phase_fold(times, period):
"""Fold time series by estimated period."""
return (times / period) % 1.0
# Usage
period = estimate_period(df.mjd, df.flux, df.flux_err, df.passband)
df['phase'] = phase_fold(df.mjd, period)
data-ai
Scaled Pinball Loss (SPL) metric for evaluating quantile forecasts, normalized by mean absolute successive differences of training data
data-ai
Walk backward through a time series and multiplicatively rescale segments when jumps exceed a fraction of the running mean to correct data collection anomalies
testing
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
tools
Convert point forecasts to prediction intervals by scaling with logit-transformed quantile ratios passed through a Normal CDF