extract_region

specutils.manipulation.extract_region(spectrum, region)[source]

Extract a region from the input Spectrum1D defined by the lower and upper bounds defined by this SpectralRegion instance. The extracted region will be returned.

Parameters:

spectrum: `~specutils.spectra.spectrum1d.Spectrum1D`

The spectrum object from which the region will be extracted.

Returns:

spectrum: Spectrum1D

Excised spectrum.

Notes

The region extracted is a discrete subset of the input spectrum. No interpolation is done on the left and right side of the spectrum.

The region is assumed to be a closed interval (as opposed to Python which is open on the upper end). For example:

Given:

A spectrum with spectral_axis of [0.1, 0.2, 0.3, 0.4, 0.5, 0.6]*u.um.

A region defined as SpectralRegion(0.2*u.um, 0.5*u.um)

And we calculate sub_spectrum = extract_region(spectrum, region), then the sub_spectrum spectral axis will be [0.2, 0.3, 0.4, 0.5] * u.um.