Skip to content

Add worked-example notebook (+ tolerant method-name lookup) - #9

Merged
tjayasinghe merged 2 commits into
mainfrom
docs/example-notebook
Jun 30, 2026
Merged

Add worked-example notebook (+ tolerant method-name lookup)#9
tjayasinghe merged 2 commits into
mainfrom
docs/example-notebook

Conversation

@tjayasinghe

Copy link
Copy Markdown
Owner

Summary

Adds a worked-example Jupyter notebook that teaches cuPeriod on real light curves,
and fixes a small documented-vs-actual method-name bug found while building it.

examples/cuperiod_tour.ipynb

A guided tour — for each object it shows raw light curve → periodogram → phase-folded:

Object Method Teaches
Classical Cepheid GLS the basics
RR Lyrae MHAOV sharp, multiharmonic pulsations
Eclipsing binary BLS (+ the GLS P/2 trap) choosing the right method
Long-period variable (Mira) PDM non-sinusoidal folds, long baselines
Exoplanet (Kepler KIC 7532973) TLS transit matched filter
several comparing methods, reading N-best peaks
  • Self-contained & offline: examples/data/ bundles 6 public ASAS-SN g-band light
    curves (one per variability class, with VSX periods) and one Kepler KOI (fetched once
    via lightkurve). No network needed.
  • Outputs baked in, so the plots render directly on GitHub.
  • Linked from the README and the docs quickstart. (examples/ is outside the sdist
    allowlist, so it doesn't bloat the PyPI package.)

Fix: hyphenated method names

The README/docs use "String-Length", but get_method did name.upper()
"STRING-LENGTH" ≠ the registry key "STRINGLENGTH", so the documented spelling raised
UnknownMethodError
. get_method, register, and MultiResult.__getitem__ now
normalize names (uppercase, strip non-alphanumerics): "String-Length" ==
"StringLength" == "STRINGLENGTH" (and "gls" == "GLS"). New registry tests cover it.

Verification

pytest 139 passed / 2 skipped, ruff + mypy clean, docs -W clean, notebook executes
end-to-end (0 errors, 6 figures).

🤖 Generated with Claude Code

tjayasinghe and others added 2 commits June 30, 2026 08:16
examples/cuperiod_tour.ipynb is a guided tour over real light curves -- a Cepheid (GLS),
an RR Lyrae (MHAOV), an eclipsing binary (BLS, with the GLS P/2 trap), a Mira (PDM), and a
confirmed Kepler exoplanet (TLS) -- showing for each the raw light curve, the periodogram,
and the phase-folded result, plus a multi-method comparison and the N-best peaks. It is
self-contained: examples/data/ bundles 6 public ASAS-SN g-band light curves and one Kepler
KOI (fetched once via lightkurve), so it runs offline. Outputs are baked in so the plots
render on GitHub. Linked from the README and the docs quickstart.

While building it, found that the documented "String-Length" spelling raised
UnknownMethodError (get_method did name.upper(), but the registry key is "STRINGLENGTH").
get_method, register and MultiResult.__getitem__ now normalize names by uppercasing and
dropping non-alphanumerics, so "String-Length" == "StringLength" == "STRINGLENGTH" (and
"gls" == "GLS"), matching the docs. Added registry tests.

Verified: pytest 139 passed / 2 skipped, ruff + mypy clean, docs -W build clean, notebook
executes end-to-end (0 errors, 6 figures).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the noisy composite-type RR Lyrae with ASASSN-V J000003.69+352146.0 (GM And), a
clean RRAB (g-band fold scatter ~0.02 mag), fetched from ASAS-SN Sky Patrol. Its
ground-based periodogram is dominated by the 1-day alias and integer-period subharmonics,
so the MHAOV search is bounded to the physical RR Lyrae range (0.3-1 day) — which recovers
the true 0.70675 d and doubles as a teaching point about aliases.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tjayasinghe
tjayasinghe merged commit 80ddd6a into main Jun 30, 2026
6 checks passed
@tjayasinghe
tjayasinghe deleted the docs/example-notebook branch June 30, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant