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:
- image
NDData
-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_object
Trace
, 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_prof
Model
, optional A model for the image’s background flux. [default: models.Polynomial1D(2)]
- variance
ndarray
, optional (Only used if
image
is not an NDData object.) The associated variances for each pixel in the image. Must have the same dimensions asimage
. 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]- mask
ndarray
, optional (Only used if
image
is not an NDData object.) Whether to mask each pixel in the image. Must have the same dimensions asimage
. If blank, all non-NaN pixels are unmasked. [default: None]- unit
Unit
or str, optional (Only used if
image
is not an NDData object.) The associated unit for the data inimage
. If blank, fluxes are interpreted in DN. [default: None]
- image
Attributes Summary
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.)>¶
- spectrum¶
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:
- image
NDData
-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_object
Trace
, 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_prof
Model
, optional A model for the image’s background flux.
- variance
ndarray
, optional (Only used if
image
is not an NDData object.) The associated variances for each pixel in the image. Must have the same dimensions asimage
. 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.- mask
ndarray
, optional (Only used if
image
is not an NDData object.) Whether to mask each pixel in the image. Must have the same dimensions asimage
. If blank, all non-NaN pixels are unmasked.- unit
Unit
or str, optional (Only used if
image
is not an NDData object.) The associated unit for the data inimage
. If blank, fluxes are interpreted in DN.
- image
- Returns:
- spec_1d
Spectrum1D
The final, Horne extracted 1D spectrum.
- spec_1d