combine_spectra_arithmetic¶
Add, subtract, multiply or divide ctx.spectrum by a reference.
| Category | Transforms |
| Backend | numpy - implemented here on top of numpy primitives |
| Version | 1.0.1 |
| Reads | ctx.spectrum (a Spectrum1D) |
| Writes | spectrum |
operation ∈ {add, sub, mul, div}. For 'div', samples where |reference| < min_denominator become NaN (clamp on near-zero responses). Pass-through outside the reference domain matches IRAF sarith and prevents wing zero-out.
Parameters¶
| Parameter | Default | Required | Description |
|---|---|---|---|
operation |
'div' |
- | One of 'add', 'sub', 'mul', 'div'. |
min_denominator |
5e-05 |
- | Division samples with |reference| below this become NaN. Ignored for non-div operations. |
reference_path |
None |
- | Path / URL of a FITS reference spectrum (loaded with read_fits). |
reference_key |
'reference_spectrum' |
- | ctx.extras key holding a Spectrum1D reference. |
Use it¶
{
"tool": "combine_spectra_arithmetic",
"arguments": {
"session_id": "<session_id>",
"params": {
"operation": "div",
"min_denominator": 5e-05,
"reference_path": null,
"reference_key": "reference_spectrum"
}
}
}
Every algorithm is an MCP tool of the same name; describe_algorithm returns
this page's metadata as JSON.
References¶
- Tody 1986, Proc. SPIE 627, 733 — IRAF sarith heritage.
- Robitaille et al. 2013, A&A 558, A33 — specutils Spectrum1D arithmetic.
Related algorithms¶
clip_sigma- Remove outlier samples (cosmic rays, hot pixels) by iterative sigma clipping.extract_region- Crop a spectrum to the wavelength window[wavelength_min, wavelength_max].mask_range- Flag every sample inside a wavelength window as masked.