pypeit.spectrographs.keck_mosfire module

Module for Keck/MOSFIRE specific methods.

class pypeit.spectrographs.keck_mosfire.KeckMOSFIRESpectrograph[source]

Bases: Spectrograph

Child to handle Keck/MOSFIRE specific code

static _CSUlength(platescale)[source]
Parameters:

platescale (float) – platescale for the current detector

Returns:

obj:float: Nominal length of each CSU. The unit is pixels if platescale is provided otherwise it is arcsec.

static _CSUnumslits()[source]
Returns:

obj:int: Number of CSUs always used by MOSFIRE in the slitmask

static _long2pos_pos()[source]
Returns:

Two integer number indicating the x position of the beginning and the end of the three slits forming the long2pos mask

Return type:

tuple

static _long2pos_slits_length()[source]
Returns:

Three float numbers indicating the length in arcsec of the three slits in the long2pos mask

Return type:

tuple

static _slit_gap(platescale)[source]
Parameters:

platescale (float) – platescale for the current detector

Returns:

obj:float: Gap between each slit. The unit is pixels if platescale is provided otherwise it is arcsec.

static _starting_edge(scifile)[source]

Provides the slit edge from where to start when extracting the prediction from the slitmask design

Parameters:

scifile (str) – The filename of the science frame.

Returns:

obj:int: Pixel position of the starting edge

camera = 'MOSFIRE'

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.

Parameters:
Returns:

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

Return type:

numpy.ndarray

comment = 'Gratings tested: Y, J, J2, H, K; see :doc:`mosfire`'

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.

Parameters:
Returns:

Metadata value read from the header(s).

Return type:

object

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

static find_longslit_pos(scifile)[source]

Given a MOSFIRE science raw file, find the position of the slit in the LONGSLIT slitmask

Parameters:

scifile – (str): Name of the science file to read.

Returns:

Two integer number indicating the x position of the beginning and the end of the slit.

Return type:

tuple

get_comb_group(fitstbl)[source]

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, this method parses the dither pattern of the science/standard frames in a given calibration group and assigns to each of them a comb_id and a bkg_id. The known dither patterns are: “Slit Nod”, “Mask Nod”, “ABA’B’”, “ABAB”, “ABBA”, “long2pos_specphot”, and “Stare”. 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, the frames in the same dither positions are not coadded.

For “long2pos_specphot” masks, the comb_id and a bkg_id are assigned such that one of the two frames with spectra taken using the narrower slit is used as the background frame and subtracted from the frame with spectra taken using the wider slit.

Parameters:

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

Returns:

modified fitstbl.

Return type:

astropy.table.Table

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_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_ql_calib_dir(file)[source]

Returns calibrations file directory for quicklook reductions.

Parameters:

file (str) – Image file

Returns:

Quicklook calibrations directory

Return type:

str

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

header_name = 'MOSFIRE'

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.

modify_config(row, cfg)[source]

Modify the configuration dictionary for a given frame. This method is used in set_configurations() to modify in place the configuration requirement to assign a specific frame to the current setup.

This is needed for the reduction of ‘LONGSLIT’ and ‘long2pos’ data, which often use calibrations taken with a different decker (MASKNAME).

  • For the ‘LONGSLIT’ masks, when we are assigning a configuration to a calibration file that was taken with the longest slit available (46 CSUs), since these calibrations are generally used for the reduction of science frames with shorter slits, we remove the configuration requirement on the slit length for the current file.

  • For the ‘long2pos’ masks, when we are assigning a configuration to a calibration file that was taken with the ‘long2pos’ mask, since these calibrations are generally used for the reduction of science frames taken with ‘long2pos_specphot’ masks, we modify the configuration requirement on the decker_secondary for the current file.

Parameters:
  • row (astropy.table.Row) – The table row with the metadata for one frame.

  • cfg (dict) – Dictionary with metadata associated to a specific configuration.

Returns:

modified dictionary with metadata associated to a specific configuration.

Return type:

dict

name = 'keck_mosfire'

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

ndet = 1

Number of detectors for this instrument.

parse_dither_pattern(file_list, ext=None)[source]

Parse headers from a file list to determine the dither pattern.

Parameters:
  • strings) (file_list (list of) – List of files for which dither pattern is desired

  • (int (ext) – Extension containing the relevant header for these files. Default=None. If None, code uses self.primary_hdrext

  • optional) – Extension containing the relevant header for these files. Default=None. If None, code uses self.primary_hdrext

Returns:

  • dither_pattern, dither_id, offset_arcsec

  • dither_pattern (str numpy.ndarray) – Array of dither pattern names

  • dither_id (str numpy.ndarray) – Array of dither pattern IDs

  • offset_arc (float numpy.ndarray) – Array of dither pattern offsets

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

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.

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.

tweak_standard(wave_in, counts_in, counts_ivar_in, gpm_in, meta_table, log10_blaze_function=None, debug=False)[source]

This routine is for performing instrument/disperser specific tweaks to standard stars so that sensitivity function fits will be well behaved. For example, masking second order light. For instruments that don’t require such tweaks it will just return the inputs, but for isntruments that do this function is overloaded with a method that performs the tweaks.

Parameters:
  • wave_in (numpy.ndarray) – Input standard star wavelengths (float, shape = (nspec,))

  • counts_in (numpy.ndarray) – Input standard star counts (float, shape = (nspec,))

  • counts_ivar_in (numpy.ndarray) – Input inverse variance of standard star counts (float, shape = (nspec,))

  • gpm_in (numpy.ndarray) – Input good pixel mask for standard (bool, shape = (nspec,))

  • meta_table (dict) – Table containing meta data that is slupred from the SpecObjs object. See unpack_object() for the contents of this table.

  • log10_blaze_function (numpy.ndarray or None) – Input blaze function to be tweaked, optional. Default=None.

Returns:

  • wave_out (numpy.ndarray) – Output standard star wavelengths (float, shape = (nspec,))

  • counts_out (numpy.ndarray) – Output standard star counts (float, shape = (nspec,))

  • counts_ivar_out (numpy.ndarray) – Output inverse variance of standard star counts (float, shape = (nspec,))

  • gpm_out (numpy.ndarray) – Output good pixel mask for standard (bool, shape = (nspec,))

  • log10_blaze_function_out (numpy.ndarray or None) – Output blaze function after being tweaked.

url = 'https://www2.keck.hawaii.edu/inst/mosfire/home.html'

Reference url