Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified manual/docs/MOSFIRE_DRP_Manual.pdf
Binary file not shown.
82 changes: 82 additions & 0 deletions manual/docs/autodriver.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,85 @@ To handle special cases, the automatic generation of the driver file makes a num
4. In longslit, the pipeline will try to determine the size of the slit using the mask name. For example, if the maskname is LONGSLIT-3x0.7, the pipeline assumes that you have used 3 slits to generate the longslit and that they are centered around the middle line of the detector.
5. If any of the mandatory observations are missing (such as the flat fields), the pipeline will still generate a Driver.py file, but it will contain warnings about the missing files, and it will NOT run correctly.
6. If multiple observations of different stars are done in long2pos or in longslit mode, the pipeline will generate multiple driver files, one for each object. If the same object is observed multiple times during the same night, all the observations will end up in the same driver file. If you are observing a telluric standard at different times and you need to have separate spectra, you need to manually create Offset files and Driver files.


# The driver.py File

__Important Note:__ The information in this section is included for reference purposes only. The supported method for use of the DRP is to use the `AutoDriver` step detailed above. The example driver files discussed below and the methods for using them are not maintained.

The driver file controls all the pipeline steps, and in the drivers sub-directory, you will find a number of driver files: `Driver.py`, `K_Driver.py`, `Long2pos_driver.py`, and `Longslit_Driver.py`. The `Driver` and `K_Driver` will reduce your science data for bands Y,J, and H (this includes the sample data set). The K band requires a special approach because there are too few bright night-sky emission lines at the red end and so the `K_Driver` synthesizes arclamps and night sky lines. The `Long2pos_driver.py` handles `long2pos` and `long2pos_specphot` observations, while the `Longslit_driver.py` deals with observations of single objects using a longslit configuration.

The driver.py files included with the code download contains execution lines that are commented out. For this example, we will run the driver file one line at a time, but as you become familiar with the DRP process, you will develop your own driver file execution sequencing. Although in the future we hope to further automate the driver file, currently some steps require you to update the inputs with filenames created from previous steps.

Below is a driver.py file:

import os, time
import MOSFIRE

from MOSFIRE import Background, Combine, Detector, Flats, IO, Options, \
Rectify
from MOSFIRE import Wavelength

import numpy as np, pylab as pl, pyfits as pf

np.seterr(all="ignore")

#Update the insertmaskname with the name of the mask
#Update S with the filter band Y,J,H,or K
maskname = 'insertmaskname'
band = 'S'

flatops = Options.flat
waveops = Options.wavelength

obsfiles = ['Offset_1.5.txt', 'Offset_-1.5.txt']

#Flats.handle_flats('Flat.txt', maskname, band, flatops)
#Wavelength.imcombine(obsfiles, maskname, band, waveops)
#Wavelength.fit_lambda_interactively(maskname, band, obsfiles,
#waveops)
#Wavelength.fit_lambda(maskname, band, obsfiles, obsfiles,
#waveops)

#Wavelength.apply_lambda_simple(maskname, band, obsfiles, waveops)
#Background.handle_background(obsfiles,
#'lambda_solution_wave_stack_H_m130429_0224-0249.fits',
#maskname, band, waveops)

redfiles = ["eps_" + file + ".fits" for file in obsfiles]
#Rectify.handle_rectification(maskname, redfiles,
# "lambda_solution_wave_stack_H_m130429_0224-0249.fits",
# band,
# "/scr2/npk/mosfire/2013apr29/m130429_0224.fits",
# waveops)
#

To set up your driver file do the following:

1. Navigate to the desired output directory created by handle: `cd ~/Data/reducedMOSFIRE_DRP_MASK/2012sep10/H`
2. Copy the appropriate driver file: `cp ~/MosfireDRP-master/drivers/Driver.py .` NOTE: If you are observing a K band mask you’ll want to copy the `K_driver.py` file over.
3. Edit driver.py (see bold text in driver file example)
* Update maskname
* Update band to be Y,J,H
* Update the `Offset_#.txt` name. Handle creates offset files with names that are specific to the nod throw. The default driver file uses 1.5 arcsec offsets in the file name.

In the sections that follow, we will describe the function and outputs of the commented lines found in the driver file starting with the creation of flats.

If you prefer to override the standard naming convention of the output files, you can specify

target = “targetname”

at the beginning of the driver file. If you do so, remember to also add target=target to both the Background and Rectify steps. Example:

Background.handle_background(obsfiles,
'lambda_solution_wave_stack_H_m150428_0091-0091.fits',
maskname, band, waveops, target=target)









23 changes: 11 additions & 12 deletions manual/docs/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@
4. [Retrieve Your Data](retrieve)
5. [DRP First Reduction Step: Handle](handle)
6. [Automatic Generation of the Driver File](autodriver)
7. [The driver.py File](driver)
8. [Flats](flats)
9. [Wavelength Calibration – Y, J, and H Bands](wavelengthYJH)
10. [Wavelength Calibration – K Band](wavelengthK)
11. [Background Subtraction](background)
12. [Rectify](rectify)
13. [Spectral Extraction](extract)
14. [Long2pos Reductions](long2pos)
15. [Longslit Reductions](longslit)
16. [A Word About Header Comments](headercomments)
17. [Some Hints](hints)
18. [Examples](example)
7. [Flats](flats)
8. [Wavelength Calibration – Y, J, and H Bands](wavelengthYJH)
9. [Wavelength Calibration – K Band](wavelengthK)
10. [Background Subtraction](background)
11. [Rectify](rectify)
12. [Spectral Extraction](extract)
13. [Long2pos Reductions](long2pos)
14. [Longslit Reductions](longslit)
15. [A Word About Header Comments](headercomments)
16. [Some Hints](hints)
17. [Examples](example)

The manual is also available in pdf form: [MOSFIRE_DRP_Manual.pdf](MOSFIRE_DRP_Manual.pdf)

Expand Down
2 changes: 1 addition & 1 deletion manual/docs/retrieve.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Before running the drp, you will need a set of spectroscopic data to reduce that

If you need to retrieve your data, you may either use a secure copy (scp) assumine your data is still accessible from the Keck/MOSFIRE data directory (contact your SA if you need assistance) or use KOA –the Keck Observatory Archive to navigate to the KOA log in page. From there, KOA has forms where you specify the data to retrieve and will create a tar ball for you to download.

A useful tool is the file translator script that will convert your KOA file names to the standard filenames as they were written to disk during your observing session (koa_translator). Again, your filenames must preserve the standard naming convention and the koa_translator script does this for you.
A useful tool is the [KOA file translator script](https://www2.keck.hawaii.edu/koa/public/koa_translator) that will convert your KOA file names to the standard filenames as they were written to disk during your observing session (`koa_translator``). Again, your filenames must preserve the standard naming convention and the `koa_translator` script does this for you.

If you do not have data of your own and wish to download the example:
Grab the data from: [https://www2.keck.hawaii.edu/realpublic/inst/mosfire/DRP_Test_Case_Hband.zip](https://www2.keck.hawaii.edu/realpublic/inst/mosfire/DRP_Test_Case_Hband.zip).
Expand Down