Skip to content

normalize_percentile

Normalise a spectrum by dividing the flux by a high percentile of itself.

Category Continuum
Backend numpy - implemented here on top of numpy primitives
Version 3.0.0
Reads ctx.spectrum (a Spectrum1D)
Writes spectrum, metrics.continuum_level

out = flux / nanpercentile(flux, percentile). v2.0.0 — uncertainty (rule in place since 1.0.0, now documented ; no numerical change) : σ_out = σ_in / |continuum_level| — the percentile level is treated as a noise-free scale factor. v3.0.0: masked samples (Spectrum1D.mask) are ignored by the percentile ; the output keeps their flux, divided like every other sample, and carries the mask through.

Parameters

Parameter Default Required Description
percentile 95.0 - Flux percentile (0-100) taken as the continuum level.

Use it

from spectro_kernel import run_algorithm

output = run_algorithm("normalize_percentile", ctx, {
    "percentile": 95.0
})
spectro run normalize_percentile --input spectrum.fits \
  --param percentile=95.0
{
  "tool": "normalize_percentile",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "percentile": 95.0
    }
  }
}

Every algorithm is an MCP tool of the same name; describe_algorithm returns this page's metadata as JSON.

References

  • Gray 2005, The Observation and Analysis of Stellar Photospheres, 3rd ed., Cambridge UP — ch. 12, continuum placement through the highest flux points of an absorption-line spectrum.
  • Tody 1986, Proc. SPIE 627, 733 — the IRAF data reduction and analysis system (reference implementation of spectrum normalisation tasks).
  • compare_normalisations - Run every continuum-normalisation method on ctx.spectrum and collect them.
  • normalize_edges - Normalise a spectrum using a continuum fitted only on its line-free edges.
  • normalize_max - Normalise a spectrum by dividing the flux by its maximum value.
  • normalize_polynomial - Normalise the continuum to unity with a sigma-clipped polynomial fit.
  • normalize_spline - Normalise the continuum with an IRAF-style iteratively clipped cubic spline.
  • normalize_to_region - Divide the flux by its NaN-safe mean over [wave_lo, wave_hi].
  • subtract_continuum - Subtract a sigma-clipped polynomial continuum, leaving the line residual.