HorneExtract

class specreduce.extract.HorneExtract(image: ~astropy.nddata.nddata.NDData, trace_object: ~specreduce.tracing.Trace, bkgrd_prof: ~astropy.modeling.core.Model = <Polynomial1D(2, c0=0., c1=0., c2=0.)>, variance: ~typing.Optional[~numpy.ndarray] = None, mask: ~typing.Optional[~numpy.ndarray] = None, unit: ~typing.Optional[~numpy.ndarray] = None, disp_axis: int = 1, crossdisp_axis: int = 0)[source]

Bases: SpecreduceOperation

Perform a Horne (a.k.a. optimal) extraction on a two-dimensional spectrum.

Parameters:
imageNDData-like or array-like, required

The input 2D spectrum from which to extract a source. An NDData object must specify uncertainty and a mask. An array requires use of the variance, mask, & unit arguments.

trace_objectTrace, required

The associated 1D trace object created for the 2D image.

disp_axisint, optional

The index of the image’s dispersion axis. [default: 1]

crossdisp_axisint, optional

The index of the image’s cross-dispersion axis. [default: 0]

bkgrd_profModel, optional

A model for the image’s background flux. [default: models.Polynomial1D(2)]

variancendarray, optional

(Only used if image is not an NDData object.) The associated variances for each pixel in the image. Must have the same dimensions as image. If all zeros, the variance will be ignored and treated as all ones. If any zeros, those elements will be excluded via masking. If any negative values, an error will be raised. [default: None]

maskndarray, optional

(Only used if image is not an NDData object.) Whether to mask each pixel in the image. Must have the same dimensions as image. If blank, all non-NaN pixels are unmasked. [default: None]

unitUnit or str, optional

(Only used if image is not an NDData object.) The associated unit for the data in image. If blank, fluxes are interpreted in DN. [default: None]

Attributes Summary

bkgrd_prof

crossdisp_axis

disp_axis

mask

spectrum

unit

variance

Methods Summary

__call__([image, trace_object, disp_axis, ...])

Run the Horne calculation on a region of an image and extract a 1D spectrum.

Attributes Documentation

bkgrd_prof: astropy.modeling.Model = <Polynomial1D(2, c0=0., c1=0., c2=0.)>
crossdisp_axis: int = 0
disp_axis: int = 1
mask: ndarray = None
spectrum
unit: ndarray = None
variance: ndarray = None

Methods Documentation

__call__(image=None, trace_object=None, disp_axis=None, crossdisp_axis=None, bkgrd_prof=None, variance=None, mask=None, unit=None)[source]

Run the Horne calculation on a region of an image and extract a 1D spectrum.

Parameters:
imageNDData-like or array-like, required

The input 2D spectrum from which to extract a source. An NDData object must specify uncertainty and a mask. An array requires use of the variance, mask, & unit arguments.

trace_objectTrace, required

The associated 1D trace object created for the 2D image.

disp_axisint, optional

The index of the image’s dispersion axis.

crossdisp_axisint, optional

The index of the image’s cross-dispersion axis.

bkgrd_profModel, optional

A model for the image’s background flux.

variancendarray, optional

(Only used if image is not an NDData object.) The associated variances for each pixel in the image. Must have the same dimensions as image. If all zeros, the variance will be ignored and treated as all ones. If any zeros, those elements will be excluded via masking. If any negative values, an error will be raised.

maskndarray, optional

(Only used if image is not an NDData object.) Whether to mask each pixel in the image. Must have the same dimensions as image. If blank, all non-NaN pixels are unmasked.

unitUnit or str, optional

(Only used if image is not an NDData object.) The associated unit for the data in image. If blank, fluxes are interpreted in DN.

Returns:
spec_1dSpectrum1D

The final, Horne extracted 1D spectrum.