Be-star H-α variability in ten lines¶
Be stars show emission-line outbursts in H-α that come and go over weeks to months. Watching the line evolve epoch by epoch is one of the satisfying amateur-pro overlap targets - and one of the cleanest ways to demonstrate the kernel's time-series tools.
This walk-through generates a small synthetic Be-star campaign (six epochs of H-α with a varying emission peak), stacks the spectra, then renders a dynamic-spectrum heatmap, a 3D surface and an animation - the same three complementary views you would build for a real BeSS dataset.
1. Synthesise the campaign¶
import numpy as np
from spectro_kernel.types import Spectrum1D, WorkContext
wave = np.linspace(6520, 6610, 1200)
spectra = []
for i, amp in enumerate([0.15, 0.40, 0.65, 0.55, 0.30, 0.20]):
flux = 1.0 + amp * np.exp(-0.5 * ((wave - 6562.8) / 2.2) ** 2)
flux -= 0.45 * np.exp(-0.5 * ((wave - 6562.8) / 8.0) ** 2) # underlying absorption
flux += np.random.default_rng(i).normal(0, 0.01, wave.size)
spectra.append(Spectrum1D(wave, flux, meta={"epoch": i, "object": "synthetic Be"}))
ctx = WorkContext(spectra=spectra)
2. Run the visualisation preset¶
from spectro_kernel import PipelineBuilder
pipeline = PipelineBuilder().from_preset("time_series_overview").build()
result = pipeline.execute(ctx)
assert result.success
# Three figures, ready for any Plotly-aware front-end:
fig_heatmap = ctx.figures["dynamic_spectrum"]
fig_surface = ctx.figures["surface"]
fig_animation = ctx.figures["animation"]
3. Or do it from the command line¶
If you saved the six FITS files to a directory, the same workflow is one line:
(For multi-input pipelines the upcoming MCP tool load_spectra_directory is the
natural answer; today the cleanest path is the Python snippet above.)
What you should see¶
- The heatmap shows the emission peak intensifying, plateauing, then fading along the vertical (time) axis.
- The 3D surface turns the same data into a landscape - the eye reads the flux as height, which makes the outburst look like a wave passing through.
- The animation plays each epoch in turn, so the line breathes.
Going further¶
- Replace the synthetic spectra with real BeSS extractions - see the BeSS cookbook page.
- Add
compare_normalisations(Tier 2+) before stacking when continuum variations between nights are suspect. - Couple it with
lomb_scargleon a per-epoch line-strength metric to look for rotational modulation.