pypeit.manual_extract module
Implements an object to handle manual object extraction.
- class pypeit.manual_extract.ManualExtractionObj(frame=None, spat=None, spec=None, detname=None, fwhm=None, neg=None, boxcar_rad=None)[source]
Bases:
DataContainerA data container holding the arguments for how to perform the manual extraction of a spectrum.
A list of these objects is generated in pypeit.py to perform a set of user-defined extractions.
For an example of how to define a series of manual extractions in the pypeit input file, see PypeIt Reduction File.
The datamodel attributes are:
Version: 1.1.0
Attribute
Type
Array Type
Description
boxcar_radBoxcar radius for hand extractions (optional)
detnamestr
detectors name for hand extraction.
framestr
The name of the fits file for a manual extraction
fwhmFWHMs for hand extractions
negFlags indicating which hand extract is a negative trace
spatspatial positions to hand extract
specspectral positions to hand extract
- Parameters:
frame (
str) – The name of the fits file for a manual extractionspat (numpy.ndarray) – Array of spatial positions to hand extract
spec (numpy.ndarray) – Array of spectral positions to hand extract
det (numpy.ndarray) – Array of detectors for hand extraction. This must be a aligned with spec and spat . The values can be negative (for negative images)
fwhm (numpy.ndarray) – Array of FWHM for hand extraction. This must be aligned with spec and spat.
boxcar_rad (numpy.ndarray, optional) – Array of boxcar_radii for hand extraction. This must be aligned with spec and spat. It is to be in pixels, not arcsec. This is only intended for multi-slit reductions (not Echelle)
- _validate()[source]
Validate
A couple of quick checks..
- Raises:
ValueError – Raised if one of the arrays is not set or if they don’t have the same length
- classmethod by_fitstbl_input(frame: str, inp: str, spectrograph)[source]
Generate the object from an entry in the fitstbl
- Parameters:
frame (str) – filename
inp (str) – String specifying the manual aperture:
det:spat:spec:fwhm; e.g.,1:1181.8:3820.6:3.spectrograph (
pypeit.spectrographs.spectrograph.Spectrograph) – The Spectrograph instance that sets the instrument used to take the observations. Used to set check that the input value of the mosaic detectors are allowed for this spectrograph
- Return type:
- datamodel = {'boxcar_rad': {'atype': <class 'numpy.floating'>, 'descr': 'Boxcar radius for hand extractions (optional)', 'otype': <class 'numpy.ndarray'>}, 'detname': {'atype': <class 'str'>, 'descr': 'detectors name for hand extraction.', 'otype': <class 'numpy.ndarray'>}, 'frame': {'descr': 'The name of the fits file for a manual extraction', 'otype': <class 'str'>}, 'fwhm': {'atype': <class 'numpy.floating'>, 'descr': 'FWHMs for hand extractions', 'otype': <class 'numpy.ndarray'>}, 'neg': {'atype': <class 'numpy.bool'>, 'descr': 'Flags indicating which hand extract is a negative trace', 'otype': <class 'numpy.ndarray'>}, 'spat': {'atype': <class 'numpy.floating'>, 'descr': 'spatial positions to hand extract', 'otype': <class 'numpy.ndarray'>}, 'spec': {'atype': <class 'numpy.floating'>, 'descr': 'spectral positions to hand extract', '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.
- 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.