Skip to content

Algorithm catalogue

115 algorithms in 26 categories, every one of them grounded in the published literature. This page and every algorithm page are generated from the registry at build time, so they are exactly what spectro list, list_algorithms() and the MCP server expose.

Each algorithm declares a backend (what it leans on), its literature references, its parameters with defaults, and what it reads from and writes to the WorkContext. Tools and agents can read the same catalogue as JSON validated by a JSON Schema (schema version 1, spectro-kernel 0.6.2).

Input / output

Algorithm What it does Backend Version
read_ascii_spectrum Read a 1D spectrum from a two- or three-column text file. numpy 1.0.0
read_echelle_fits Read a multi-order échelle FITS file into ctx.spectra. astropy 1.0.0
read_fits Read a 1D spectrum from a FITS file (local path or http(s) URL). astropy 2.0.0
read_sdss_spectrum Read an SDSS-format spectrum (spec-*.fits) into ctx.spectrum. astropy 1.1.0
read_votable_spectrum Read a 1D spectrum from a VOTable file (the IVOA Virtual Observatory format). astropy 1.0.0

Master frames

Algorithm What it does Backend Version
bias_combine Combine a stack of bias frames into one master bias. numpy 1.0.0
bias_combine_easyspec Combine bias frames into a master bias via easyspec.cleaning.master. easyspec 1.1.1
dark_combine Combine a stack of dark frames into a master dark. numpy 2.0.0
dark_combine_easyspec Combine dark frames into a master dark via easyspec.cleaning.master. easyspec 1.0.1
flat_combine Combine a stack of flat frames into a master flat (raw, not normalised). numpy 2.0.0
flat_combine_easyspec Combine flat frames into a master flat via easyspec.cleaning.master. easyspec 1.0.1

Preprocessing (2-D image)

Algorithm What it does Backend Version
correct_slant_affine Make monochromatic lines parallel to the rows by a horizontal shear. scipy 1.0.0
correct_smile_polynomial Undo smile curvature via the Schroeder even-order expansion. scipy 1.0.0
correct_tilt_affine Re-align the slit with the detector columns by a vertical shear. scipy 1.0.0
dark_subtract Subtract a master dark from ctx.image. numpy 1.0.0
denoise_gaussian_2d Separable isotropic Gaussian smoothing of ctx.image. scipy 1.0.0
denoise_median_2d Square median filter over ctx.image, optionally banded by rows. scipy 1.0.0
flat_normalize Divide ctx.image by a master flat normalised to unity. numpy 1.0.1
flat_normalize_easyspec Flat-field correct a science frame via cleaning.flatten. easyspec 1.0.1
outlier_rejection_mad_adaptive Replace pixels whose deviation from a local median exceeds threshold·MAD. numpy 1.0.1
subtract_bias_easyspec Subtract a master bias from a single science frame via cleaning.debias. easyspec 1.0.1
subtract_dark_easyspec Subtract a master dark from a science frame via cleaning.sub_dark. easyspec 1.0.1
subtract_sky_2d Subtract a per-column sky model fitted from off-trace rows of ctx.image. numpy 1.0.1

Cosmic-ray rejection

Algorithm What it does Backend Version
clip_cosmic_rays Detect and replace cosmic-ray hits on ctx.image. scipy 1.0.0
cosmic_ray_remove_easyspec Cosmic-ray (and optional gain) correction via CR_and_gain_corrections. easyspec 1.0.1

Extraction (2-D to 1-D)

Algorithm What it does Backend Version
detect_trace Detect the spectral trace on ctx.image and expose it on ctx.extras["trace"]. scipy 1.0.1
extract_sky_lateral_bands Median-combine two off-trace sky bands into a 1D pixel-axis reference. numpy 1.0.0
extract_spectrum_boxcar Trace (easyspec) + pure-numpy aperture extraction on ctx.image. easyspec 2.0.0
extract_spectrum_easyspec Trace and extract a 1D spectrum from a 2D frame via easyspec. easyspec 2.0.0
extract_spectrum_optimal Optimal (Horne 1986) aperture extraction of ctx.image. scipy 1.0.0
extract_spectrum_sum Extract a 1D spectrum from ctx.image by summing across the trace. numpy 2.0.0

Wavelength calibration

Algorithm What it does Backend Version
fit_emission_lines_gaussian Measure sub-pixel centroids of several emission lines at once. astropy 1.0.0
match_lamp_lines Auto-identify arc-lamp lines against the bundled NIST atlas. scipy 1.0.2
measure_arc_geometry Measure smile_radius + slant_deg from an arc-lamp 2-D image. scipy 2.0.0
reidentify_arc_features Re-anchor stored (pixel, λ) arc features onto a fresh arc exposure. scipy 1.0.0
wavelength_calibrate_easyspec Fit a wavelength polynomial via extraction.wavelength_calibration and apply it. easyspec 1.0.1
wavelength_calibrate_polynomial Fit a polynomial to (pixel → wavelength) pairs and apply it to the spectrum. numpy 1.0.1
wavelength_calibration_in_situ Refine the wavelength zero-point from simultaneously-acquired sky lines. astropy 1.0.0
wavelength_calibration_solar Calibrate a solar spectrum from built-in Fraunhofer line wavelengths. scipy 2.0.0

Flux calibration

Algorithm What it does Backend Version
flux_calibrate_easyspec Flux-calibrate ctx.spectrum via a standard-star observation. easyspec 1.0.1
response_from_standard Derive the instrumental response curve from a standard-star observation. scipy 1.0.1

Continuum

Algorithm What it does Backend Version
compare_normalisations Run every continuum-normalisation method on ctx.spectrum and collect them. numpy 1.0.1
normalize_edges Normalise a spectrum using a continuum fitted only on its line-free edges. numpy 1.0.1
normalize_max Normalise a spectrum by dividing the flux by its maximum value. numpy 1.0.1
normalize_percentile Normalise a spectrum by dividing the flux by a high percentile of itself. numpy 1.0.1
normalize_polynomial Normalise the continuum to unity with a sigma-clipped polynomial fit. numpy 1.1.0
normalize_to_region Divide the flux by its NaN-safe mean over [wave_lo, wave_hi]. numpy 1.0.0
subtract_continuum Subtract a sigma-clipped polynomial continuum, leaving the line residual. numpy 1.0.1

Smoothing

Algorithm What it does Backend Version
compare_smoothings Run every smoothing kernel on ctx.spectrum and collect the results. numpy 1.0.1
smooth_gaussian Smooth a spectrum by convolution with a Gaussian kernel. scipy 1.0.1
smooth_savgol Smooth a spectrum with a Savitzky-Golay filter. scipy 1.0.1

Resampling

Algorithm What it does Backend Version
resample_flux_conserving Resample onto a new wavelength grid while preserving integrated flux. specutils 1.0.1
resample_linear Resample a spectrum onto a uniform wavelength grid by linear interpolation. numpy 1.0.1

Transforms

Algorithm What it does Backend Version
clip_sigma Remove outlier samples (cosmic rays, hot pixels) by iterative sigma clipping. scipy 1.0.1
combine_spectra_arithmetic Add, subtract, multiply or divide ctx.spectrum by a reference. numpy 1.0.1
extract_region Crop a spectrum to the wavelength window [wavelength_min, wavelength_max]. numpy 1.0.0
mask_range Flag every sample inside a wavelength window as masked. numpy 1.0.0

Quality / SNR

Algorithm What it does Backend Version
compare_snr_methods Run every SNR estimator on ctx.spectrum and collect their numbers. numpy 1.0.1
snr_der Derivative-based SNR estimator (DER_SNR, Stoehr et al. 2008). numpy 1.0.0
snr_edge Estimate SNR from the flat, line-free regions at the spectrum's edges. numpy 1.0.1
snr_linear_fit Estimate SNR from the scatter around a linear fit of a continuum region. numpy 1.0.1
validate_bess_header Check a FITS header against the BeSS keyword contract. numpy 1.0.0

Line detection

Algorithm What it does Backend Version
detect_lines Detect emission/absorption peaks, optionally matched to a named catalogue. scipy 1.2.1

Line fitting

Algorithm What it does Backend Version
compare_line_fits Fit one spectral line with every profile in turn and pick the best one. scipy 1.0.0
equivalent_width Measure a line's equivalent width without assuming a profile shape. numpy 1.1.0
fit_gaussian_line Fit a single Gaussian (plus a linear continuum) to one spectral line. scipy 1.1.0
fit_lorentzian_line Fit a single Lorentzian (plus a linear continuum) to one spectral line. scipy 1.0.0
fit_voigt_line Fit a single Voigt profile (plus a linear continuum) to one spectral line. scipy 1.0.0
vr_ratio Violet/Red intensity ratio of a double-peaked emission line. scipy 1.0.1

Corrections

Algorithm What it does Backend Version
air_to_vacuum Convert the wavelength axis from air to vacuum wavelengths. numpy 1.0.1
barycentric_correction Compute the barycentric (or heliocentric) correction and Julian date, and shift the spectrum. astropy 1.1.0
doppler_shift Doppler-shift the wavelength axis by a radial velocity. astropy 1.0.0
extinction_correct_easyspec Apply atmospheric extinction correction to ctx.spectrum via easyspec. easyspec 1.0.1
fit_telluric_scaling Fit the airmass that best matches a telluric template to ctx.spectrum. scipy 1.0.1
remove_telluric_division Remove telluric absorption by dividing the science spectrum by a reference. numpy 1.1.0
synth_telluric Generate a synthetic telluric transmission spectrum. numpy 1.0.1
vacuum_to_air Convert the wavelength axis from vacuum to air wavelengths. numpy 1.0.1

Radial velocity

Algorithm What it does Backend Version
cross_correlate_rv Measure radial velocity by cross-correlation against a template spectrum. scipy 2.1.0
fit_keplerian_orbit Fit a single-companion Keplerian RV curve to a velocity time series. scipy 1.1.0
measure_radial_velocity Measure a radial velocity from the Doppler shift of a single line. scipy 1.1.0
redshift_lines Redshift z by per-line Gaussian fits against a list of rest-frame anchors. scipy 1.0.1
rv_precision_bouchy Compute the fundamental photon-noise limit on RV precision (Bouchy 2001). numpy 1.0.1

Time series

Algorithm What it does Backend Version
lomb_scargle Compute a Lomb-Scargle periodogram and report the dominant period. astropy 1.1.1
phase_fold Phase-fold a light curve on a known period. numpy 1.0.1

Stacking

Algorithm What it does Backend Version
merge_echelle_orders Merge every Spectrum1D in ctx.spectra into a single ctx.spectrum. numpy 1.0.1
stack_spectra Combine every spectrum in ctx.spectra into one stacked spectrum. numpy 2.0.0

Embeddings

Algorithm What it does Backend Version
embed_band_power Embed a spectrum as the integrated flux in N adjacent wavelength bands. numpy 2.0.1
embed_continuum_subtracted Subtract the polynomial continuum, then embed the line residual. scipy 1.0.1
embed_lick_indices Embed a spectrum as the canonical Lick/IDS line-strength indices. numpy 2.0.1
embed_log_lambda Resample to a uniform log-λ grid, then embed. scipy 1.0.1
embed_pretrained Embed a spectrum with a local pre-trained PyTorch model. pytorch 1.0.1
embed_remote Embed a spectrum via a remote HTTPS inference endpoint. httpx 1.0.1
embed_spectrum Compute a fixed-length, L2-normalised embedding of a spectrum. scipy 1.2.1
embed_wavelets Embed a spectrum via a truncated discrete wavelet transform. pywavelets 2.0.1

Nebular diagnostics

Algorithm What it does Backend Version
bpt_line_ratios Measure BPT line ratios + classify a galaxy (HII / Composite / Seyfert / LINER). scipy 1.1.0
oiii_electron_temperature Electron temperature Te (K) from the [O III] (λ4959+λ5007)/λ4363 ratio. scipy 2.0.0
sii_electron_density Electron density n_e (cm⁻³) from the [S II] λ6716/λ6731 ratio. scipy 1.1.0

Kinematics

Algorithm What it does Backend Version
rotation_curve Projected long-slit rotation curve v_los(r) from Hα per slit offset. scipy 2.0.1

Spectral classification

Algorithm What it does Backend Version
classify_template_chi2 Spectral classification by χ² against a Pickles-style template atlas. scipy 1.1.0

External catalogues

Algorithm What it does Backend Version
gaia_query Cone-search the Gaia archive around ICRS coordinates. astroquery 1.0.0
simbad_query Resolve an object name against SIMBAD and store the record in the context. astroquery 1.0.0
vizier_query Look up an object in VizieR — the CDS table service. astroquery 1.0.0

Visualisation

Algorithm What it does Backend Version
plot_3d_surface_plotly Render every spectrum in ctx.spectra as one row of a 3D surface. plotly 1.0.0
plot_animation_plotly Render an animated Plotly figure that plays through ctx.spectra. plotly 1.0.0
plot_dynamic_spectrum Render every spectrum in ctx.spectra as one row of a 2D heatmap. plotly 1.0.0
plot_overlay_plotly Render every spectrum in ctx.spectra overlaid on one Plotly figure. plotly 1.0.0
plot_spectrum_plotly Render ctx.spectrum as a Plotly line figure. plotly 1.0.0

Export

Algorithm What it does Backend Version
export_csv Export ctx.spectrum to a CSV file. numpy 1.0.0
export_fits Export ctx.spectrum to a FITS file. astropy 1.0.0
export_fits_bess Export ctx.spectrum as a BeSS / ARAS-compliant FITS image. astropy 1.0.0
export_hdf5 Export ctx.spectrum to an HDF5 file. numpy 1.0.1
export_votable Export ctx.spectrum to a VOTable file (IVOA exchange format). astropy 1.0.0

Advanced

Algorithm What it does Backend Version
aperture_photometry Differential aperture photometry on ctx.image (photutils). photutils 1.0.0
disentangle_sb2 Separate the spectra of the two components of an SB2 spectroscopic binary. numpy 1.1.0
doppler_tomogram Doppler tomogram of a binary from N phase-resolved spectra. numpy 2.0.0