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: DataContainer

A data container holding the arguments for how to perform the manual extraction of a spectrum.

A list of these objects is generated in 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



Array Type





Boxcar radius for hand extractions (optional)




detectors name for hand extraction.



The name of the fits file for a manual extraction




FWHMs for hand extractions




Flags indicating which hand extract is a negative trace




spatial positions to hand extract




spectral positions to hand extract

  • frame (str) – The name of the fits file for a manual extraction

  • spat (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)



A couple of quick checks..


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

  • 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 datamodel needed for each implementation of a DataContainer derived 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 set otype=float and otype=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 atype keyword 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, datamodel components are restricted to have otype that are tuple, int, float, numpy.integer, numpy.floating, numpy.ndarray, or astropy.table.Table objects. E.g., datamodel values for otype cannot be dict.

dict_for_objfind(detname, neg=False)[source]

Repackage into a dict for the extraction code

  • det (str) – Detector name under consideration

  • neg (bool, optional) – If True, return the negative image requests


To be passed into reduce.find_objects()

Return type:

dict or None

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.