pypeit.spectrographs.keck_hires module

Module for Keck/HIRES

class pypeit.spectrographs.keck_hires.HIRESMosaicLookUp[source]

Bases: object

Provides the geometry required to mosaic Keck HIRES data. Similar to GeminiGMOSMosaicLookUp

geometry = {'MSC01': {'blue_det': {'rotation': 0.0, 'shift': (-2089.0, -3.0)}, 'default_shape': (6168, 3990), 'green_det': {'rotation': 0.0, 'shift': (0.0, 0.0)}, 'red_det': {'rotation': 0.0, 'shift': (2101.0, 0.0)}}}
class pypeit.spectrographs.keck_hires.KECKHIRESSpectrograph[source]

Bases: Spectrograph

Child to handle KECK/HIRES specific code.

This spectrograph is not yet supported.

property allowed_mosaics

Return the list of allowed detector mosaics.

Keck/HIRES only allows for mosaicing all three detectors.


List of tuples, where each tuple provides the 1-indexed detector numbers that can be combined into a mosaic and processed by PypeIt.

Return type:


camera = 'HIRES'

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:


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:


config_specific_par(scifile, inp_par=None)[source]

Modify the PypeIt parameters to hard-wired values used for specific instrument configurations.

  • scifile (str) – File to use when determining the configuration and how to adjust the input parameters.

  • inp_par (ParSet, optional) – Parameter set used for the full run of PypeIt. If None, use default_pypeit_par().


The PypeIt parameter set adjusted for configuration specific parameter values.

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:


property default_mosaic

Return the default detector mosaic.

For instruments with no allowed detector mosaics, this must be returned as None.

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 = False

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

get_detector_par(det, hdu=None)[source]

Return metadata for the selected detector.

  • det (int) – 1-indexed detector number.

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



Pass back the files required to run the echelle method of wavecalib


List of files

Return type:


get_mosaic_par(mosaic, hdu=None, msc_order=0)[source]

Return the hard-coded parameters needed to construct detector mosaics from unbinned images.

The parameters expect the images to be trimmed and oriented to follow the PypeIt shape convention of (nspec,nspat). For returned lists, the length of the list is the same as the number of detectors in the mosaic, and they are ordered by the detector number.

  • mosaic (tuple) – Tuple of detector numbers used to construct the mosaic. Must be one among the list of possible mosaics as hard-coded by the allowed_mosaics() function.

  • hdu (, optional) – The open fits file with the raw image of interest. If not provided, frame-dependent detector parameters are set to a default. BEWARE: If hdu is not provided, the binning is assumed to be 1,1, which will cause faults if applied to binned images!

  • msc_order (int, optional) – Order of the interpolation used to construct the mosaic.


Object with the mosaic and detector parameters.

Return type:


get_rawimage(raw_file, det, spectrim=20)[source]

Read raw images and generate a few other bits and pieces that are key for image processing.

Based on

  • raw_file (str) – File to read

  • det (int) – 1-indexed detector to read


  • detector_par (pypeit.images.detector_container.DetectorContainer) – Detector metadata parameters.

  • raw_img (numpy.ndarray) – Raw image for this detector.

  • hdu ( – Opened fits file

  • exptime (float) – Exposure time read from the file header

  • rawdatasec_img (numpy.ndarray) – Data (Science) section of the detector as provided by setting the (1-indexed) number of the amplifier used to read each detector pixel. Pixels unassociated with any amplifier are set to 0.

  • oscansec_img (numpy.ndarray) – Overscan section of the detector as provided by setting the (1-indexed) number of the amplifier used to read each detector pixel. Pixels unassociated with any amplifier are set to 0.

header_name = 'HIRES'

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_hires'

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

ndet = 3

Number of detectors for this instrument.

order_platescale(order_vec, binning=None)[source]

Return the platescale for each echelle order.

This routine is only defined for echelle spectrographs, and it is undefined in the base class.

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

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


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

Return type:



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:


supported = False

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

pypeit.spectrographs.keck_hires.hires_read_1chip(hdu, chipno)[source]

Read one of the HIRES detectors

  • hdu (HDUList) –

  • chipno (int) –


  • data (ndarray)

  • oscan (ndarray)

pypeit.spectrographs.keck_hires.indexing(itt, postpix, det=None, xbin=1, ybin=1)[source]

Some annoying book-keeping for instrument placement.

  • itt (int) –

  • postpix (int) –

  • det (int, optional) –