pypeit.images.mosaic module
DataContainer
object to hold mosaic properties.
- class pypeit.images.mosaic.Mosaic(id, detectors, shape, shift, rot, tform, msc_ord)[source]
Bases:
DataContainer
Class to hold mosaic parameters and the details of the detectors used to construct the mosaic.
The datamodel attributes are:
Version: 1.0.1
Attribute
Type
Array Type
Description
binning
str
On-chip binning
detectors
List of objects with detector parameters.
id
int
Mosaic ID number
msc_ord
int
Order of the interpolation used to construct the mosaic.
platescale
float
Detector platescale in arcsec/pixel
rot
float
Raw, hard-coded rotations (counter-clockwise in degrees) for each unbinned detector
shape
tuple
Shape of each processed detector image
shift
float
Raw, hard-coded pixel shifts for each unbinned detector
tform
float
The full transformation matrix for each detector used to construct the mosaic.
- _bundle()[source]
Overload base class bundling so that the mosaic data is collected into an astropy Table with one row for each detector.
- Returns:
List of dictionaries to write to HDUs.
- Return type:
- classmethod _parse(hdu, hdu_prefix=None, **kwargs)[source]
Parse the data from the provided HDU.
See
pypeit.datamodel.DataContainer._parse()
for the argument descriptions.- Parameters:
hdu (astropy.io.fits.HDUList, astropy.io.fits.ImageHDU, astropy.io.fits.BinTableHDU) – The HDU(s) with the data to use for instantiation.
hdu_prefix (
str
, optional) – Only parse HDUs with extension names matched to this prefix. If None,ext
is used. If the latter is also None, all HDUs are parsed. Seehdu_iter_by_ext()
.kwargs (
dict
) – Used to collect extra keywords, but has no affect on code flow.
- datamodel = {'binning': {'descr': 'On-chip binning', 'otype': <class 'str'>}, 'detectors': {'atype': <class 'pypeit.images.detector_container.DetectorContainer'>, 'descr': 'List of objects with detector parameters.', 'otype': <class 'numpy.ndarray'>}, 'id': {'descr': 'Mosaic ID number', 'otype': <class 'int'>}, 'msc_ord': {'descr': 'Order of the interpolation used to construct the mosaic.', 'otype': <class 'int'>}, 'platescale': {'descr': 'Detector platescale in arcsec/pixel', 'otype': <class 'float'>}, 'rot': {'atype': <class 'float'>, 'descr': 'Raw, hard-coded rotations (counter-clockwise in degrees) for each unbinned detector', 'otype': <class 'numpy.ndarray'>}, 'shape': {'descr': 'Shape of each processed detector image', 'otype': <class 'tuple'>}, 'shift': {'atype': <class 'float'>, 'descr': 'Raw, hard-coded pixel shifts for each unbinned detector', 'otype': <class 'numpy.ndarray'>}, 'tform': {'atype': <class 'float'>, 'descr': 'The full transformation matrix for each detector used to construct the mosaic.', '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 aDataContainer
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 setotype=float
andotype=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 haveotype
that aretuple
,int
,float
,numpy.integer
,numpy.floating
, numpy.ndarray, or astropy.table.Table objects. E.g.,datamodel
values forotype
cannot bedict
.
- property det
Return a tuple with the set of detector ids in the mosaic.
- property name
Return a name for the mosaic.
- name_prefix = 'MSC'
Prefix for the name of the mosaic.
- property ndet
Return the number of detectors in the mosaic.
- version = '1.0.1'
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.