pypeit.spectrographs.keck_nires module

Module for Keck/NIRES specific methods.

class pypeit.spectrographs.keck_nires.KeckNIRESSpectrograph[source]

Bases: Spectrograph

Child to handle Keck/NIRES specific code

bpm(filename, det, shape=None, msbias=None)[source]

Generate a default bad-pixel mask.

Even though they are both optional, either the precise shape for the image (shape) or an example file that can be read to get the shape (filename using get_image_shape()) must be provided.

  • filename (str or None) – An example file to use to get the image shape.

  • det (int) – 1-indexed detector number to use when getting the image shape from the example file.

  • shape (tuple, optional) – Processed image shape Required if filename is None Ignored if filename is not None

  • msbias (numpy.ndarray, optional) – Processed bias frame used to identify bad pixels.


An integer array with a masked value set to 1 and an unmasked value set to 0. All values are set to 0.

Return type:


camera = 'NIRES'

Name of the spectrograph camera or arm. This is used by specdb, so use that naming convention

check_frame_type(ftype, fitstbl, exprng=None)[source]

Check for frames of the provided type.


Boolean array with the flags selecting the exposures in fitstbl that are ftype type frames.

Return type:


comment = 'see :doc:`keck_nires`'

A brief comment or description regarding PypeIt usage with this spectrograph.

compound_meta(headarr, meta_key)[source]

Methods to generate metadata requiring interpretation of the header data, instead of simply reading the value of a header card.


Metadata value read from the header(s).

Return type:



Return the metadata keys that define a unique instrument configuration.

This list is used by PypeItMetaData to identify the unique configurations among the list of frames read for a given reduction.


List of keywords of data pulled from file headers and used to constuct the PypeItMetaData object.

Return type:


classmethod default_pypeit_par()[source]

Return the default parameters to use for this instrument.


Parameters required by all of PypeIt methods.

Return type:


ech_fixed_format = True

If an echelle spectrograph, this will be set to a boolean indicating whether it is a fixed format or tiltable echelle.


Automatically assign combination groups and background images by parsing known dither patterns.

This method is used in set_combination_groups(), and directly modifies the comb_id and bkg_id columns in the provided table.

Specifically here for NIRES, since it’s likely to have one set of flat/dark frames for different targets, this method sets calib = “all” for the flat and dark frames and assigns different calib values to the science/standard frames of different targets.

Moreover, this method parses from the header the dither pattern of the science/standard frames in a given calibration group and assigns to each of them a default comb_id and bkg_id. The dither patterns used here are: “ABAB”, “ABBA”, “ABpat”, and “ABC”. Note that the frames in the same dither positions (A positions or B positions) of each “ABAB” or “ABBA” sequence are 2D coadded (without optimal weighting) before the background subtraction, while for the other dither patterns (e.g., “ABpat”), the frames in the same dither positions are not coadded. The comb_id and bkg_id will not assigned if:

  • the dither offset is zero for every frame in the dither sequence

  • the dither pattern recorded in the header is not recognized or set to NONE or MANUAL.


fitstbl (astropy.table.Table) – The table with the metadata for all the frames.


modified fitstbl.

Return type:


get_detector_par(det, hdu=None)[source]

Return metadata for the selected detector.

  • det (int) – 1-indexed detector number. This is not used because NIRES only has one detector!

  • hdu (, optional) – The open fits file with the raw image of interest. If not provided, frame-dependent parameters are set to a default.


Object with the detector metadata.

Return type:


header_name = 'NIRES'

Name of the spectrograph camera or arm from the Header. Usually the INSTRUME card.


Define how metadata are derived from the spectrograph files.

That is, this associates the PypeIt-specific metadata keywords with the instrument-specific header cards using meta.

name = 'keck_nires'

The name of the spectrograph. See Spectrographs for the currently supported spectrographs.

ndet = 1

Number of detectors for this instrument.

property norders

Number of orders for this spectograph. Should only defined for echelle spectrographs, and it is undefined for the base class.

order_platescale(order_vec, binning=None)[source]

Return the platescale for each echelle order.

Note that NIRES has no binning.

  • order_vec (numpy.ndarray) – The vector providing the order numbers.

  • binning (str, optional) – The string defining the spectral and spatial binning. This is always ignored.


An array with the platescale for each order provided by order.

Return type:


property order_spat_pos

Return the expected spatial position of each echelle order.

property orders

Return the order number for each echelle order.


Define the list of keys to be output into a standard PypeIt file.


The list of keywords in the relevant PypeItMetaData instance to print to the PypeIt Reduction File.

Return type:


pypeline = 'Echelle'

String used to select the general pipeline approach for this spectrograph.


Return additional raw header cards to be propagated in downstream output files for configuration identification.

The list of raw data FITS keywords should be those used to populate the configuration_keys() or are used in config_specific_par() for a particular spectrograph, if different from the name of the PypeIt metadata keyword.

This list is used by subheader_for_spec() to include additional FITS keywords in downstream output files.


List of keywords from the raw data files that should be propagated in output files.

Return type:


property spec_min_max

Return the minimum and maximum spectral pixel expected for the spectral range of each order.

supported = True

Flag that PypeIt code base has been sufficiently tested with data from this spectrograph that it is officially supported by the development team.

telescope = Parameter     Value                Default  Type        Callable ---------------------------------------------------------------- name          KECK                 KECK     str         False    longitude     -155.47833333333335  None     int, float  False    latitude      19.828333333333333   None     int, float  False    elevation     4160.000000000756    None     int, float  False    fratio        15                   None     int, float  False    diameter      10                   None     int, float  False    eff_aperture  72.3674              None     int, float  False   

Instance of TelescopePar providing telescope-specific metadata.

url = ''

Reference url