pypeit.spectrographs.keck_nirspec module
Module for Keck/NIRSPEC specific methods.
- class pypeit.spectrographs.keck_nirspec.KeckNIRSPECHighSpectrograph[source]
Bases:
KeckNIRSPECSpectrograph
Child to handle NIRSPEC high-dispersion specific code
- check_frame_type(ftype, fitstbl, exprng=None)[source]
Check for frames of the provided type.
- Parameters:
ftype (
str
) – Type of frame to check. Must be a valid frame type; see frame-type Definitions.fitstbl (astropy.table.Table) – The table with the metadata for one or more frames to check.
exprng (
list
, optional) – Range in the allowed exposure time for a frame of typeftype
. Seepypeit.core.framematch.check_frame_exptime()
.
- Returns:
Boolean array with the flags selecting the exposures in
fitstbl
that areftype
type frames.- Return type:
- comment = 'POST upgrade (~Dec 2018), High-dispersion grating, see :ref:`nirspec_high_howto`'
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, usedefault_pypeit_par()
.
- Returns:
The PypeIt parameter set adjusted for configuration specific parameter values.
- Return type:
- classmethod 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:
- classmethod default_pypeit_par()[source]
Return the default parameters to use for this instrument.
- Returns:
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.
- filter1 = ''
- filter2 = ''
- get_detector_par(det, hdu=None)[source]
Return metadata for the selected detector. see https://www2.keck.hawaii.edu/inst/nirspec/Specifications.html and https://www2.keck.hawaii.edu/inst/nirspec/images/spec_highres.png
- Parameters:
det (
int
) – 1-indexed detector number. This is not used because NIRSPEC only has one detector!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:
- get_echelle_angle_files()[source]
Pass back the files required to run the echelle method of wavecalib
- Returns:
List of files
- Return type:
- 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:
- Raises:
ValueError – Raised if the status is not one of the valid options.
- lamps_list = []
- name = 'keck_nirspec_high'
The name of the spectrograph. See Spectrographs for the currently supported spectrographs.
- order_platescale(order_vec, binning=None)[source]
Return the platescale for each echelle order.
Note that NIRSPEC has no binning.
- Parameters:
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.
- Returns:
An array with the platescale for each order provided by
order
.- Return type:
- pypeline = 'Echelle'
String used to select the general pipeline approach for this spectrograph.
- 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 inconfig_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:
- 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_nirspec.KeckNIRSPECHighSpectrographOld[source]
Bases:
KeckNIRSPECSpectrographOld
Child to handle NIRSPEC high-dispersion pre-upgrade specific code
- check_frame_type(ftype, fitstbl, exprng=None)[source]
Check for frames of the provided type.
- Parameters:
ftype (
str
) – Type of frame to check. Must be a valid frame type; see frame-type Definitions.fitstbl (astropy.table.Table) – The table with the metadata for one or more frames to check.
exprng (
list
, optional) – Range in the allowed exposure time for a frame of typeftype
. Seepypeit.core.framematch.check_frame_exptime()
.
- Returns:
Boolean array with the flags selecting the exposures in
fitstbl
that areftype
type frames.- Return type:
- comment = 'PRE-upgrade (~Dec 2018),High-dispersion grating, see :ref:`nirspec_high_howto`'
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, usedefault_pypeit_par()
.
- Returns:
The PypeIt parameter set adjusted for configuration specific parameter values.
- Return type:
- 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:
- classmethod default_pypeit_par()[source]
Return the default parameters to use for this instrument.
- Returns:
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.
- filter = ''
- get_detector_par(det, hdu=None)[source]
Return metadata for the selected detector. see https://web.archive.org/web/20161107225756/https://www2.keck.hawaii.edu/inst/nirspec/Specifications.html and https://web.archive.org/web/20161102133624/https://www2.keck.hawaii.edu//inst/nirspec/nirspec-spec-highres.pdf
- Parameters:
det (
int
) – 1-indexed detector number. This is not used because NIRSPEC only has one detector!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:
- get_echelle_angle_files()[source]
Pass back the files required to run the echelle method of wavecalib
Created for the pre-upgrade NIRSPEC
- Returns:
List of files
- Return type:
- get_rawimage(raw_file, det)[source]
Read raw images and generate a few other bits and pieces that are key for image processing.
Warning
When reading multiple detectors for a mosaic, this function expects all detector arrays to have exactly the same shape.
- Parameters:
- Returns:
detector_par (
DetectorContainer
,Mosaic
) – Detector metadata parameters for one or more detectors.raw_img (numpy.ndarray) – Raw image for this detector. Shape is 2D if a single detector image is read and 3D if multiple detectors are read. E.g., the image from the first detector in the tuple is accessed using
raw_img[0]
.hdu (astropy.io.fits.HDUList) – Opened fits file
exptime (
float
) – Exposure time in seconds.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. Shape is identical to
raw_img
.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. Shape is identical to
raw_img
.
- 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:
- Raises:
ValueError – Raised if the status is not one of the valid options.
- lamps_list = []
- name = 'keck_nirspec_high_old'
The name of the spectrograph. See Spectrographs for the currently supported spectrographs.
- order_platescale(order_vec, binning=None)[source]
Return the platescale for each echelle order.
Note that NIRSPEC has no binning.
- Parameters:
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.
- Returns:
An array with the platescale for each order provided by
order
.- Return type:
- pypeline = 'Echelle'
String used to select the general pipeline approach for this spectrograph.
- 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 inconfig_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:
- 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_nirspec.KeckNIRSPECLowSpectrograph[source]
Bases:
KeckNIRSPECSpectrograph
Child to handle NIRSPEC low-dispersion 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
usingget_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:
- check_frame_type(ftype, fitstbl, exprng=None)[source]
Check for frames of the provided type.
- Parameters:
ftype (
str
) – Type of frame to check. Must be a valid frame type; see frame-type Definitions.fitstbl (astropy.table.Table) – The table with the metadata for one or more frames to check.
exprng (
list
, optional) – Range in the allowed exposure time for a frame of typeftype
. Seepypeit.core.framematch.check_frame_exptime()
.
- Returns:
Boolean array with the flags selecting the exposures in
fitstbl
that areftype
type frames.- Return type:
- comment = 'POST-upgrade (~Dec 2018), Low-dispersion grating'
A brief comment or description regarding PypeIt usage with this spectrograph.
- 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:
- classmethod default_pypeit_par()[source]
Return the default parameters to use for this instrument.
- Returns:
Parameters required by all of PypeIt methods.
- Return type:
- get_detector_par(det, hdu=None)[source]
Return metadata for the selected detector. see https://www2.keck.hawaii.edu/inst/nirspec/Specifications.html and https://www2.keck.hawaii.edu/inst/nirspec/images/spec_lowres.png
- Parameters:
det (
int
) – 1-indexed detector number. This is not used because NIRSPEC only has one detector!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:
- 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:
- Raises:
ValueError – Raised if the status is not one of the valid options.
- name = 'keck_nirspec_low'
The name of the spectrograph. See Spectrographs for the currently supported spectrographs.
- pypeline = 'MultiSlit'
String used to select the general pipeline approach for this spectrograph.
- 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 inconfig_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:
- 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_nirspec.KeckNIRSPECSpectrograph[source]
Bases:
Spectrograph
Parent to handle the new Keck/NIRSPEC detector (i.e. post late 2018) specific code
- camera = 'NIRSPEC'
Name of the spectrograph camera or arm. This is used by specdb, so use that naming convention
- comment = 'POST upgrade (~Dec 2018)'
A brief comment or description regarding PypeIt usage with this spectrograph.
- header_name = 'NIRSPEC'
Name of the spectrograph camera or arm from the Header. Usually the INSTRUME card.
- ndet = 1
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:
- 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/nirspec/'
Reference url
- class pypeit.spectrographs.keck_nirspec.KeckNIRSPECSpectrographOld[source]
Bases:
Spectrograph
Parent to handle the old Keck/NIRSPEC detector (i.e. pre late 2018) specific code
- camera = 'NIRSPEC'
Name of the spectrograph camera or arm. This is used by specdb, so use that naming convention
- comment = 'PRE upgrade (~Dec 2018)'
A brief comment or description regarding PypeIt usage with this spectrograph.
- header_name = 'NIRSPEC'
Name of the spectrograph camera or arm from the Header. Usually the INSTRUME card.
- ndet = 1
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:
- 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/nirspec/'
Reference url