.. _mosfire: ************ Keck MOSFIRE ************ Overview ======== This file summarizes several instrument specific settings that are related to the Keck/MOSFIRE spectrograph. PypeIt File =========== Here is some advice on how to setup your :ref:`pypeit_file`. First, run: .. code-block:: console pypeit_setup -r absolute_path -s keck_mosfire -b -c A where ``-b`` indicates that the data use sky subtraction and the ``calib``, ``comb_id``, and ``bkg_id`` columns are added to the :ref:`data_block`. See :ref:`pypeit_setup` and :doc:`../A-B_differencing` for the syntax used for the data in these columns and how PypeIt uses them. Here is an example of the :ref:`data_block` of the PypeIt file: .. code-block:: console # Read in the data data read path raw/ filename | frametype | ra | dec | target | dispname | decker | binning | mjd | airmass | exptime | filter1 | lampstat01 | dithpat | dithpos | dithoff | frameno | calib | comb_id | bkg_id m120910_0410.fits | pixelflat,illumflat,trace | 7.8 | 45.0 | Dome Phlatz | H-spectroscopy | MOSFIRE_DRP_MASK | 1,1 | 56180.6945327 | 1.41291034 | 14.5479 | H | on | Stare | object | 0.0 | 410 | 3 | -1 | -1 m120910_0411.fits | pixelflat,illumflat,trace | 7.8 | 45.0 | Dome Phlatz | H-spectroscopy | MOSFIRE_DRP_MASK | 1,1 | 56180.6948371 | 1.41291034 | 14.5479 | H | on | Stare | object | 0.0 | 411 | 3 | -1 | -1 m120910_0412.fits | pixelflat,illumflat,trace | 7.8 | 45.0 | Dome Phlatz | H-spectroscopy | MOSFIRE_DRP_MASK | 1,1 | 56180.69517159 | 1.41291034 | 14.5479 | H | on | Stare | object | 0.0 | 412 | 3 | -1 | -1 m120910_0175.fits | arc,science,tilt | 344.98215835 | 33.00561651 | MOSFIRE_DRP_MAS | H-spectroscopy | MOSFIRE_DRP_MASK | 1,1 | 56180.53134073 | 1.27528573 | 29.0958 | H | off | Mask Nod | A | 2.5 | 175 | 3 | 16 | 17 m120910_0176.fits | arc,science,tilt | 344.98372629 | 33.00516929 | MOSFIRE_DRP_MAS | H-spectroscopy | MOSFIRE_DRP_MASK | 1,1 | 56180.53198772 | 1.27866912 | 29.0958 | H | off | Mask Nod | B | -2.5 | 176 | 3 | 17 | 16 data end ``frametype`` is automatically assigned to each frame using the values of various header keywords, see :ref:`mosfire_frames_report`. The dither pattern, position and offset associated to each fame is reported here. PypeIt tries to automatically set the ``calib``, ``comb_id``, and ``bkg_id`` using the dither information (see :ref:`mosfire_config_report`); however, the user can edit these columns according to the preferred reduction. Calibrations ============ .. _mosfire-edge-tracing: Edge Tracing ------------ Multi-slits *********** PypeIt is able to match the traced slit to the slit-mask design information contained as metadata in the MOSFIRE observations. This functionality at the moment is implemented only for these :ref:`slitmask_info_instruments` and is switched on by setting ``use_maskdesign`` flag in :ref:`edgetracepar` to True. This is, already, the default for MOSFIRE, except when the ``LONGSLIT`` mask is used. PypeIt also assigns to each extracted 1D spectrum the corresponding RA, Dec and object name information from the slit-mask design, and forces the extraction of undetected object at the location expected from the slit-mask design. This functionality is also the default for MOSFIRE and can be controlled through the flags ``assign_obj`` and ``extract_missing_objs`` in :ref:`slitmaskpar`. See `Additional Reading`_ . By default, PypeIt uses the dither offset recorded in the header of the science frames to find the objects in the slits. However, a better approach would be to let PypeIt compute the offset using a bright object in one of the slits in the slit-mask. To do so, the user should provide in the :ref:`pypeit_file` the ``maskdef_id`` (corresponding to "Slit_Number" in the MOSFIRE slit-mask design) of the slit containing the bright object. Here is an example: .. code-block:: ini [reduce] [[slitmask]] use_dither_offset = False bright_maskdef_id = 1 Note that ``maskdef_id`` is an ID associated to each slit in the slit-mask design, therefore it is instrument specific, and it differs from ``SPAT_ID``, which is generated by PypeIt and assigned to each slit. When the extraction of undetected objects is performed, the user can input a value of the FWHM for the optimal extraction by setting the parameter ``missing_objs_fwhm`` in :ref:`slitmaskpar`. If ``missing_objs_fwhm = None`` (which is the default), PypeIt will use the median FWHM of all the detected objects. long2pos ******** This a custom CSU mask with two slits that are offset from the field center (plus a center alignment box), which allows MOSFIRE observers to acquire standard star spectra that cover the entire accessible wavelength range. Besides these two slits and the central alignment box, the rest of the mask is filled with random slits. Often, the calibration frames don't have the same number of random slits as in the science frame, causing bad calibration or the code to crash. PypeIt is able to exclude those random slits from the slit tracing process. The parameter that controls the exclusion of detector regions from the slit edge tracing is ``exclude_regions`` in :ref:`edgetracepar`. By default, PypeIt excludes the regions where the random slits are for a ``long2pos`` mask, but if the users want to modify that, they can do it in the :ref:`pypeit_file` in the following way: .. code-block:: ini [calibrations] [[slitedges]] exclude_regions = 1:0:880,1:1190:2040 This example would select two regions in detector 1 between pixels 0 and 880 and between 1190 and 2040 in the x direction of the detector. Moreover, similarly to the multi-slits mask, PypeIt by default will match the traced slit to the slit-mask design information contained as metadata in the MOSFIRE observations, and assign to each extracted 1D spectrum the corresponding RA, Dec and object name information from the slit-mask design. However, forcing the extraction of undetected object is not performed by default. Note that the RA and Dec recorded in the MOSFIRE observations of ``long2pos`` masks are mock numbers, therefore the users should not use them. LONGSLIT ******** Similar to ``long2pos``, ``LONGSLIT`` masks with a single slit that is shorter than the length of the detector will have random slits that fill the mask. By default, PypeIt is capable of excluding from the edge tracing process the regions where the random slits are for a ``LONGSLIT`` mask. However, if the automatic selection of the regions to exclude does not look right, the users can still modify that adding the ``exclude_regions`` parameter in the :ref:`pypeit_file` (as shown above), making sure that the flag ``bound_detector`` is set to True. .. _mosfire_flats: Flat Fielding ------------- The MOSFIRE calibration GUI provides the option to take flats with the lamps off. This is the default in the GUI only for the K-band, but we recommend taking these ``lampoffflats`` **for all MOSFIRE spectroscopic observations**. The purpose of the ``lampoffflats`` is to remove the increase and/or variation in zero level caused by persistence from the high counts in the flats and/or thermal emission from the telescope/dome (in the K-band). PypeIt is able to recognize flat frames taken with the lamps off, and it will assign them the ``lampoffflats`` frame type. Whenever ``lampoffflats`` frames are identified in the PypeIt file, PypeIt will subtract them from the frames taken with the lamps on before creating the :doc:`../calibrations/edges` and :doc:`../calibrations/flat` frames. The user is responsible for ensuring that the ``lampoffflats`` frames in the PypeIt file have the same exposure times as the ``trace``, ``pixelflat`` and ``illumflat`` frames. .. note:: The ``lampoffflats`` frames are always subtracted from the ``trace``, ``pixelflat`` and ``illumflat`` frames. The default mode for MOSFIRE is to use the spectroscopic domeflats for ``trace``, ``pixelflat`` and ``illumflat``. If the user wants to use other images (e.g. spectroscopic twilight flats) for the ``illumflat``, then the current implementation would likely fail. If distinct frames are desired for ``trace``, ``pixelflat`` and ``illumflat``, we currently advise users to simply not use the ``lampoffflats``. .. _mosfire_wavecalib: Wavelength calibration ---------------------- As default, the wavelength calibration is performed using the OH lines in science frames and the :ref:`wvcalib-fulltemplate` algorithm. The templates are created in the same way as done for Keck/DEIMOS (see :ref:`deimos_wavecalib`) and kept in the ``data/arc_lines/reid_arxiv`` directory. There are five templates, one per each of the most commonly used MOSFIRE filters: - keck_mosfire_OH_Y.fits - keck_mosfire_OH_J.fits - keck_mosfire_OH_J2.fits - keck_mosfire_OH_H.fits - keck_mosfire_OH_K.fits and PypeIt will automatically choose the right template according to the specific dataset. When `long2pos_specphot` mask is used, the wavelength calibration using OH lines will not be successful. Therefore, five additional templates using arcs lines (Ar, Ne) are also available: - keck_mosfire_arcs_Y.fits - keck_mosfire_arcs_J.fits - keck_mosfire_arcs_J2.fits - keck_mosfire_arcs_H.fits - keck_mosfire_arcs_K.fits PypeIt will use as default the arcs template if the mask used for the science/standard frames is ``long2pos_specphot``. Arc frames must be provided. If there are other cases in which the user prefers to perform the wavelength calibration using the arc frames, instead of using the OH lines, this can be done by adding in the :ref:`pypeit_file`: .. code-block:: ini [calibrations] [[wavelengths]] sigdetect = 5 method = full_template reid_arxiv = keck_mosfire_arcs_Y.fits lamps = Ar_IR_MOSFIRE,Ne_IR_MOSFIRE Reduction ========= A standard run of PypeIt, i.e., :ref:`run-pypeit`, produces 2 reduced spectra per each pair of science-background frames. Assuming that the science frame is taken at the dither position "A" and the background frame is taken at the the dither position "B", the 2 output spectra would be A-B and B-A. To combine these 2 output spectra and obtain a 2D spectrum that shows negative-positive-negative traces, the user can run :ref:`pypeit-coadd-2dspec`, which will also extract the combined 1D spectra. See :ref:`coadd2d` and :ref:`coadd2d_howto`. Note that, during :ref:`run-pypeit`, science frames can be combined (see :ref:`2d_combine` and :ref:`a-b_differencing`), but in this case no optimal weighting and drift correction are applied. long2pos mask ------------- Observations taken with a ``long2pos`` mask are generally used for flux calibration. To maximize the wavelength coverage of the observed standard star, 2 spectra are taken in 2 different wavelength regions. PypeIt standard reduction and the subsequent run of :ref:`pypeit-coadd-2dspec` for data taken with a ``long2pos`` mask will not combine the 2 wavelength regions, but the user can run :ref:`pypeit_coadd_1dspec` to combine the 2 output 1D spectra into a single one. Additional Reading ================== Here are additional docs related to Keck/MOSFIRE. Note all of them are related to the development of PypeIt for use with MOSFIRE data: .. TODO: Generally useful information in these dev docs should be moved into .. user-level doc pages, even if that means repeating information. .. toctree:: :maxdepth: 1 ../dev/mosfireframes ../dev/mosfireconfig ../dev/slitmask_ids ../dev/radec_object ../dev/add_missing_obj ../tutorials/mosfire_howto