pypeit.spectrographs.gemini_gmos module

Module for Gemini GMOS specific methods.

class pypeit.spectrographs.gemini_gmos.GeminiGMOSMosaicLookUp[source]

Bases: object

Provides the geometry required to mosaic Gemini GMOS data.

This is purposely a direct copy of the data provided by v3.0.0 of the Gemini DRAGONS software package. Specifically, if you have DRAGONS installed, pypeit.spectrographs.gemini_gmos.GeminiGMOSMosaicLookUp.geometry should be identical to:

from geminidr.gmos.lookups.geometry_conf import geometry

Updating to any changes made to the DRAGONS version requires by-hand editing of the PypeIt code.

geometry = {'BI11-41-4k-2,BI13-19-4k-3,BI12-34-4k-1': {'default_shape': (2048, 4224), (0, 0): {'rotation': 0.0, 'shift': (-2112.5, -1.1)}, (2048, 0): {}, (4096, 0): {'rotation': 0.0, 'shift': (2110.8, 1.05)}}, 'BI13-20-4k-1,BI12-09-4k-2,BI13-18-4k-2': {'default_shape': (2048, 4224), (0, 0): {'rotation': -0.004, 'shift': (-2115.95, -0.21739)}, (2048, 0): {}, (4096, 0): {'rotation': -0.00537, 'shift': (2115.48, 0.1727)}}, 'BI5-36-4k-2,BI11-33-4k-1,BI12-34-4k-1': {'default_shape': (2048, 4224), (0, 0): {'rotation': 0.0, 'shift': (-2110.2, 0.71)}, (2048, 0): {}, (4096, 0): {'rotation': 0.0, 'shift': (2109.0, -0.73)}}, 'EEV2037-06-03EEV8194-19-04EEV8261-07-04': {'default_shape': (2048, 4608), (0, 0): {'rotation': 0.011, 'shift': (-2086.49, -0.22)}, (2048, 0): {}, (4096, 0): {'rotation': 0.012, 'shift': (2089.31, 2.04)}}, 'EEV8056-20-03EEV8194-19-04EEV8261-07-04': {'default_shape': (2048, 4608), (0, 0): {'rotation': -0.01, 'shift': (-2086.44, 5.46)}, (2048, 0): {}, (4096, 0): {'rotation': 0.02, 'shift': (2092.53, 9.57)}}, 'EEV9273-16-03EEV9273-20-04EEV9273-20-03': {'default_shape': (2048, 4608), (0, 0): {'rotation': -0.004, 'shift': (-2087.5, -1.58)}, (2048, 0): {}, (4096, 0): {'rotation': -0.046, 'shift': (2088.8723, -1.86)}}, 'e2v 10031-23-05,10031-01-03,10031-18-04': {'default_shape': (2048, 4608), (0, 0): {'rotation': -0.009, 'shift': (-2087.7, -0.749)}, (2048, 0): {}, (4096, 0): {'rotation': -0.003, 'shift': (2087.8014, 2.05)}}}
class pypeit.spectrographs.gemini_gmos.GeminiGMOSNE2VSpectrograph[source]

Bases: GeminiGMOSNSpectrograph

Child to handle Gemini/GMOS-N instrument with E2V detector Used until February 2017

comment = 'E2V detector; see :doc:`gemini_gmos`'

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

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_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.

Parameters:
  • 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 (astropy.io.fits.HDUList, 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.

Returns:

Object with the mosaic and detector parameters.

Return type:

Mosaic

hdu_read_order()[source]

Return the order in which to read HDU extension for each detector.

Returns:

A tuple of three iterables that provide the order of the HDU extensions for reading the data from this instrument.

Return type:

tuple

name = 'gemini_gmos_north_e2v'

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

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.gemini_gmos.GeminiGMOSNHamNSSpectrograph[source]

Bases: GeminiGMOSNHamSpectrograph

Child to handle Gemini/GMOS-N instrument with Hamamatsu detector and Nod+Shuffle in an not-really NS manner (for now)

comment = 'Same as gemini_gmos_north_ham when used in nod-and-shuffle mode; see :doc:`gemini_gmos`'

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

get_rawimage(raw_file, det)[source]

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

Parameters:
  • raw_file (str) – File to read

  • det (int, tuple) – 1-indexed detector(s) to read. An image mosaic is selected using a tuple with the detectors in the mosaic, which must be one of the allowed mosaics returned by allowed_mosaics().

Returns:

  • detector_par (DetectorContainer, Mosaic) – Detector metadata parameters for one or more detectors.

  • 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 = 'gemini_gmos_north_ham_ns'

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

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.gemini_gmos.GeminiGMOSNHamSpectrograph[source]

Bases: GeminiGMOSNSpectrograph

Child to handle Gemini/GMOS-N instrument with Hamamatsu detector Used since February 2017

comment = 'Hamamatsu detector (R400, B600, R831); Used since Feb 2017; see :doc:`gemini_gmos`'

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

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_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.

Parameters:
  • 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 (astropy.io.fits.HDUList, 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.

Returns:

Object with the mosaic and detector parameters.

Return type:

Mosaic

hdu_read_order()[source]

Return the order in which to read HDU extensions for this instrument.

Returns:

A tuple of three iterables that provide the order of the HDU extensions for reading the data from this instrument.

Return type:

tuple

name = 'gemini_gmos_north_ham'

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

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.gemini_gmos.GeminiGMOSNSpectrograph[source]

Bases: GeminiGMOSSpectrograph

Child to handle Gemini/GMOS-N instrument

camera = 'GMOS-N'

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

header_name = 'GMOS-N'

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

telescope = Parameter     Value               Default  Type        Callable --------------------------------------------------------------- name          GEMINI-N            KECK     str         False    longitude     -155.4690467527778  None     int, float  False    latitude      19.823801447222227  None     int, float  False    elevation     4213.000000001549   None     int, float  False    fratio        None                None     int, float  False    diameter      8.1                 None     int, float  False    eff_aperture  None                None     int, float  False   

Instance of TelescopePar providing telescope-specific metadata.

class pypeit.spectrographs.gemini_gmos.GeminiGMOSSHamSpectrograph[source]

Bases: GeminiGMOSSpectrograph

Child to handle Gemini/GMOS-S instrument with Hamamatsu detector

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) – An example file to use to get the image shape. Cannot be None.

  • det (int, tuple) – 1-indexed detector(s) to read. An image mosaic is selected using a tuple with the detectors in the mosaic, which must be one of the allowed mosaics returned by allowed_mosaics().

  • shape (tuple, optional) – Processed image shape. If filename is None, this must be provided; otherwise, this is ignored.

  • msbias (PypeItImage, optional) – Processed bias frame. If provided, it is used by bpm_frombias() to identify bad pixels.

Returns:

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

Return type:

numpy.ndarray

camera = 'GMOS-S'

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

comment = 'Hamamatsu detector (R400, B480, B600, R831); see :doc:`gemini_gmos`'

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_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.

Parameters:
  • 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 (astropy.io.fits.HDUList, 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.

Returns:

Object with the mosaic and detector parameters.

Return type:

Mosaic

hdu_read_order()[source]

Return the order in which to read HDU extensions for this instrument.

Returns:

A tuple of three iterables that provide the order of the HDU extensions for reading the data from this instrument.

Return type:

tuple

header_name = 'GMOS-S'

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

name = 'gemini_gmos_south_ham'

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

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          GEMINI-S             KECK     str         False    longitude     -70.7366833333333    None     int, float  False    latitude      -30.240741666666672  None     int, float  False    elevation     2749.999999999238    None     int, float  False    fratio        None                 None     int, float  False    diameter      8.1                  None     int, float  False    eff_aperture  None                 None     int, float  False   

Instance of TelescopePar providing telescope-specific metadata.

class pypeit.spectrographs.gemini_gmos.GeminiGMOSSpectrograph[source]

Bases: Spectrograph

Child to handle Gemini/GMOS specific code. This is a base class that should not be instantiated.

property allowed_mosaics

Return the list of allowed detector mosaics.

Gemini GMOS only allows for mosaicing all three detectors.

Returns:

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:

list

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

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.

This method returns a dictionary where the keys of the dictionary are the list of configuration-independent frame types. The value of each dictionary element can be set to one or more metadata keys that can be used to assign each frame type to a given configuration group. See set_configurations() and how it interprets the dictionary values, which can be None.

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

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.

Returns:

Parameters required by all of PypeIt methods.

Return type:

PypeItPar

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

Determine the slit edges from the mask file

Here, we take advantage of the WCS solution from the input wcs_file, which should be an alighment image from the observations.

Parameters:
  • binning (str, optional) – _description_. Defaults to None.

  • binning – spec,spat binning of the flat field image

  • filename (list, optional) – Names the mask design info and wcs_file in that order

  • debug (bool, optional) – Debug

  • ccdnum (int, optional) – detector number

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_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.

Parameters:
  • 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 (astropy.io.fits.HDUList, 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.

Returns:

Object with the mosaic and detector parameters.

Return type:

Mosaic

get_rawimage(raw_file, det)[source]

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

Parameters:
  • raw_file (str) – File to read

  • det (int, tuple) – 1-indexed detector(s) to read. An image mosaic is selected using a tuple with the detectors in the mosaic, which must be one of the allowed mosaics returned by allowed_mosaics().

Returns:

  • detector_par (DetectorContainer, Mosaic) – Detector metadata parameters for one or more detectors.

  • 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)[source]

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

This can be used for multi-object slitmask, but it it’s not good for “LONGSLIT” nor “long2pos”. Both “LONGSLIT” and “long2pos” have emtpy/incomplete binTable where the slitmask data are stored.

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

hdu_read_order()[source]

Return the order in which to read HDU extensions for this instrument.

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.

ndet = 3

Number of detectors for this instrument.

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

url = 'http://www.gemini.edu/instrumentation/gmos'

Reference url

pypeit.spectrographs.gemini_gmos.gemini_read_amp(inp, ext)[source]

Read one amplifier of an Gemini GMOS multi-extension FITS image

Parameters:
Returns:

  • data (numpy.ndarray) – 2D array with the science region of the raw image.

  • overscan (numpy.ndarray) – 2D array with the overscan region of the raw image.

  • datasec (str) – String representation of the section in the raw image with the science data.

  • baissec (str) – String representation of the section in the raw image with the overscan.

  • x1 (int) – Starting pixel along the first axis with the science data in the raw image.

  • y1 (int) – Starting pixel along the second axis with the science data in the raw image.