-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1666 from pypeit/lris_wave
LRIS jamboree
- Loading branch information
Showing
70 changed files
with
2,890 additions
and
515 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
.. include:: ../include/links.rst | ||
|
||
.. _lris_config_report: | ||
|
||
Automated sorting of LRIS frames by instrument configuration | ||
============================================================== | ||
|
||
Version History | ||
--------------- | ||
|
||
|
||
========= ================ =========== =========== | ||
*Version* *Author* *Date* ``PypeIt`` | ||
========= ================ =========== =========== | ||
1.0 Debora Pelliccia 6 Sep 2023 1.13.1.dev | ||
========= ================ =========== =========== | ||
|
||
---- | ||
|
||
Basics | ||
------ | ||
|
||
To prepare for the data reduction, PypeIt, first, automatically associates fits | ||
files to specific :ref:`frame_types` (see :ref:`lris_frames_report`) and, then, | ||
collects groups of frames in unique instrument configurations (see below). This is performed | ||
by the :ref:`pypeit_setup` script, which sorts the frames and writes a | ||
:ref:`pypeit_file` for each unique configuration. See :ref:`setup_doc`. | ||
|
||
|
||
LRIS configuration identification | ||
--------------------------------- | ||
|
||
The LRIS instrument configurations are determined, in the same | ||
way for ``keck_lris_red``, ``keck_lris_red_orig``, ``keck_lris_red_mark4``, | ||
``keck_lris_blue``, and ``keck_lris_blue_orig`` (unless otherwise noted), | ||
by the function :func:`pypeit.metadata.PypeItMetaData.unique_configurations`, | ||
which finds unique combinations of the following keywords: | ||
|
||
=============== ==================================================================== | ||
``fitstbl`` key Header Key | ||
=============== ==================================================================== | ||
``dispname`` ``GRANAME`` (LRIS RED) or ``GRISNAME`` (LRIS BLUE) | ||
``dichroic`` ``DICHNAME`` | ||
``decker`` ``SLITNAME`` | ||
``binning`` ``BINNING`` | ||
``amp`` ``NUMAMPS`` (``TAPLINES`` for ``keck_lris_red_mark4``) | ||
``dispangle`` ``GRANGLE`` (only LRIS RED) | ||
``cenwave`` ``WAVELEN`` (only LRIS RED) | ||
=============== ==================================================================== | ||
|
||
The unique configurations are determined by collating the relevant metadata from the headers | ||
of all frames found by a run of :ref:`pypeit_setup`, *except* those that are designated as | ||
bias frames. The reason is that bias frames can have header data (e.g., ``dispangle``) | ||
that do not match the instrument configuration that an observer intended for their use; | ||
e.g., the frames were taken before the instrument was fully configured for the night's | ||
observations. Therefore, PypeIt uses the ``dateobs``, ``binning``, ``amp`` keys to match | ||
the bias frames to the configurations with frames taken on the same date, with | ||
the same binning and on the same amplifier. | ||
|
||
After that, :func:`pypeit.metadata.PypeItMetaData.set_configurations` associates each frame | ||
to the relevant unique configuration ("setup"), by assigning a setup identifier | ||
(e.g., A,B,C,D...) to every frames for which the values of the above keywords match the | ||
values of the specific unique configuration. | ||
|
||
LRIS calibration groups | ||
----------------------- | ||
|
||
PypeIt uses the concept of a "calibration group" to define a complete set of | ||
calibration frames (e.g., arcs, flats) and the science frames to which these calibration | ||
frames should be applied. | ||
|
||
By default, :ref:`pypeit_setup` uses the setup identifier to assign frames to a single | ||
calibration group. Frames that are in the same calibration group will have the same PypeIt | ||
keyword ``calib``. No automated procedure exists to do anything except this. | ||
However, the user can edit the :ref:`pypeit_file` to, within a given configuration, assign | ||
specific calibration frames to specific science frames using the data in the ``calib`` column | ||
of the :ref:`data_block`. | ||
|
||
Testing | ||
------- | ||
|
||
Requirement PLL-17 states: "As a user, I expect the pipeline to automatically | ||
and correctly associate calibrations with science frames." | ||
|
||
PypeIt meets this requirement in the majority of use cases, as shown by the tests below. | ||
|
||
Note that the tests described in :ref:`lris_frames_report` are also relevant here | ||
since they show that PypeIt correctly identifies LRIS data and associates | ||
them with a single configuration, all written to a single pypeit file. | ||
|
||
To test that PypeIt can successfully identify multiple | ||
configurations among a set of files, we have added five tests | ||
``${PYPEIT_DEV}/unit_tests/test_setups.py``. They are: | ||
|
||
- ``test_setup_keck_lris_blue_multiconfig()``, | ||
- ``test_setup_keck_lris_blue_orig_multiconfig()`` | ||
- ``test_setup_keck_lris_red_multiconfig()`` | ||
- ``test_setup_keck_lris_red_orig_multiconfig()`` | ||
- ``test_setup_keck_lris_red_mark4_multiconfig()`` | ||
|
||
Here is an example of how to run the tests: | ||
|
||
.. code-block:: bash | ||
cd ${PYPEIT_DEV}/unit_tests | ||
pytest test_setup.py::test_setup_keck_lris_blue_multiconfig -W ignore | ||
The tests require that you have downloaded the PypeIt | ||
:ref:`dev-suite` and defined the ``PYPEIT_DEV`` environmental | ||
variable that points to the relevant directory. | ||
|
||
The algorithm for all these tests is the same and is as follows: | ||
|
||
1. Collect the names of all files in selected LRIS directories | ||
(separately for ``keck_lris_blue``, ``keck_lris_blue_orig``, ``keck_lris_red``, | ||
``keck_lris_red_orig``, ``keck_lris_red_mark4``). | ||
|
||
2. Use :class:`~pypeit.pypeitsetup.PypeItSetup` to automatically | ||
identify the configurations for these files. | ||
|
||
3. Check that the code found two configurations and wrote the | ||
pypeit files for each. | ||
|
||
4. For each configuration: | ||
|
||
a. Read the pypeit file | ||
|
||
b. Check that the name for the setup is correct ('A' or 'B') | ||
|
||
c. Check that the calibration group is the same for all frames ('0' or '1') | ||
|
||
|
||
Because these tests are now included in the PypeIt | ||
:ref:`unit-tests`, these configuration checks are performed by the | ||
developers for every new version of the code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
.. include:: ../include/links.rst | ||
|
||
.. _lris_frames_report: | ||
|
||
Automated typing of LRIS (BLUE and RED) frames | ||
============================================== | ||
|
||
Version History | ||
--------------- | ||
|
||
|
||
========= ================ =========== =========== | ||
*Version* *Author* *Date* ``PypeIt`` | ||
========= ================ =========== =========== | ||
1.0 Debora Pelliccia 6 Sep 2023 1.13.1.dev | ||
========= ================ =========== =========== | ||
|
||
---- | ||
|
||
Basics | ||
------ | ||
|
||
The general procedure used to assign frames a given type is described | ||
here: :ref:`frame_types`. | ||
|
||
LRIS frame typing | ||
----------------- | ||
|
||
The primary typing of LRIS frames is performed by | ||
:func:`pypeit.spectrographs.keck_lris.KeckLRISSpectrograph.check_frame_type`. | ||
This function checks the values of various header keywords against a | ||
set of criteria used to classify the frame type. The same criteria are used for | ||
``keck_lris_red``, ``keck_lris_red_orig``, ``keck_lris_red_mark4``, ``keck_lris_blue``, | ||
and ``keck_lris_blue_orig``, unless otherwise noted. | ||
The header cards required for the frame-typing and their associated keyword in the | ||
:class:`~pypeit.metadata.PypeItMetaData` object are: | ||
|
||
=============== ====================================================== | ||
``fitstbl`` key Header Key | ||
=============== ====================================================== | ||
``exptime`` ``ELAPTIME`` (``TELAPSE`` for ``keck_lris_red_mark4``) | ||
``hatch`` ``TRAPDOOR`` | ||
``lampstat01`` See below | ||
=============== ====================================================== | ||
|
||
``lampstat01`` is defined using a combination of header keywords, which include | ||
``LAMPS``, ``MERCURY``, ``NEON``, ``ARGON``, ``CADMIUM``, ``ZINC``, ``HALOGEN``, | ||
``KRYPTON``, ``XENON``, ``FEARGON``, ``DEUTERI``, ``FLAMP1``, ``FLAMP2``, ``FLIMAGIN``, | ||
``FLSPECTR``. Since LRIS header keywords have changed over time, the exact combination | ||
of keywords used to define ``lampstat01`` varies depending on the available header keywords. | ||
|
||
The criteria used to select each frame type are as follows: | ||
|
||
============= ============ ====================================== =========================================== | ||
Frame ``hatch`` ``lampstat01`` ``exptime`` | ||
============= ============ ====================================== =========================================== | ||
``science`` ``'open'`` ``'off'`` ``>61s`` | ||
``standard`` ``'open'`` ``'off'`` ``>1s`` & ``<61s`` | ||
``bias`` ``'closed'`` ``'off'`` ``<0.001s`` | ||
``pixelflat`` ``'closed'`` ``'Halogen' or '2H'`` ``<60s``(LRIS RED) or ``<300s`` (LRIS BLUE) | ||
``pixelflat`` ``'open'`` ``'on'`` ``<60s``(LRIS RED) or ``<300s`` (LRIS BLUE) | ||
``trace`` ``'closed'`` ``'Halogen'`` or ``'2H'`` ``<60s``(LRIS RED) or ``<300s`` (LRIS BLUE) | ||
``trace`` ``'open'`` ``'on'`` ``<60s``(LRIS RED) or ``<300s`` (LRIS BLUE) | ||
``illumflat`` ``'closed'`` ``'Halogen'`` or ``'2H'`` ``<60s``(LRIS RED) or ``<300s`` (LRIS BLUE) | ||
``illumflat`` ``'open'`` ``'on'`` ``<60s``(LRIS RED) or ``<300s`` (LRIS BLUE) | ||
``arc`` ``'closed'`` ``!= 'Halogen', '2H', 'on', 'off'`` Not used | ||
``tilt`` ``'closed'`` ``!= 'Halogen', '2H', 'on', 'off'`` Not used | ||
============= ============ ====================================== =========================================== | ||
|
||
Note that PypeIt employs commonly used value of ``exptime`` to distinguish frame type; | ||
however, if needed, the user can specify a different value by | ||
using the ``exprng`` parameter in the :ref:`pypeit_file`; see also :ref:`frame_types`. | ||
|
||
The criteria used to select ``arc`` and ``tilt`` frames are identical; the same is true for | ||
``pixelflat``, ``trace``, and ``illumflat`` frames. However, it's important to note that | ||
PypeIt is able to correctly assign the ``pixelflat``, ``trace``, and ``illumflat`` types | ||
to the internal and dome flat frames, but the twilight flats will generally have the | ||
``science`` or ``standard`` type. Therefore, the user should manually change their frame type | ||
in the :ref:`pypeit_file`. | ||
|
||
Finally, note that a LRIS frame is never given a ``pinhole`` or ``dark`` type. | ||
|
||
|
||
Testing | ||
------- | ||
|
||
Requirement PLL-16 states: "As a user, I expect the pipeline to automatically classify my data." | ||
|
||
``PypeIt`` meets this requirement as demonstrated by the tests at | ||
``${PYPEIT_DEV}/unit_tests/test_frametype.py``. There is one test | ||
per spectrograph: | ||
|
||
- ``test_lris_blue()`` | ||
- ``test_lris_blue_orig()`` | ||
- ``test_lris_red()`` | ||
- ``test_lris_red_orig()`` | ||
- ``test_lris_red_mark4()`` | ||
|
||
Here is an example of how to run the tests: | ||
|
||
.. code-block:: bash | ||
cd ${PYPEIT_DEV}/unit_tests | ||
pytest test_frametype.py::test_lris_blue -W ignore | ||
The tests requires that you have downloaded the PypeIt | ||
:ref:`dev-suite` and defined the ``PYPEIT_DEV`` environmental | ||
variable that points to the relevant directory. The algorithm for | ||
all these tests is the same and is as follows: | ||
|
||
1. Find the directories in the :ref:`dev-suite` with Keck | ||
LRIS data (separately for ``keck_lris_blue``, | ||
``keck_lris_blue_orig``, ``keck_lris_red``, | ||
``keck_lris_red_orig``, ``keck_lris_red_mark4``). | ||
|
||
2. For each directory (i.e., instrument setup): | ||
|
||
a. Make sure there is a "by-hand" version of the pypeit file | ||
for this setup where a human (one of the pypeit | ||
developers) has ensured the frame types are correct. | ||
|
||
b. Effectively run :ref:`pypeit_setup` on each of the | ||
instrument setups to construct a new pypeit file with the | ||
automatically generated frame types. | ||
|
||
c. Read both the by-hand and automatically generated frame | ||
types from these two pypeit files and check that they are | ||
identical. This check is *only* performed for the | ||
calibration frames, not any ``science`` or ``standard`` | ||
frames. | ||
|
||
Because this test is now included in the ``PypeIt`` | ||
:ref:`unit-tests`, this frame-typing check is performed by the | ||
developers for every new version of the code. | ||
|
||
|
Oops, something went wrong.