Cookbook for Keck/LRIS Reductions
BACK
This page describes the types of calibrations recommended
(or required) to use the Low-Redux pipeline to reduce data
acquired with the longslit Kast spectrometer.
Calibrations:
AFTERNOON+TWILIGHT: The following table summarizes the recommended calibration
exposures for the grisms+gratings supported within the Low-Redux pipeline.
Binning: For the blue-side observations, we
present values assuming binning 2x2 (spatialxspectral). We recommend
this level of binning when using the 1200 grism to reduce the readnoise
by a factor of sqrt(4)=2. For a 1" slit, binning by 2 in the spectral
dimension implies a sample of 4 pixels.
The spatial plate-scale on the blue-side is 0.135" per native pixel.
Therefore, 2x binning will lead to Nyquist sampled seeing only for
FWHM ~ 0.6".
Flat fielding: Our approach for flat fielding these
spectroscopic observations is to divide up the flat fielding
into a pixel-flat which represents the intrinsic pixel-to-pixel
response variations of the CCD (i.e. the
response to a smooth source), and an illumination flat,
which represents the larger scale illumination variations due
to non-uniformities in the width of the slit, vignetting, etc.
This separation is clearly not perfect, but our experience is
that the illumination flats significantly improve sky subtraction.
The pixel-flat for the blue-side is constructed in a novel manner
for the high resolution grisms.
One observes the twilight sky
with the grism in place but without a slitmask (i.e. "direct").
This smears the solar spectral features sufficiently that the
flat can be properly normalized before applying a
pixel-to-pixel correction. We use the twilight sky because
the internal and dome lamps both emit too little UV light.
Although one might record a few thousand counts with these lamps,
we have confirmed that this is dominated by scattered red
light (e.g. one observes fringing!).
For the red side, dome flats are better than internal flats for
correcting the pixel-to-pixel variations because they reduce the
level of scattered light. However, one may desire to take internal
flats on the sky during the night (or twilight) to remove fringing.
The same dome flats can be used for the illumination correction
although observations at twilight may be preferable.
Blue Side Calibrations (2x2 Binning) |
Type |
Grism |
Lamp(s) |
Slit |
Exp |
NExp |
Notes |
Arc |
Any |
All |
1" |
3 |
2 |
IMPORTANT: One should wait ~5min for the Zn+Cd lamps to warm up.
|
Illum+PixelFlat |
300/5000 |
Twilight |
1" |
10 |
5 |
Keep peak under 40,000 DN. This set of exposures is
used for both pixel-to-pixel and illumination calibration.
WARNING: This procedure is not well tested. |
IllumFlat |
600/4000 |
Twilight |
1" |
XX |
3 |
Take very near sunset (or sunrise).
Aim for peak counts of ~30,000 DN |
IllumFlat |
1200/3400 |
Twilight |
1" |
XX |
3 |
Take very near sunset (or sunrise).
Aim for peak counts of ~30,000 DN |
PixelFlat |
600/4000 |
Twilight |
None! |
XX |
3 |
Slitless. Take very near sunset (or sunrise).
Aim for peak counts of ~30,000 DN |
PixelFlat |
1200/3400 |
Twilight |
None! |
XX |
3 |
Slitless. Take very near sunset (or sunrise).
Aim for peak counts of ~30,000 DN |
Red Side Calibrations (1x1 Binning) |
Type |
Grating |
Lamp(s) |
Slit |
Exp |
NExp |
Notes |
Arc |
Any |
All |
1" |
1s |
2 |
|
Illum+PixelFlat |
300/7500 |
Dome/Spec |
1" |
8 |
7 |
Keep peak under 40,000 DN. This set of exposures is also
fine for pixel-to-pixel calibration. |
Illum+PixelFlat |
600/7500 |
Dome/Spec |
1" |
30 |
7 |
Keep peak under 40,000 DN. This set of exposures is also
fine for pixel-to-pixel calibration. |
Illum+PixelFlat |
600/10000 |
Dome/Spec |
1" |
240 |
7 |
Keep peak under 40,000 DN. This set of exposures is also
fine for pixel-to-pixel calibration. |
Illum+PixelFlat |
1200/7500 |
Dome/Spec |
1" |
50 |
7 |
Keep peak under 40,000 DN. This set of exposures is also
fine for pixel-to-pixel calibration. |
TWILIGHT+NIGHTTIME: In addition to these calibrations, if one wishes to flux the
spectra it is necessary to observe a spectrophotometric standard
with the same instrument configuration. Furthermore, it is
best if one chooses from the CALSPEC list of standards which can
be found here: $XIDL_DIR/Spec/Longslit/calib/standards/calspec
Organizing the Data
The first steps are to organize your data, create a plan file,
and edit it as necessary.
- Organize the data
- Create a 'Raw' directory -- mkdir Raw
- Place all of the Raw frames in the Raw directory
- gzip the files (optional)
- Create the plan file
- Launch IDL from above the Raw directory
- Run long_plan :: This
code parses the headers of each raw file and creates an ASCII file
which summarizes the data. It attempts to guess the 'type' of
each frame (e.g. arc, domeflat, science).
Example: IDL> long_plan, '*.fits*', 'Raw/'
- Edit the plan file (default: plan.par)
- Consider copying plan.par to a new file
- For longslit observations, 'slitthresh' is automatically
set in the code to be 0.10. For multislit observations you may
specify your own value of 'slitthresh' by including this parameter
in the plan file. The default for multislit observations is
currently 0.02. For short slits, lower 'slitthresh' as necessary.
- Edit 'maxobj' as needed. This sets the maximum number of
objects found per slit. For multislit observations, change to 2
to prevent lots of spurious objects from begin found.
- Edit 'reduxthresh' as needed. This is another parameter which is useful for controlling the identification of spurious objects. The code will only keep objects as bright as (reduxthresh)*(brightness of brightest object) in each slit.
- Remove unwanted images from the .par file.
- Inspect and edit the image types for the various exposures. (Listed in column 3 in the plan file)
For the LRIS spectrometer there are 5 types of interest:
Type |
Description |
arc |
Exposure of the arc lamps taken with the instrument
configured for spectroscopy (slit + dispersing elements).
|
domeflat |
Flats used to calibrate the pixel-to-pixel variations
in the CCD. Blue side: At high dispersion (600 or 1200 grism), one
should observe the twilight sky without a slit. This is the only means
of getting enough blue counts in a spectrum that does not have sharp
features. At lower dispersion (300 grism), one can acquire a dome flat.
Red Side: One obtains 'standard' dome flats.
Note: The code currently attempts to distinguish between domeflats and twilight flats by considering the time the exposures were taken and the position of the dome slit relative to the pointing. There is no header keyword that specifies the dome lamps being on or off. Therefore, pay extra attention to these files to make sure they are labelled correctly.
|
twiflat |
Flats used to calibrate the larger scale variations
(i.e. greater than 5 pixels) in the illumination pattern of the CCD.
Spectrum of the twilight sky through the longslit or slitmask.
|
iflat |
Flats used to calibrate the pixel-to-pixel variations in the CCD. Domeflats are always preferred to minimize scattered light, but internal flats can be used if necessary.
|
bothflat |
If the user specifies this designation,
the flat image will used for both pixel and illumionation corrections
(i.e. it will be treated as a domeflat and a twiflat simultaneously).
This is useful in cases where twiflats were not taken and the user
wishes to make an illumination correction. One should ALWAYS use this
option when reducing red side data taken with the 600/7500 grating--
replace 'domeflat' with 'bothflat' in the plan file.
|
science |
Spectrum of an astronomical object.
This includes 'standard stars'.
|
std |
If the user specifies this designation,
this frame will be used as a crutch for tracing other objects.
The frame should be reduced BEFORE it is included as a crutch.
|
- Insure that the necessary calibration files exist.
Files of 'arc' type are always needed. In addition, it is
ideal to have both domeflat (or iflat) and twiflat files for each
grating/grism/slit combination; this gives the best calibration of
pixel-to-pixel variations in the CCD and illumination function.
One exception is in the case of Red Side 600/7500 data-- here only
the domeflat should be used, and the label should be changed to
'bothflat'. Additionally, in general if only domeflats are available, these may be used for both the pixel-to-pixel calibs and the illumination calibs by changing the 'domeflat' type to 'bothflat' in the plan file.
Reduce!
All of the reduction steps are run by the code
long_reduce
Example: IDL> long_reduce, 'plan.par'
This routine:
- Stacks and process the flats
- Identifies the edges of the longslit
- Calibrates the various arc images
- Processes the science frame (flattens)
- Finds/traces objcets within the slit
- Extracts using a non-parameteric optimal extraction algorithm
The correct sequence for setting up the reductions is as follows:
- The blue-side calibration takes a bit more work than the red side.
- First you need to make a separate .par file that includes all images of the sky without a slit mask (name this file slitless.par).
- Edit the image types of these observations to all be "domeflat"
- Run long_reduce with your slitless.par file
- In your plan.par file insure that you include one of the files that you used in your slitless.par file, again insuring that its image type is changed to "domeflat".
- Run long_reduce with your plan.par file. Be sure to include your twilight flats that were taken with the slit in labelled as "twiflat".
- The Redside is much simpler, you only need to use the dome flats. Be sure to change the file types in your plan.par file to "bothflat"
The pipeline outputs the following calibration files:
Name |
Description |
pixflat-xxx |
FITS file generated from the domeflats which corrects for
pixel-to-pixel variations in the CCD.
|
illumflat-xxx |
Flat frame used to correct for imperfections in the slit
width along the slit-length.
|
profile-xxx |
Binary FITS table containing the object profile used
for optimal extraction. In particular, the tag .profile contains an
image of the profile.
|
slits-xxx |
Binary FITS table containing the parameters which
describe the slit edges.
|
wave-xxx.fits |
FITS image of the wavelength array created by the code.
|
wave-xxx.ps |
Postscript file showing the results from the 1D arc
solution.
|
Tip: If you have longslit science frames with no bright objects in the
slit AND if you have standard star data, it is a good idea to re-run
long_reduce after deleting the science frames and keeping the reduced
standard frames. You can also do this if you are working with
multislit data. Re-run like this:
Example: IDL> long_reduce, 'plan.par', filestd='Science/std-lred0044.fits.gz'
This will use the standard star frames as a first guess at the trace when extracting faint objects from your science data.
IMPORTANT: Check the reduction.
Check the reduction as the pipeline progresses.
- As soon as the slits-XXX file is produced, check the following:
- Were all the slits found? If not, the code may have combined
two slits into one, for example. This can cause many problems
(e.g., a wavelength solution failure). To discourage the code
from doing this, you can reduce the 'slitthresh' parameter
in the plan file; the default value for multislit masks is 0.02.
- If one particular slit is causing trouble that cannot be
fixed by changing slitthresh, you can use the code
'long_fiddleslit' to completely remove it:
Example: IDL> long_fiddleslits, 'slits-XXX.fits',
REMOVE=(slit number to remove), WAVE_FIL= 'wave-XXX.fits'
- Sometimes, no matter what you do with
'slitthresh', the pipeline still fails to find all the
slits. (This is rare.) If you need to add a slit into your
slitmask, you can use the ADD_SLITS keyword. Just make a file
with two columns, where the first contains the x value at the
start of the new slit, and the second contains the x value at the
end of the slit.
Example: IDL> long_reduce, 'plan.par',
ADD_SLITS= 'add_slits.txt'
- Yet another slit-adjustment keyword is COMBINE_SLITS.
This allows you to combine two adjacent slits into one:
Example: IDL> long_reduce, 'plan.par',
COMBINE_SLITS=[slitnum]
Here, 'slitnum' has the lower slit ID number of the two
you want to combine.
- At this point, you may also check for overlapping
slits. This will be easier to see in the final science images,
however. See below for options for dealing with this problem.
Remember that the slit edges affect every part of the
data reduction, so make sure that if you remake the slit file, have
the code remake everything else as well! (You can use the /CLOBBER
flag for this with 'long_reduce', but use with caution-- if you have a standard star
frame in your plan file, it will get re-reduced with the slitmask
calibration files-- and you don't want that!)
- As soon as the wave-XXX.ps file is produced, check the
wavelength solution! For each slit, check that there aren't large numbers of lines
that weren't identified, and check that a few lines are not
significantly affecting the fit. If they are, you can:
- Remove (or comment out) individual lines from your lris_red[or
blue]_XXX.lst file.
- Re-run long_reduce to tweak the solution for a particular
slit:
Example: IDL> long_reduce, 'plan.par',
TWEAK_ARC=[slitnum]
This will launch a fun GUI, and rewrite your wave-XXX.* files
after you re-fit:
- Put in values for a 'SHIFT', and a
'STRETCH' if needed.
- Click 'APPLY'
- Hit 'L' to see all the lines labelled
- Hit 'F' to perform the fit
- Hit 'R' to see the fit residuals
- 'q' saves the new fit and quits
Primary Science Product
The primary science products are written a multi-extension
FITS file in the Science/ directory. One file is written
per exposure. This table describes the various extensions:
Extension |
Description |
0 |
Processed 2D image of the data.
|
1 |
Inverse variance |
2 |
Sky model |
3 |
Model of the object flux |
4 |
Mask of good/bad pixels |
5 |
Structure array (one per object identified in the
slit). The key tags are: wave_opt, flux_opt, ivar_opt, wave_box,
flux_box, ivar_box.
|
One can examine the 1 and 2D spectra extracted from each
data frame using the following steps:
- cd Science
- UNIX> idl
- IDL> .run long_look
This will launch a GUI list of all the sci-*.fits.gz files in the
current directory.
- Choose the sci-* file that you want from the GUI list
This will launch a view of the 2D image (using the IDL task atv).
After completing the step described below, you can use this Image display
GUI to examine the 2D spectrum.
A postscript file summarizing the S/N of the various extracted spectra is shown
and also a GUI list of the objects in the frame indexed slit-object
(e.g. 1-2 for slit 1 and object #2 in the slit).
- Choose an object from the GUI list
This will launch an x_specplot GUI that the user can use
to examine the 1D spectrum. At this point the xatv window will now
be active. The wavelength of the cursor position is printed in the
xatv window next to the pixel number.
- Play with the two GUI's.
IMPORTANT: Check your science frames.
Here are some problems/issues you may encounter when checking out your final reductions.
- Overlapping slits or funny slit edges-- you have a couple of options:
- Re-run the full reduction, trimming all of your slit edges
Example: IDL> long_reduce, 'plan.par',
TRIM_SEDGE=npix (where npix = the number of pixels to trim from
each edge)
Note: if you use this keyword concurrently with ADD_SLITS, the new
slits that you add in will not be trimmed.
- If you feel you must be more aggressive about removing slit overlap, you can try:
Example: IDL> long_reduce, 'plan.par',
EDIT_SEDGE_FIL=filename
Here, EDIT_SEDGE_FIL is a text file with 5 columns:
- The x value near the middle of the problem slit
- '1' for the left edge of the slit, or
'2' for the right edge
- The number of pixels to trim from that particular edge
- Pixel number (in y direction) where you want to start
the adjustment
- Pixel number (in y direction) where you want to end
the adjustment
This file must be made by hand while examining the science
reduction. You may also run 'long_reduce' including
both the TRIM_SEDGE and the EDIT_SEDGE_FIL flags at once.
TRIM_SEDGE will only affect slit edges which are NOT being
modified by the EDIT_SEDGE_FIL.
- If you notice horizontal stripes across some slits:
This is likely because a particular slit contains a very wide object but is itself quite narrow. This means that to fit the sky, the code is being forced to use pixels very close to the slit edges. This can cause ringing in the bspline fit to the sky. Our best fix so far is as follows:
- Turn off local sky subtraction for particular problem slits:
Example: IDL> long_reduce, 'plan.par',
ISLIT=slitnum, /NOLOCAL, ONLYSCI=exposure ( 'exposure ' is
something like 'lred0072.fits ')
This will make a new sci-XXX.fits file, retaining the previous reduction of all the other slits but replacing the reduction of the problem slit with the new version.
- You may also want to re-run your reduction, including a standard
frame for the code to use as a crutch:
- Make sure the standard frame has been reduced (with its own
plan file)
- Include the frame in the science plan file, making sure
that it's labelled a 'std'
CAUTION: One can do this for only one slit using the ISLIT
flag, but make sure you include the /ONLYSCI flag as well, or the
standard frame will get re-reduced!
Example: IDL> long_reduce, 'plan.par', ISLIT=slitnum, ONLYSCI=exposure
Coadd
As you will note, the multi-extension FITS file that contains
the spectra are not especially easy to handle. Furthermore, it
is common that a user will wish to coadd multiple exposures of
a given object. This is accomplished with the task
long_coadd :: This
routine takes as input a list of sci- files and a corresponding list of object ID numbers, chooses a
wavelength array for registration, and coadds weighting by the
square of the median S/N ratio (or exposure time).
Call: IDL> long_coadd, files, objid, OUTFIL=name
Example: IDL> long_coadd, ['sci-b263.ccd.gz', 'sci-b265.ccd.gz'], 1, OUTFIL='FSpec/J0905+1014_b.fits'
In the above example, we have set objid=1 to indicate that we wish to
coadd the first object identified in the slit. But we could have set
objid to [3,4] if we wanted to coadd the 3rd object from the first
science frame and the 4th object from the second science frame. The
output file (e.g. FSpec/J0905+1014_b.fits) is a multi-extension FITS
array containing three extension: 0=flux array; 1=sigma array;
2=wavelength array.
One can inspect the data using the XIDL routine x_specplot.
Example: IDL> x_specplot, filename, inflg=2
Flux
Fluxing is relatively straightforward. One includes a calibration
standard in the plan.par file and the code will reduce the data
in a similar fashion as the science exposures. One does NOT apply
the COADD algorithm, but skips to this task
long_sensfunc :: This
algorithm requires that one use one of the standards included
in the Longslit package (contact JH or JXP to add a new file).
These files are found here: $XIDL_DIR/Spec/Longslit/calib/standards/calspec.
WARNING: Most of these standards are only calibrated to 9200A and the
code will truncate the data at larger wavelength.
Call: IDL> sens = long_sensfunc( sci_file, sens_file, std_name=std_name)
Example: IDL> bsens =
long_sensfunc('Science/std-lblue1022.fits', 'Flux/feige34_bsens.fits', std_name='feige34_005',/MSK_BALM)
Note that you are recommended to mask the balmer lines. With a sensitivity function in hand, the final step is to apply
it to the science spectra. This is accomplished with
long_fluxcal :: This
code simply notes the exposure time and applies the sensitivity
function. It also corrects for differences in the airmass of the
two exposures assuming an extinction function appropriate for KPNO.
Call: IDL> long_fluxcal,
coadded_data_file, SENSFUNCFILE=sens_file, OUTFIL=fluxed_data
Example: IDL> long_fluxcal, 'FSpec/J0905+1014_b.fits', SENSFUNCFILE='Flux/feige34_bsens.fits', OUTFIL='FSpec/J0905+1014b_XF.fits'
One can inspect the data using the XIDL routine x_specplot.
Example: IDL> x_specplot, filename, inflg=2
Note that the fluxed spectrum is in units of F_lambda, and needs to be multiplied by a scaling factor of 10^17.
Last modified 2010-04-02