Here the rctnight script is used to get reduced images starting from raw data...
First of all, suppose the raw data from one or more nights of observations is sitting in a directory:
/archive/data/Suppose we believe that to reduce an object image, it is necessary to first subtract an overscan bias, then subtract a residual 2-D bias pattern, then divide by a flat field. Assume one doesn't have bias or flatfield images produced on a previous night that can be reused. Then, the first thing to do is to reduce the bias images and combine them (you'll need at least one for each type of CCD readout mode used). Next, the flat images can be reduced, combined, and normalized (at least one for each filter and CCD readout mode used). Finally, the object images can be reduced.
We'll put the new calibration data in this directory:
/home/user/projectX/calibration_data/...and the new object images in this directory:
/home/user/projectX/images/We can store the scripts parameter files in a third directory:
/home/user/reduction/scripts/One can be in just about any directory when we run the script provided that the rctnight executable can be located by the user's shell and sufficient pathnames are provided for the script to find files such as the parameter file.
To do the data reduction, all we need are three parameter files for the three steps (make master biases, make master flats, and then reduce object images). Then we can call the rctnight script 3 times in the proper order.
For most anticipated data reduction and our example, the most important parameter to set in each of these parameter files is 'obstype' which ensures that only a certain type of image is reduced and/or combined in that step. The obstype parameter refers to the raw images, of course, and not any calibration images applied to them (e.g., a flat will normally be used to reduce object type images). To make master biases, only images with an OBSTYPE keyword for biases are used. The situation is similar for flats or object images.
Here is a good parameter file to produce the 2-D (residual) bias pattern images and then combine them:
observer all propi all date all obstype bias object all filter all exptime all clocking all ccdsum all gain all mppmode all project ProjectX filename *.fits outputnames prefix r osbias y fit mean order 0 osrej y osrejtype minmax trim y twodbias n twodname not_used subdark n darkname not_used flatten n flatname not_used document y combine y scaletype none combtype average rejtype minmax numlow 1 numhigh 1 lowsigma 2.5 highsigma 2.5 normalize no comboname combias
Suppose this parameters file is called:
/home/user/reduction/scripts/makebias.parsStart the reduction by saying:
rctnight /archive/data/ /home/user/projectX/calibration_data/ \ /home/user/reduction/scripts/makebias.parsHere we have supplied rctnight with 3 arguments: the input data directory, the output data directory, and the parameters file. The script first gives the user a listing of the parameters it has read from the parameters file, providing an opportunity to edit them at the last moment. Once the user accepts the parameters, the script will find all bias frames with filenames matching *.fits in the /archive/data directory whose PROJECT keywords match 'ProjectX'. It will organize these bias frames into groups of images taken in the same manner (same readout mode). It automatically picks filenames for the reduced images by prepending an 'r' onto the corresponding raw filenames. Finally it creates names for the combined bias images (one for each grouping of bias frames) using the root word 'combias'.
Next, the script presents a file to the user in his favorite text editor (like emacs or vi). The editor (command) used can be specified if the user sets the environment variable RCTEDITOR to 'emacs' or 'vi', etc. The file lists out the groupings of bias images found matching the specifications and tells the names it has picked for the combined bias images. The combined image filenames for each list is given on a line starting with 'combo ='. You can change the name of the combined (output) image by editing this file. The script won't overwrite any existing image files, even if you tell it to do so. If reduced images with the same names that the script attempts to create already exist, but the script can find a new name for a combined image, the new combined image is created using the pre-existing images.
When the user exits from the editor, the script starts working according to the parameters chosen. In addition to making the bias frames, a few files are written. A log file is produced and written in the output data directory (/home/user/projectX/calibration_data/). Files listing the input and output names are written and put in the same directory.
When editing the file of lists of images, the user can delete images from the lists to prevent certain images from being reduced (by commenting out or deleting the corresponding line in the file).
Now that (hopefully) you have trimmed, "residual" bias images for each readout mode used when flats were taken, you can now reduce the flats using a parameter file like this:
observer all propi all date all obstype flat object all filter all exptime all clocking all ccdsum all gain all mppmode all project ProjectX filename *.fits outputnames prefix r osbias y fit mean order 0 osrej y osrejtype minmax trim y twodbias y twodname /home/user/projectX/calibration_data/combias* subdark n darkname not_used flatten n flatname not_used document y combine y scaletype mean combtype average rejtype minmax numlow 1 numhigh 1 lowsigma 2.5 highsigma 2.5 normalize yes comboname comflatRun rctnight as before, but supply the name of this 2nd parameter file. This time, since a calibration image is used in the data reduction (a bias pattern image), when you get to the point of editing the list of flats to combine, you will be presented with the name of the bias image the script has chosen to subtract from each image. If there was more than one suitable bias image found by the script, these will also be presented in the editor but will be commented out with a '#' at the beginning of the line. You can uncomment or delete lines to make the script pick whichever bias image you want to use. Make sure only one bias image is paired with each list of flats. You can also edit the name of the bias image to point towards a specific, existing image, even if it isn't listed. Note that if you expect to find multiple bias images of the same type in the directory containing calibration data, you can help the script find the one you really wanted to use by supplying a unique name or name template for the parameter twodname, e.g.:
twodname /home/user/projectX/calibration_data/combias*Now there should be both residual bias pattern images and flats for each readout mode and filter combination observed during the night. You can reduce the object images using a parameter file 'makeobjects.pars' like this:
observer all propi all date all obstype object object 'NGC 4565' Jupiter filter all exptime all clocking all ccdsum all gain all mppmode all project ProjectX filename *.fits outputnames prefix r osbias y fit mean order 0 osrej y osrejtype minmax trim y twodbias y twodname /home/user/projectX/calibration_data/combias* subdark n darkname not_used flatten y flatname /home/user/projectX/calibration_data/comflat* document y combine n scaletype mean combtype average rejtype minmax numlow 1 numhigh 1 lowsigma 2.5 highsigma 2.5 normalize yes
You may start the reduction by saying something like this:
rctnight '/archive/data/ra*.fits' /home/user/projectX/images/ \ /home/user/reduction/scripts/makeobjects.parsRctnight will run in a manner similar to that before. Here we are giving the script a template for the names of input images (simply to illustrate this feature); only files matching the pattern ra*.fits in the /archive/data/ directory will be reduced. Note the use of single quotes ('') around the filename template. Furthermore, in this example, we have chosen to restrict the data reduction to a certain subset of all images based on the OBJECT header keywords (by setting the object parameter). We are reducing only the images of NGC 4565 and Jupiter. Also this time, both a flat field and a bias image should be presented for each group of images to reduce and the user can make changes as before. The output (reduced images and log file) is written to the directory /home/user/project/images/.