pypeit.multislit_flexure module
Module for flexure routines
- class pypeit.multislit_flexure.MultiSlitFlexure(s1dfile=None, PYP_SPEC=None, nslits=None, det=None, SN=None, slitid=None, mn_wv=None, fit_slope=None, fit_b=None, fit_los=None, objra=None, objdec=None, maskdef_id=None, rms_arc=None, resid_sky=None, indiv_fit_slope=None, indiv_fit_b=None, indiv_fit_los=None)[source]
Bases:
DataContainerClass to perform multi-detector flexure analysis.
Based on code written by Marla Geha for DEIMOS.
The datamodel attributes are:
Version: 1.1.0
Attribute
Type
Array Type
Description
PYP_SPECstr
PypeIt spectrograph name
SNS/N (ndet, nslits)
detint, numpy.integer
Integer identifiers for the detector or mosaic (ndet, nslits)
fit_bFitted b value(nslits)
fit_losFitted line width(nslits)
fit_slopeFitted slope (nslits)
indiv_fit_bSame as above but for b (nslits)
indiv_fit_losSame as above but for line width (nslits)
indiv_fit_slopeFits to each slit individually (nslits)
is_mscint, numpy.integer
Flag that the “det” is the mosaic ID (ndet, nslits)
maskdef_idMask ID (nslits)
mn_wvMininum wavelength of the slit [Ang] (nslits)
ndetint
Number of detectors per spectrum
nslitsint
Number of slits
objdecObject DEC (nslits)
objraObject RA (nslits)
resid_skyResiduals of flexure model on sky lines (nslits)
rms_arcRMS of fit (ndet, nslits)
s1dfilestr
spec1d filename
slitidSlit ID (nslits)
- datamodel = {'PYP_SPEC': {'descr': 'PypeIt spectrograph name', 'otype': <class 'str'>}, 'SN': {'atype': <class 'numpy.floating'>, 'descr': 'S/N (ndet, nslits)', 'otype': <class 'numpy.ndarray'>}, 'det': {'atype': (<class 'int'>, <class 'numpy.integer'>), 'descr': 'Integer identifiers for the detector or mosaic (ndet, nslits)', 'otype': <class 'numpy.ndarray'>}, 'fit_b': {'atype': <class 'numpy.floating'>, 'descr': 'Fitted b value(nslits)', 'otype': <class 'numpy.ndarray'>}, 'fit_los': {'atype': <class 'numpy.floating'>, 'descr': 'Fitted line width(nslits)', 'otype': <class 'numpy.ndarray'>}, 'fit_slope': {'atype': <class 'numpy.floating'>, 'descr': 'Fitted slope (nslits)', 'otype': <class 'numpy.ndarray'>}, 'indiv_fit_b': {'atype': <class 'numpy.floating'>, 'descr': 'Same as above but for b (nslits)', 'otype': <class 'numpy.ndarray'>}, 'indiv_fit_los': {'atype': <class 'numpy.floating'>, 'descr': 'Same as above but for line width (nslits)', 'otype': <class 'numpy.ndarray'>}, 'indiv_fit_slope': {'atype': <class 'numpy.floating'>, 'descr': 'Fits to each slit individually (nslits)', 'otype': <class 'numpy.ndarray'>}, 'is_msc': {'atype': (<class 'int'>, <class 'numpy.integer'>), 'descr': 'Flag that the "det" is the mosaic ID (ndet, nslits)', 'otype': <class 'numpy.ndarray'>}, 'maskdef_id': {'atype': <class 'numpy.integer'>, 'descr': 'Mask ID (nslits)', 'otype': <class 'numpy.ndarray'>}, 'mn_wv': {'atype': <class 'numpy.floating'>, 'descr': 'Mininum wavelength of the slit [Ang] (nslits)', 'otype': <class 'numpy.ndarray'>}, 'ndet': {'descr': 'Number of detectors per spectrum', 'otype': <class 'int'>}, 'nslits': {'descr': 'Number of slits', 'otype': <class 'int'>}, 'objdec': {'atype': <class 'numpy.floating'>, 'descr': 'Object DEC (nslits)', 'otype': <class 'numpy.ndarray'>}, 'objra': {'atype': <class 'numpy.floating'>, 'descr': 'Object RA (nslits)', 'otype': <class 'numpy.ndarray'>}, 'resid_sky': {'atype': <class 'numpy.floating'>, 'descr': 'Residuals of flexure model on sky lines (nslits)', 'otype': <class 'numpy.ndarray'>}, 'rms_arc': {'atype': <class 'numpy.floating'>, 'descr': 'RMS of fit (ndet, nslits)', 'otype': <class 'numpy.ndarray'>}, 's1dfile': {'descr': 'spec1d filename', 'otype': <class 'str'>}, 'slitid': {'atype': <class 'numpy.floating'>, 'descr': 'Slit ID (nslits)', 'otype': <class 'numpy.ndarray'>}}
Provides the class data model. This is undefined in the abstract class and should be overwritten in the derived classes.
The format of the
datamodelneeded for each implementation of aDataContainerderived class is as follows.The datamodel itself is a class attribute (i.e., it is a member of the class, not just of an instance of the class). The datamodel is a dictionary of dictionaries: Each key of the datamodel dictionary provides the name of a given datamodel element, and the associated item (dictionary) for the datamodel element provides the type and description information for that datamodel element. For each datamodel element, the dictionary item must provide:
otype: This is the type of the object for this datamodel item. E.g., for a float or a numpy.ndarray, you would setotype=floatandotype=np.ndarray, respectively.descr: This provides a text description of the datamodel element. This is used to construct the datamodel tables in the pypeit documentation.
If the object type is a numpy.ndarray, you should also provide the
atypekeyword that sets the type of the data contained within the array. E.g., for a floating point array containing an image, your datamodel could be simply:datamodel = {'image' : dict(otype=np.ndarray, atype=float, descr='My image')}
More advanced examples are given in the top-level module documentation.
Currently,
datamodelcomponents are restricted to haveotypethat aretuple,int,float,numpy.integer,numpy.floating, numpy.ndarray, or astropy.table.Table objects. E.g.,datamodelvalues forotypecannot bedict.
- fit_mask_surfaces()[source]
Fit 2D model to linear flexure models from each slit as a function of RA, DEC.
- init(spectrograph, par)[source]
Initialize this and that about the slits, par, spectrograph e.g. RA, DEC, S/N
- Parameters:
spectrograph (
pypeit.spectrographs.spectrograph.Spectrograph) – The spectrograph instance that sets the instrument used to take the observations. Used to setspectrograph.par (
FlexurePar) – The parameters used for the flexure processing
- internals = ['flex_par', 'spectrograph', 'specobjs', 'sobj_idx', 'sky_table', 'pmodel_m', 'pmodel_b', 'pmodel_l']
A list of strings identifying a set of internal attributes that are not part of the datamodel.
- version = '1.1.0'
Provides the string representation of the class version.
This is currently put to minimal use so far, but will used for I/O verification in the future.
Each derived class should provide a version to guard against data model changes during development.
- pypeit.multislit_flexure.sky_em_residuals(wave, flux, ivar, sky_waves, plot=False, noff=5.0, nfit_min=20)[source]
Calculate residuals and other metrics for a set of input sky emission lines.
- Parameters:
wave (numpy.ndarray) – Wavelengths (in air!)
flux (numpy.ndarray) – Fluxes
ivar (numpy.ndarray) – Inverse variance
sky_waves (numpy.ndarray) – Skyline wavelengths (in air!)
plot (bool, optional) – If true, plot the residuals
noff (int, optional) – Range in Ang to analyze labout emission line. Defaults to 5.
nfit_min (int, optional) – Minimum number of pixels required to do a fit. Defaults to 20.
- Returns:
- tuple of numpy.ndarray – sky line wavelength of good lines, wavelength offset,
error in wavelength offset, sky line width, error in sky line width