BoxcarExtract

class specreduce.extract.BoxcarExtract(image: ndarray | NDData | Quantity, trace_object: Trace, width: float = 5, disp_axis: int = 1, crossdisp_axis: int = 0, mask_treatment: Literal['apply', 'ignore', 'propagate', 'zero_fill', 'nan_fill', 'apply_mask_only', 'apply_nan_only'] = 'apply')[source]

Bases: SpecreduceOperation

Standard boxcar extraction along a trace.

Example:

trace = FlatTrace(image, trace_pos)
extract = BoxcarExtract(image, trace)
spectrum = extract(width=width)
Parameters:
image

image with 2-D spectral image data

trace_object

trace object

width

width of extraction aperture in pixels

disp_axis

dispersion axis

crossdisp_axis

cross-dispersion axis

mask_treatment

Specifies how to handle masked or non-finite values in the input image. The accepted values are:

  • apply: The image remains unchanged, and any existing mask is combined with a mask derived from non-finite values.

  • ignore: The image remains unchanged, and any existing mask is dropped.

  • propagate: The image remains unchanged, and any masked or non-finite pixel causes the mask to extend across the entire cross-dispersion axis.

  • zero_fill: Pixels that are either masked or non-finite are replaced with 0.0, and the mask is dropped.

  • nan_fill: Pixels that are either masked or non-finite are replaced with nan, and the mask is dropped.

  • apply_mask_only: The image and mask are left unmodified.

  • apply_nan_only: The image is left unmodified, the old mask is dropped, and a new mask is created based on non-finite values.

Returns:
specSpectrum1D

The extracted 1d spectrum expressed in DN and pixel units

Attributes Summary

crossdisp_axis

disp_axis

image

mask_treatment

spectrum

trace_object

width

Methods Summary

__call__([image, trace, width, disp_axis, ...])

Extract the 1D spectrum using the boxcar method.

Attributes Documentation

crossdisp_axis: int = 0
disp_axis: int = 1
image: ndarray | NDData | Quantity = <dataclasses._MISSING_TYPE object>
mask_treatment: Literal['apply', 'ignore', 'propagate', 'zero_fill', 'nan_fill', 'apply_mask_only', 'apply_nan_only'] = 'apply'
spectrum
trace_object: Trace = <dataclasses._MISSING_TYPE object>
width: float = 5

Methods Documentation

__call__(image: ndarray | NDData | Quantity | None = None, trace: Trace | None = None, width: float | None = None, disp_axis: int | None = None, crossdisp_axis: int | None = None) Spectrum[source]

Extract the 1D spectrum using the boxcar method.

Parameters:
image

The image with 2-D spectral image data

trace

The trace object

width

The width of extraction aperture in pixels

disp_axis

The dispersion axis

crossdisp_axis

The cross-dispersion axis

Returns:
spec

The extracted 1d spectrum with flux expressed in the same units as the input image, or u.DN, and pixel units