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

Generic 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).

corners

See above.

Type:

numpy.ndarray

slitid

See slitid above.

Type:

numpy.ndarray

mask

Mask bits selecting the type of slit.

Type:

numpy.ndarray

onsky

See above.

Type:

numpy.ndarray

objects

See above.

Type:

numpy.ndarray

slitindx

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.

Type:

numpy.ndarray

center

The geometric center of each slit.

Type:

numpy.ndarray

top

The top coordinate of each slit.

Type:

numpy.ndarray

bottom

The bottom coordinate of each slit.

Type:

numpy.ndarray

length

The slit length.

Type:

numpy.ndarray

width

The slit width.

Type:

numpy.ndarray

pa

The cartesian rotation angle of the slit in degrees.

Type:

numpy.ndarray

mask_radec

RA, Dec (deg) of the pointing of the mask (approximate center)

Type:

tuple, optional

posx_pa

Sky PA that points to positive x (spatial) on the detector

Type:

float

negx_pa

Sky PA that points to negative x (spatial) on the detector

Type:

float

object_names

Object names

Type:

numpy.ndarray

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>
is_alignment(i)[source]

Check if specific slit is an alignment slit.

is_science(i)[source]

Check if specific slit should have a science target.

property nslits

The number of slits.

property science_slit

Boolean array selecting the slits with science targets.

class pypeit.spectrographs.slitmask.SlitMaskBitMask[source]

Bases: BitMask

Mask 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 (float or 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:

float or numpy.ndarray

pypeit.spectrographs.slitmask.load_keck_deimoslris(filename, instr)[source]

Load up the mask design info from the header of the file provided

Parameters:
  • filename (str)

  • instr (str) – Name of spectrograph Allowed are keck_lris_xxx, keck_deimos

Returns:

[description]

Return type:

[type]

pypeit.spectrographs.slitmask.positive_pa(pa)[source]

Modify input pa to be positive (0-360)

Parameters:

pa (float) – [description]

Returns:

[description]

Return type:

[type]