Skip to content

Add Microlensing pipeline (v1.0.0) — new top-level tab alongside Transit - #33

Merged
eagnespuerto merged 1 commit into
mainfrom
major-update-microlensing
Aug 9, 2026
Merged

Add Microlensing pipeline (v1.0.0) — new top-level tab alongside Transit#33
eagnespuerto merged 1 commit into
mainfrom
major-update-microlensing

Conversation

@eagnespuerto

Copy link
Copy Markdown
Owner

Splits the header into Transit / Microlensing tabs. The Microlensing pipeline contains two independent tools:

Module A: Model-comparison classifier

  • POST /api/microlensing/fit fits PSPL (Paczynski closed form, blended), Davenport-2014 flare template, and null models to a user-flagged window.
  • BIC-based verdict rules per spec (delta_bic > 10 = strong, |delta| < 6 = ambiguous), symmetry statistic, per-model residuals.
  • MulensModel parity test locks the closed-form PSPL to the reference implementation to < 1e-12.
  • Frontend: MicrolensingClassifier.tsx — data loader (JSON/CSV upload or synthetic PSPL/flare demo), SVG drag-select, 3-model overlay, verdict badge, BIC bar, PSPL params + 1sigma errors, residuals sub-plot.

Module B: TESS sector-overlap targeting

  • POST /api/microlensing/coverage takes a CSV of event_id,ra,dec,t0,tE and returns per-event sector coverage.
  • tess_sector_dates.py sources per-sector midtimes from tess-point's bundled TESS_Spacecraft_Pointing_Data (121 sectors, all calendar-anchored); anchor-formula fallback if tess-point missing.
  • Bulge / ecliptic blind-zone flag (|ecl lat| < 6 deg) surfaced with a prominent UI caveat.
  • Frontend: MicrolensingCoverage.tsx — CSV upload, sortable/observable-only table, sector pills with tooltips, Analyze row action.

Coverage → Classifier handoff

  • POST /api/microlensing/lightcurve_by_coords resolves RA/Dec to nearest TIC via MAST Catalogs, walks available sectors newest-first (preferring SPOC/TESS-SPOC/QLP over DVT-only), returns raw arrays plus TIC + provider
    • separation metadata.
  • Classifier's prefill banner offers a Fetch TESS light curve button that autoloads the LC into the classifier, with window auto-selected around t0 +/- 2 tE. MAST portal link kept as fallback.

Export + share

  • Share plot button rasterises the SVG (light curve + fit overlay) to PNG in-browser and uploads to ImgBB via the existing ShareToImgbbButton.
  • Download ExoFOP package button assembles a store-only ZIP with summary.csv (verdict, PSPL params, BICs, symmetry), lightcurve_windowed.csv (data + per-model curves on the same grid), notes.md, fit_full.json, and the plot PNG. Filename derived from event id + TIC + sector.

Tests

  • 23 microlensing tests (10 fit + 13 coverage) covering PSPL/flare/null recovery, symmetry, CSV parsing, sector lookup, and the bulge-zone flag.
  • MulensModel parity test skips cleanly when MulensModel isn't installed.

Docs

  • README.md rewritten to describe the split, both modules, all four endpoints, and the new export/share buttons; project layout updated.
  • docs/SCIENCE.md gains sections 15 (Module A: PSPL magnification math, Davenport template, BIC selection, symmetry statistic) and 16 (Module B: tess-point coordinate resolution, calendar-anchored windows, observability + wings margin, bulge blind zone).

Version bumped 0.2.0 -> 1.0.0.

Splits the header into Transit / Microlensing tabs. The Microlensing pipeline
contains two independent tools:

Module A — Model-comparison classifier
- POST /api/microlensing/fit fits PSPL (Paczynski closed form, blended),
  Davenport-2014 flare template, and null models to a user-flagged window.
- BIC-based verdict rules per spec (delta_bic > 10 = strong, |delta| < 6 =
  ambiguous), symmetry statistic, per-model residuals.
- MulensModel parity test locks the closed-form PSPL to the reference
  implementation to < 1e-12.
- Frontend: MicrolensingClassifier.tsx — data loader (JSON/CSV upload or
  synthetic PSPL/flare demo), SVG drag-select, 3-model overlay, verdict
  badge, BIC bar, PSPL params + 1sigma errors, residuals sub-plot.

Module B — TESS sector-overlap targeting
- POST /api/microlensing/coverage takes a CSV of event_id,ra,dec,t0,tE and
  returns per-event sector coverage.
- tess_sector_dates.py sources per-sector midtimes from tess-point's bundled
  TESS_Spacecraft_Pointing_Data (121 sectors, all calendar-anchored);
  anchor-formula fallback if tess-point missing.
- Bulge / ecliptic blind-zone flag (|ecl lat| < 6 deg) surfaced with a
  prominent UI caveat.
- Frontend: MicrolensingCoverage.tsx — CSV upload, sortable/observable-only
  table, sector pills with tooltips, Analyze row action.

Coverage → Classifier handoff
- POST /api/microlensing/lightcurve_by_coords resolves RA/Dec to nearest TIC
  via MAST Catalogs, walks available sectors newest-first (preferring
  SPOC/TESS-SPOC/QLP over DVT-only), returns raw arrays plus TIC + provider
  + separation metadata.
- Classifier's prefill banner offers a Fetch TESS light curve button that
  autoloads the LC into the classifier, with window auto-selected around
  t0 +/- 2 tE. MAST portal link kept as fallback.

Export + share
- Share plot button rasterises the SVG (light curve + fit overlay) to PNG
  in-browser and uploads to ImgBB via the existing ShareToImgbbButton.
- Download ExoFOP package button assembles a store-only ZIP with
  summary.csv (verdict, PSPL params, BICs, symmetry), lightcurve_windowed.csv
  (data + per-model curves on the same grid), notes.md, fit_full.json, and
  the plot PNG. Filename derived from event id + TIC + sector.

Tests
- 23 microlensing tests (10 fit + 13 coverage) covering PSPL/flare/null
  recovery, symmetry, CSV parsing, sector lookup, and the bulge-zone flag.
- MulensModel parity test skips cleanly when MulensModel isn't installed.

Docs
- README.md rewritten to describe the split, both modules, all four
  endpoints, and the new export/share buttons; project layout updated.
- docs/SCIENCE.md gains sections 15 (Module A: PSPL magnification math,
  Davenport template, BIC selection, symmetry statistic) and 16
  (Module B: tess-point coordinate resolution, calendar-anchored windows,
  observability + wings margin, bulge blind zone).

Version bumped 0.2.0 -> 1.0.0.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@eagnespuerto
eagnespuerto merged commit 5a10dd6 into main Aug 9, 2026
3 checks passed
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