pypeit.spectrographs.keck_lris module

Module for LRIS specific methods.

class pypeit.spectrographs.keck_lris.KeckLRISBOrigSpectrograph[source]

Bases: KeckLRISBSpectrograph

Child to handle the LRISb detector packed prior to 01 JUL 2009

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.

Parameters:
  • 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. This is always ignored.

Returns:

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:

numpy.ndarray

camera = 'LRISb'

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

comment = 'Blue camera; Original FITS file format; used until April 2009; see :doc:`lris`'

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

get_detector_par(det, hdu=None)[source]

Return metadata for the selected detector.

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

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

Returns:

Object with the detector metadata.

Return type:

DetectorContainer

get_rawimage(raw_file, det)[source]

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

Over-ride standard get_rawimage() for LRISb to deal with the original approach

Parameters:
  • raw_file (str) – File to read

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

Returns:

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

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

  • hdu (astropy.io.fits.HDUList) – 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.

name = 'keck_lris_blue_orig'

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

ndet = 2

Number of detectors for this instrument.

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.

class pypeit.spectrographs.keck_lris.KeckLRISBSpectrograph[source]

Bases: KeckLRISSpectrograph

Child to handle Keck/LRISb 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.

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

Returns:

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:

numpy.ndarray

camera = 'LRISb'

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

check_spectrograph(filename)[source]

Check that the selected spectrograph is the correct one for the input data.

Parameters:

filename (str) – File to use when determining if the input spectrograph is the correct one.

comment = 'Blue camera; Current FITS file format; used from May 2009, see :doc:`lris`'

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

config_specific_par(scifile, inp_par=None)[source]

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

Parameters:
  • 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().

Returns:

The PypeIt parameter set adjusted for configuration specific parameter values.

Return type:

ParSet

classmethod default_pypeit_par()[source]

Return the default parameters to use for this instrument.

Returns:

Parameters required by all of PypeIt methods.

Return type:

PypeItPar

get_detector_par(det, hdu=None)[source]

Return metadata for the selected detector.

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

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

Returns:

Object with the detector metadata.

Return type:

DetectorContainer

header_name = 'LRISBLUE'

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

init_meta()[source]

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

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

raw_header_cards()[source]

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.

Returns:

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

Return type:

list

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.

class pypeit.spectrographs.keck_lris.KeckLRISRMark4Spectrograph[source]

Bases: KeckLRISRSpectrograph

Child to handle the new Mark4 detector

comment = 'Red camera; New Mark4 detector, in operation since May 2021; see :doc:`lris`'

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

get_detector_par(det, hdu=None)[source]

Return metadata for the selected detector.

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

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

Returns:

Object with the detector metadata.

Return type:

DetectorContainer

get_rawimage(raw_file, det)[source]

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

Over-ride standard get_rawimage() for LRIS

Parameters:
  • raw_file (str) – File to read

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

Returns:

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

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

  • hdu (astropy.io.fits.HDUList) – 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.

init_meta()[source]

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

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

ndet = 1

Number of detectors for this instrument.

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.

class pypeit.spectrographs.keck_lris.KeckLRISROrigSpectrograph[source]

Bases: KeckLRISRSpectrograph

Child to handle the original LRISr detector (up to 2009-05-02)

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.

Parameters:
  • 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. This is always ignored.

Returns:

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:

numpy.ndarray

camera = 'LRISr'

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

comment = 'Red camera; Original FITS file format; used until April 2009; see :doc:`lris`'

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

config_specific_par(scifile, inp_par=None)[source]

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

Parameters:
  • 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().

Returns:

The PypeIt parameter set adjusted for configuration specific parameter values.

Return type:

ParSet

classmethod default_pypeit_par()[source]

Return the default parameters to use for this instrument.

Returns:

Parameters required by all of PypeIt methods.

Return type:

PypeItPar

get_detector_par(det, hdu=None)[source]

Return metadata for the selected detector.

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

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

Returns:

Object with the detector metadata.

Return type:

DetectorContainer

get_rawimage(raw_file, det)[source]

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

Over-ride standard get_rawimage() for LRIS

Parameters:
  • raw_file (str) – File to read

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

Returns:

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

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

  • hdu (astropy.io.fits.HDUList) – 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.

name = 'keck_lris_red_orig'

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

ndet = 1

Number of detectors for this instrument.

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.

class pypeit.spectrographs.keck_lris.KeckLRISRSpectrograph[source]

Bases: KeckLRISSpectrograph

Child to handle Keck/LRISr 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.

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

Returns:

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:

numpy.ndarray

camera = 'LRISr'

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

check_spectrograph(filename)[source]

Check that the selected spectrograph is the correct one for the input data.

Parameters:

filename (str) – File to use when determining if the input spectrograph is the correct one.

comment = 'Red camera; Current FITS file format; LBNL detector, 2kx4k; used from May 2009, see :doc:`lris`'

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

config_specific_par(scifile, inp_par=None)[source]

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

Parameters:
  • 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().

Returns:

The PypeIt parameter set adjusted for configuration specific parameter values.

Return type:

ParSet

configuration_keys()[source]

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.

Returns:

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

Return type:

list

classmethod default_pypeit_par()[source]

Return the default parameters to use for this instrument.

Returns:

Parameters required by all of PypeIt methods.

Return type:

PypeItPar

get_detector_par(det, hdu=None)[source]

Return metadata for the selected detector.

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

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

Returns:

Object with the detector metadata.

Return type:

DetectorContainer

get_ql_calib_dir(file)[source]

Returns calibration file directory for quicklook reductions.

Parameters:

file (str) – Image file

Returns:

Quicklook calibrations directory

Return type:

str

header_name = 'LRIS'

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

init_meta()[source]

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

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

ql_supported = True

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

raw_header_cards()[source]

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.

Returns:

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

Return type:

list

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.

class pypeit.spectrographs.keck_lris.KeckLRISSpectrograph[source]

Bases: Spectrograph

Child to handle Keck/LRIS specific code

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

Check for frames of the provided type.

Parameters:
Returns:

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

Return type:

numpy.ndarray

check_spectrograph(filename)[source]

Check that the selected spectrograph is the correct one for the input data.

Parameters:

filename (str) – File to use when determining if the input spectrograph is the correct one.

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.

Parameters:
Returns:

Metadata value read from the header(s).

Return type:

object

config_independent_frames()[source]

Define frame types that are independent of the fully defined instrument configuration.

Bias and dark frames are considered independent of a configuration, but the DATE-OBS keyword is used to assign each to the most-relevant configuration frame group. See set_configurations().

Returns:

Dictionary where the keys are the frame types that are configuration independent and the values are the metadata keywords that can be used to assign the frames to a configuration group.

Return type:

dict

config_specific_par(scifile, inp_par=None)[source]

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

Parameters:
  • 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().

Returns:

The PypeIt parameter set adjusted for configuration specific parameter values.

Return type:

ParSet

configuration_keys()[source]

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.

Returns:

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

Return type:

list

classmethod default_pypeit_par()[source]

Return the default parameters to use for this instrument.

Returns:

Parameters required by all of PypeIt methods.

Return type:

PypeItPar

get_lamps(fitstbl)[source]

Extract the list of arc lamps used from header

Parameters:

fitstbl (astropy.table.Table) – The table with the metadata for one or more arc frames.

Returns:

List used arc lamps

Return type:

lamps (list)

get_maskdef_slitedges(ccdnum=None, filename=None, debug=None, trc_path=None, binning=None)[source]

Provides the slit edges positions predicted by the slitmask design using the mask coordinates already converted from mm to pixels by the method mask_to_pixel_coordinates.

If not already instantiated, the slitmask, amap, and bmap attributes are instantiated. If so, a file must be provided.

Parameters:
  • ccdnum (int) – Detector number

  • filename (str) – The filename to use to (re)instantiate the slitmask and grating. Default is None, i.e., to use previously instantiated attributes.

  • debug (bool, optional) – Run in debug mode.

Returns:

Three numpy.ndarray and a SlitMask. Two arrays are the predictions of the slit edges from the slitmask design and one contains the indices to order the slits from left to right in the PypeIt orientation

Return type:

tuple

get_rawimage(raw_file, det)[source]

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

Based on readmhdufits.pro

Parameters:
  • raw_file (str) – File to read

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

Returns:

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

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

  • hdu (astropy.io.fits.HDUList) – 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.

get_slitmask(filename: str)[source]

Parse the slitmask data from a LRIS file into slitmask, a SlitMask object.

Parameters:

filename (str) – Name of the file to read.

Returns:

The slitmask data read from the file. The returned object is the same as slitmask.

Return type:

SlitMask

init_meta()[source]

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.

lamps(fitstbl, status)[source]

Check the lamp status.

Parameters:
  • fitstbl (astropy.table.Table) – The table with the fits header meta data.

  • status (str) – The status to check. Can be 'off', 'arcs', or 'dome'.

Returns:

A boolean array selecting fits files that meet the selected lamp status.

Return type:

numpy.ndarray

Raises:

ValueError – Raised if the status is not one of the valid options.

ndet = 2

Number of detectors for this instrument.

pypeit_file_keys()[source]

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

Returns:

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

Return type:

list

subheader_for_spec(row_fitstbl, raw_header, extra_header_cards=None, allow_missing=False)[source]

Generate a dict that will be added to the Header of spectra files generated by PypeIt (e.g. SpecObjs).

Parameters:
  • row_fitstbl (dict-like) – Typically an astropy.table.Row or astropy.io.fits.Header with keys defined by define_core_meta().

  • raw_header (astropy.io.fits.Header) – Header that defines the instrument and detector, meaning that the header must contain the INSTRUME, DETECTOR, GRANAME, GRISNAME, and SLITNAME header cards. If provided, this must also contain the header cards provided by extra_header_cards.

  • extra_header_cards (list, optional) – Additional header cards from raw_header to include in the output dictionary. Can be an empty list or None.

  • allow_missing (bool, optional) – Ignore any keywords returned by define_core_meta() are not present in row_fitstbl. Otherwise, raise PypeItError.

Returns:

Dictionary with data to include an output fits header file or table downstream.

Return type:

dict

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 = 'https://www2.keck.hawaii.edu/inst/lris/'

Reference url

pypeit.spectrographs.keck_lris.convert_lowredux_pixelflat(infil, outfil)[source]

Convert LowRedux pixelflat to PYPIT format

pypeit.spectrographs.keck_lris.get_orig_rawimage(raw_file, debug=False)[source]

Read a raw, original LRIS data frame.

Ported from LOWREDUX long_oscan.pro lris_oscan()

Parameters:
  • raw_file (str) – Filename

  • debug (bool, optional) – Run in debug mode (doesn’t do anything)

Returns:

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

  • hdu (astropy.io.fits.HDUList) – 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.

pypeit.spectrographs.keck_lris.lris_read_amp(inp, ext)[source]

Read one amplifier of an LRIS multi-extension FITS image

Parameters:
  • inp (str, astropy.io.fits.HDUList) – filename or HDUList

  • ext (int) – Extension index

Returns:

data predata postdata x1 y1

Return type:

tuple