COS Tools

The Cosmic Origins Spectrograph was successfully launched, installed, and turned on and the data have started rolling in. As someone on the front lines of this new and exciting instrument, I've had to deal with a lot of the quirks and oddities of the data being produced. I've devised several IDL codes which makes dealing with my data easier and post them here so that you may learn from the experience my colleagues and I have accumulated. I hope you find them useful.

Most of these routines start with the x1d.fits files produced by CalCOS. If you download data from MAST, this is what you get. The reduction might even be correct. However, if you're looking for advice on how to reduce your data most optimally using CalCOS, this is not the place for it. Sorry.

IDL routines

There may be some dependencies in the code which I have not caught. All routines assume you've got ASTROLIB installed and many other useful routines can be found in the GHRSLIB and JHU/APL libraries. If you find something in the codes which doesn't appear in any of those libraries, please let me know and I'll see what I can do.

COADD_X1D.pro (latest version: 12/14/10)

Combines a set of far-UV COS exposures into single wavelength/flux/error vectors. A lot of work has gone into this code and it does a lot of things above and beyond a simple coaddition.

  1. reads in a set of far-UV (G140L, G130M and/or G160M) x1d.fits files,
  2. removes major flat-field artifacts (shadows from ion repeller grid wires) from the flux vector and modifies the error and exposure time in these pixels,
  3. modifies error/exposure at the edges of detectors to de-weight these regions,
  4. cross-correlates individual exposures and interpolates onto a common wavelength vector,
  5. combines the data pixel-by-pixel using various methods,
  6. saves and plots in several exciting ways.
Please note, the current method=1 keyword uses a modified exposure time weighting (see notes in the code) which we believe to be the best available option.

Note that the code requires specific versions of several common codes, including the version of LINTERP.PRO which is part of the ASTROLIB library. The version distributed with GHRSLIB does not work. If you get errors saying "Keyword 'missing=0' not allowed in LINTERP", this is likely your problem. Check the order your IDL libraries are loading.

This routine requires several other routines and auxiliary files, so I provide them all as a convenient .tar file.

COS_INSPECT.pro

This is a quick-and-dirty routine to display the wavelength/flux/error vectors in a set of far-UV COS x1d files. This is a good way to see what you've got, check for grossly-bad CalCOS reductions, and take a first look at the data.

COS_LSF.pro

On-orbit observations have revealed that the COS line spread function (LSF) is not the ideal Gaussian profile. Instead of a 6.5 pixel FWHM, the profile is more like 7.9 pixels FWHM and up to 40% of the light falls in the wings. Mid-frequency wave-front errors in the HST primary mirror are the culprit. The LSF is asymetric and dependent upon both wavelength and grating. For much more on the subject, please see the STScI ISR on the subject.

However, the LSF has been characterized and can be easily accounted for in analysis. STScI gives the LSF in tabular form, but, for speed's sake, I have converted it into a binary save file COS_LSF.idl which you will need to run my routine. COS_LSF.pro produces the modeled LSF for a given wavelength and grating for both far- and near-UV detectors. I have had good success convolving the LSF with gaussians, voigt profiles, and so forth in absorption line fitting.

If you find this stuff useful, I'd love to hear from you!


Charles Danforth
Last modified: Tue Dec 14 20:29:07 MST 2010