Offline CGS4 Data Reduction

Offline CGS4 Data Reduction

Introduction

This guide is not meant to be a complete cgs4 data reduction manual. It outlines the steps a typical UKIRT/CGS4 observer will want to carry out on their data after the observing run. These steps could be carried out using many different data reduction packages, for example starlink or IRAF.

I will assume that you have a nightlog file from the orac-dr pipeline, and that you have the _wce files for each science frame, which will consitute the starting point for this guide. I will also assume that the _wce files you have have been processed satisfactoraly by the pipeline, and have been flat-fielded. This will usually be the case.

Stage 1: co-add into groups.

With reference to your nightlog, select the _wce files that consitute each “group” of observations. A group would typically be an observation of one target at one instrument configuration.

Inspect each of these frames and check for any obvious defects. If you discard and frames, be sure to discard the same number of main-beam and offset-beam frames. The main-beam frames will have 0,0 as the RA and DEC offsets in the nightlog, the offset-beam frames will typically be 11.74 arcsec away from 0,0. If you were nodding to blank sky, the offset will be much larger, and the offset-beam frames will also be SKY frames.

Form a group frame which consists of the sum of all the main beam observations minus the sum of all the offset beam observations.

Do this for each group of observations you are going to reduce at this time. You should at least have a standard star group and a target group at this point.

In these group files, the “sky” areas should be relatively free of sky-lines. Sky line residuals up to a few tens of counts can be removed (see later). You should have a positive band acorss the image representing the positive image of the spectrum of the target. If you were nodding along the slit, you should also have a negative band across the image representing the offset-beam negative image of the target spectrum.

If your observations spanned a long time interval, ie a large change in position of the telescope as you tracked the object across the sky, then you should consider adding your observations into “sub-groups” of an hour or so’s data, extracting the spectra from each of these seperately, then doing a cross-correlation to determine any shift due to instrument flexure, and applying this shift before adding the spectra together

If you wish, at this point, you can subtract off the residual sky lines. Use your favourite DR package. You should mask off the areas of the image containing the target spectra, then have the package fit a low order polynomial to the residual sky flux in each column. The polynomial fit should then be subtracted from the whole image, including the areas where the target spectra are, obviosuly.

Stage 2: Extracting the spectra

Extract the +ve and -ve images of the spectrum seperately. You can use optimal extraction if you like, and if you used the same nod distance for the standard star, you can use the standard star observations to generate the profiles with which to optimally extract the target spectra. After you extract the -ve spectrum, multiply it by -1 to make is positive. Keep the profiles that you use around for later use.

Check for a shift between the specta. This needs to be done on something bright; I suggest doing it only on the standard star spectra, however if your target is brighter than your standard (you might have been doing monitoring, or looking for weak lines on a strong continuum etc), then you could do it to the object spectra too.

Basically, cross-correlate the main-beam and offset-beam spectra. If you get a shift of more that say 0.2 pixels, shift the offset beam spectrum to match the main-beam spectrum. If you’re only measuring this from the standard star spectra, apply the same shift to the offset spectrum from the target data too.

Add the main and offset beam spectra together. This forms the “observed spectrum” of each object (be it the standard star or your target).

It’ll probably keep things simple if you normalise each spectrum by its exposure time at this point.

Stage 3: Wavelength Calibration

You’ll have noticed that the data allready have a wavelength scale. This is approximate – it’s from an estimation based on the cgs4 motor positions. You should now do an accurate wavelength calibration using the arc spectra you took.

Look at the nightlog file and find the _wce frame for the arc-lamp observation you’re going to use. This will normally have been taken shortly before the 1st standard star at that confiuration. If several are availiable, use the one at closest telescope position to where your target was observed, to minimise effects from instrument flexure.

Extract a spectrum from the arc frame, using the same rows you used for the target frame main-beam. If you did an optimal extraction, use the same profile as you did for the main-beam.

Use the arc-lamp maps on the web to identify the lines in your arc spectrum. Use the wavelength calibration routine in your data reduction software. The principle of these routines is that you tell the software the exact wavelength of a number of lines. The software measures the position of the peaks of these lines and comes up with a function to relate the wavelength to pixel number. You should use as low-order function as gives a reasonable fit. A 3rd order polymonial is usually sufficient, though 5th order is sometimes useful, especially if you have a large number of identified lines in your arc spectrum.

Apply the calibration you’ve just generated to the target and standard star spectra you extracted earlier.

Stage 4: Flux calibration

There are many ways to do this. This what I do for a reasonably simple case

Create a black-body model of the standard star

Look up the spectral type of your standard star. Each spectal type corresponds to a black body temperature. There’s a table of these on the ukirt web pages. Have your DR software generate a black body spectrum at the appropriate temperature, on the same pixel and wavelength scale that your standard star is on.

Next, deduce the flux of your standard star at some wavelength which is on your spectrum. Usually you’d use the band centre, and you’d deduce the flux from either the known magnitude of the standard in that band, or the magnitude in some other band, determining the colour from the spectral type. Scale your black body spectrum so that it has the correct flux at this wavelength.

Create a sensitivity spectrum

Take the black body spectrum you’ve just made (which you’ve scaled to be in flux units, say W/m2/um), and divide it by the “observed spectrum” of your standard star (which is probably in counts per second or similar). This gives a sensitivity spectrum – ie the value at each wavelength is the flux needed to produce 1 count per second at that wavelength.

BUT, there’s a small problem in that the standard star probably doesn’t really have an exact black-body spectrum. It more than likely has some lines in it. You should be able to identify these lines in the sensitivity spectrum. Ask a local expert or your support scientist if you’re not sure. Different types of star have different lines. try starting off looking for hydrogen recombination lines.

When you find a feature in the sensitivity spectrum that you think arrises from a line in the star, interpolate over it using the “continuum” either side of it.

Apply the calibration

Simply multiply your sensitivity spectrum by your “observed spectrum” of your target, to get a flux calibrated spectrum of your target.