pypeit.spectrographs.slitmask module
Module to define the SlitMask class
- class pypeit.spectrographs.slitmask.SlitMask(corners, slitid=None, align=None, science=None, onsky=None, objects=None, posx_pa=None, object_names=None, mask_radec=None)[source]
Bases:
objectGeneric class for a slit mask that holds the slit positions and IDs.
By default no mask bits are set. Only altered if align or science arguments are provided.
- Parameters:
corners (array-like) – A list or numpy.ndarray with the list of coordinates. The object must be 2 or 3 dimensional: 1st axis is the slit, 2nd axis are the 4 corners, 3rd axis is the x and y coordinate for the corner. If two dimensional, class assumes there is only one slit. The size of the last two dimensions must always be 4 and 2, respectively. The input order is expected to be clockwise, starting from the top-right corner; i.e., the order is top-right (high x, low y), bottom-right (low x, low y), bottom-left (low x, high y), top-left (high x, high y). The x coordinates are along the spatial direction and the y coordinates are long the spectral direction. The computed length (difference in x), width (difference in y), and position angle (Cartesian angle) is relative to this assumption.
slitid (
int, array-like, optional) – A list of unique integer IDs for each slit. If None, just a running 0-indexed list is used. Can be a single integer or have shape \((N_{\rm slit},)\).align (
bool, numpy.ndarray, optional) – Indicates slit(s) used for on-sky alignment. Can be a single boolean or have shape \((N_{\rm slit},)\).science (
bool, numpy.ndarray, optional) – Indicates slit(s) include a target of scientific interest. Can be a single boolean or have shape \((N_{\rm slit},)\).onsky (numpy.ndarray, optional) – 1D or 2D array with on-sky metrics for each slit. The shape of the array must be \((5,)\) or \((N_{\rm slit},5)\), and the order along rows must match slit ID order (see slitid). The five metrics per slit are (1-2) right ascension and declination of the slit center, (3-4) the slit length and width in arcseconds, and (5) the position angle of the slit from N through E in degrees.
objects (numpy.ndarray, optional) – List of objects observed as a 1D or 2D array with shape \((9,)\) or \((N_{\rm obj},9)\). The nine elements for each object is the slit id, the object ID, the right ascension and declination of the target, the object name, the object magnitude and band, and the object top and bottom distances from the slit edges. The order of the objects does not have to match that of the slit IDs. Also, there can be slits without objects and slits with multiple objects; however, objects cannot be provided that are not in any slit (i.e., the slit IDs in the first column of this array have to be valid).
- Variables:
corners (numpy.ndarray) – See above.
slitid (numpy.ndarray) – See slitid above.
mask (numpy.ndarray) – Mask bits selecting the type of slit.
onsky (numpy.ndarray) – See above.
objects (numpy.ndarray) – See above.
slitindx (numpy.ndarray) –
The index that maps from the slit data to the object data. For example:
objslitdb = self.onsky[self.slitindx]
provides the onsky slit data for each object with a shape matched to the relevant entry in
self.objects.center (numpy.ndarray) – The geometric center of each slit.
top (numpy.ndarray) – The top coordinate of each slit.
bottom (numpy.ndarray) – The bottom coordinate of each slit.
length (numpy.ndarray) – The slit length.
width (numpy.ndarray) – The slit width.
pa (numpy.ndarray) – The cartesian rotation angle of the slit in degrees.
mask_radec (
tuple, optional) – RA, Dec (deg) of the pointing of the mask (approximate center)posx_pa (
float) – Sky PA that points to positive x (spatial) on the detectornegx_pa (
float) – Sky PA that points to negative x (spatial) on the detectorobject_names (numpy.ndarray) – Object names
- Raises:
ValueError – Raised if the shape of the input corners array is incorrect or if the number of slit IDs does not match the number of slits provided.
- property alignment_slit
Boolean array selecting the alignment slits.
- bitmask = <pypeit.spectrographs.slitmask.SlitMaskBitMask object>
- property nslits
The number of slits.
- property science_slit
Boolean array selecting the slits with science targets.
- class pypeit.spectrographs.slitmask.SlitMaskBitMask[source]
Bases:
BitMaskMask bits used for slit mask design data.
- pypeit.spectrographs.slitmask.correct_slitpa(slitpa, maskpa)[source]
Flip 180 degree the slit PA if the value recorded in the slitmask design is more than +/-90 degree from the slitmask PA.
- Parameters:
slitpa (
floator numpy.ndarray) – position angle of the slits.maskpa – (
float): position angle of the slitmask.
- Returns:
flipped slitpa, if it is more than +/-90 from the maskpa, otherwise unchanged slitpa.
- Return type: