pypeit.scattlight module

Implements the objects used to hold slit edge data.

class pypeit.scattlight.ScatteredLight(pypeline=None, detname=None, nspec=None, nspat=None, PYP_SPEC=None, binning=None, pad=0, scattlight_raw=None, scattlight_model=None, scattlight_param=None)[source]

Bases: CalibFrame

Defines a generic class for generating a model of the scattered light.

The datamodel attributes are:

Version: 1.0.0

Attribute

Type

Array Type

Description

PYP_SPEC

str

PypeIt spectrograph name

binning

str

Binning in PypeIt orientation (not the original)

detname

str

Identifier for detector or mosaic

nspat

int

Number of pixels in the image spatial direction.

nspec

int

Number of pixels in the image spectral direction.

pad

int

Integer number of pixels to mask beyond the slit edges

pypeline

str

PypeIt pypeline name

scattlight_model

numpy.ndarray

numpy.floating

Model of the scattered light in scattlight_raw

scattlight_param

numpy.ndarray

numpy.floating

Model parameters that define the scattered light model

scattlight_raw

numpy.ndarray

numpy.floating

Image used to construct the edge traces; see ScatteredLightImage and PypeItImage.

_validate()[source]

Validate the slit traces.

calib_file_format = 'fits.gz'

File format for the calibration frame file.

calib_type = 'ScatteredLight'

Name for type of calibration frame.

datamodel = {'PYP_SPEC': {'descr': 'PypeIt spectrograph name', 'otype': <class 'str'>}, 'binning': {'descr': 'Binning in PypeIt orientation (not the original)', 'otype': <class 'str'>}, 'detname': {'descr': 'Identifier for detector or mosaic', 'otype': <class 'str'>}, 'nspat': {'descr': 'Number of pixels in the image spatial direction.', 'otype': <class 'int'>}, 'nspec': {'descr': 'Number of pixels in the image spectral direction.', 'otype': <class 'int'>}, 'pad': {'descr': 'Integer number of pixels to mask beyond the slit edges', 'otype': <class 'int'>}, 'pypeline': {'descr': 'PypeIt pypeline name', 'otype': <class 'str'>}, 'scattlight_model': {'atype': <class 'numpy.floating'>, 'descr': 'Model of the scattered light in scattlight_raw', 'otype': <class 'numpy.ndarray'>}, 'scattlight_param': {'atype': <class 'numpy.floating'>, 'descr': 'Model parameters that define the scattered light model', 'otype': <class 'numpy.ndarray'>}, 'scattlight_raw': {'atype': <class 'numpy.floating'>, 'descr': 'Image used to construct the edge traces; see :class:`~pypeit.images.buildimage.ScatteredLightImage` and :class:`~pypeit.images.pypeitimage.PypeItImage`.', 'otype': <class 'numpy.ndarray'>}}

Provides the class data model.

get_model(image)[source]

Generate a model of the scattered light, based on an input image. This routine requires that the scattered light has already been predefined.

Parameters:

image (numpy.ndarray) – A 2D image that you want to determine the amount of scattered light

Returns:

model – A model of the expected scattered light in the input image. Shape is (nspec, nspat).

Return type:

numpy.ndarray

internals = ['calib_id', 'calib_key', 'calib_dir']

Attributes kept separate from the datamodel.

show(image=None, slits=None, mask=False, wcs_match=True)[source]

Display the master scattered light frame, the model, and data-model.

Parameters:
  • image (numpy.ndarray, optional) – A 2D image that you want to display (including a scattered light model). If None, the master Scattered Light frame wil be displayed by default

  • slits (SlitTraceSet, optional) – The current slit traces

  • mask (bool) – If True, the slits will be masked to show only the scattered light regions

  • wcs_match (bool, optional) – Use a reference image for the WCS and match all image in other channels to it.

version = '1.0.0'

Scattered Light data model version.