Getting Quick-Look Spectra with qccds
John Thorstensen, Dartmouth College
2009 March 14 - Revised 2012 September
Why and What:
It's obviously useful to be able to see the spectrum you just took --
you can see if you have the right object, if the signal-to-noise looks
adequate, and so on. Maybe there's an unexpected feature -- better
to confirm it right away than be wondering weeks later whether it's
real or not.
The program qccds.py
does the following for a CCDS stellar spectrum:
- Copies the data to a local directory
- Subtracts the bias
- Produces a sky-subtracted, optimally-extracted spectrum.
- Optionally applies a wavelength calibration (if available);
- If your spectral range includes a suitable night-sky line, shifts the spectrum
so as to zero
out the night sky line's apparent velocity.
Note that the script leaves the original data untouched -- you
needn't be afraid of it screwing anything up.
Note added 2012 September:
These instructions are updated for
the servers installed in 2012 August (mdm24ws1, etc.). I was able
to test the basic functionality, but not the wavelength calibration.
My guess is the wavelength calibration will work, but I think there's
a good likelihood that the zeropoint shifting based on a night sky
line will take some more debugging.
Quick Instructions:
You should be logged on as obs24m or obs13m, as appropriate.
Hints on extracting spectra If you're in an uncrowded region,
you should be able to run the task with handap ("find
aperture by hand?") flag set to NO -- it should find the object
on the slit and extract it without further intervention. But
this often goes wrong, and you have to set the flag to YES so
you can intervene.
The spectra are extracted by the IRAF task apall, and if
you're an expert on that you should be all set. In case you're not,
here's what's happening. You'll be asked lots of questions, for
which the default answer ("yes") is usually what you want. For
those questions you just
hit enter, sometimes in the original window,
other times in the graphics window that pops up.
The first thing you'll do is specify an aperture to
extract, that is, the range of CCD rows in which your
object falls. Here are the relevant commands:
- d - Delete the aperture nearest the cursor. Needed
if the program locked onto the wrong object.
- m - Mark this object, i.e., put an aperture on the
object nearest the cursor.
- z - Automatically adjust the width of the aperture.
- l and u - mark lower and upper limits of the
object aperture respectively
- r - Replot to see your changes.
- b - Edit the background regions (they're indicated by
the horizontal bars at the bottom of the display). Useful
if there's a bright object in the background region.
This has its own subcommands:
- wa - "window all", expand the viewport to the whole
picture. Also useful are wt (set top of viewport to
location of the horizontal cursor, wj and wk
(for left and right limits respectively).
- t - delete the current background limits
- s (4 times) - mark the new background limits; use
twice to the left, twice to the right, to establish new windows.
- f - Fit the background so you can see if it's reasonable
- q - At this level, Quits from the background customization.
Note that the background subtraction is iterated a couple times
to clip discrepant points; a weak source in the background is
not a cause for concern. In the f command you may
see some points marked as rejected.
- q - quits aperture editing.
As you go along the dispersion, the location of the object's
spectrum does not remain exactly constant, so
after you've specified the aperture, the program will ask if
you want to trace the aperture to follow these
deviations. The trace should be pretty straightforward, but
there are some options if you want to use them:
- d - Delete the point nearest the cursor.
- f - Fit the trace again.
- :f - Change the type of function that's fit; options are
- leg - legendre polynomial
- spline3 - cubic spline
- :o 3 - Change the order of the fit function (to 3 in this
example). The interpetation depends on the type of function you're
fitting:
- For a legendre, it's (weirdly!) the number of coefficients you have,
so 1 is a constant, 2 is a straight line, 3 is a parabola, etc. -- the
iraf "order" is larger by 1 than the conventional meaning of
a polynomial order.
- For a spline3, it's the number of sections of cubic you're fitting.
If you have a very faint source, you'll want to go to a legendre 2
or even a legendre 1 to avoid following noise.
- q - as usual, quit the interactive fitting.
General remark on spectrum extraction: As noted earlier, qccds
extracts the spectrum by driving the iraf task apall.
Apall has a huge number of parameters; qccds sets these to
reasonable defaults, basically putting ease-of-use ahead of
flexibility. Remember, this is only for quick-looks.
If you have strong emission-line sources, you may do better
in the apedit if you find what column the line occurs in, and
use that as your displine.
Wavelength Calibration: You can apply a pre-existing wavelength
calibration to your quick-look spectrum. Here's how:
- Take some lamp spectra. If you run qccds on it as best as you can,
it will at least copy it over and bias subtract it. You will want to
strip out a one-d spectrum using apall, with the background
to subtract set to "none".
- Fit the lamp spectrum using the iraf task identify. This is
a big subject and often is somewhat tricky.
- If you've fit the comp spectrum in some directory other than your
quicklook directory, you'll need to copy the following into the
quicklook directory:
- The calibration spectrum you've used, e.g. x0123.0001
- A subdirectory called database containing the calibration fit.
This will be in a file which has the same name as the calib image, but
with id prepended; in our example it would be idx0123.0001.
- The extracted spectrum will be called, e.g. dx0234.fits, where the
d stands for "dispersion corrected."
Adjusting to zero using a night-sky line: This should
work provided your spectral range has a strong night-sky line
like [OI] 5577. It uses my own emission line centroiding task
to find the center of the night sky line you specify, in the
third band of the multispec (see above). It then shifts the solution
to zero out the night sky line's velocity. The task can fail if the night-sky line
is overwhelmed by background (e.g. in twilight), or if the night-sky
line is many pixels away from where the wavelength solution says it
should be (e.g. if the grating slipped, or something).