Data Reduction
Nicole Fields

Using IRAF, I reduced the image frames from each night's observations using the provided bias and flat frames. Here are some examples of bias, flat, unreduced image, and reduced image frames. Before beginning any data reduction a few things must be done in order for IRAF to be cooperative. Go to my IRAF page to make sure that everything is properly setup to do data reduction. Once IRAF is properly setup, the data reduction can begin. The tools used to do this reduction are in noao:imred:ccdred. The tools that I used are ccdproc, zerocombine, and flatcombine. First, all bias, flat, and image frames need to be overscanned and trimmed. This is done using ccdproc. To set the parameters of ccdproc type epar ccdproc. epar is used to set the parameters of any IRAF command. To get more information on any of the options for ccdproc type help ccdproc. help can also be used on any IRAF command.

Give IRAF the path of the input files for the images=. IRAF accepts wildcards, so name your files intelligently! Also, all parameters must be retyped each time they are changed, so it makes sense to use Linux commands to change directory to where your files are actually stored. Most Linux commands work without any alteration within IRAF. For example if you have started IRAF in /net/user/nfields/iraf, and want to move to the directory where your files are stored /net/user/nfields/optical_blazars/wiyn_reduced, typing cd ../optical_blazars/wiyn_reduced will put you into the proper directory. If a Linux command does not work in IRAF as is, it will need to be prefaced with an !. The rm command, for example, needs a preceding ! when used in IRAF. So rm random.dat will not work but !rm random.dat will.

If no output= files are listed in epar ccdproc , IRAF will simply overwrite the original files, so if you want to save the original files, make copies. Also make sure that ccdtype= is set to the right type of image, either zero, flat, or object. This option will only work properly if IRAF can read the headers of your images. To overscan and trim your images set oversca= to yes and trim= to yes and all other options to no. That should be all of the parameters that need to be changed.

To exit the epar screen type :q. To save the options you've just set and quit type :wq. To tell the command to execute with the options you've just set type :go.

Once all of the images have been trimmed and overscanned. The bias frames need to be combined using zerocombine. Once again using the epar command type epar zerocombine. Give IRAF the path of the input files for the images=. Set ouput= to Zero. The .fits extension is automatic. If you want the ouput to be in a different directory then the full or relative path for the output file needs to be given. Set combine= to either average or median. I personally use average. At any point to see the possible options for setting a parameter type ? and IRAF will show all of the possible options at the bottom of the window. Set reject= to minmax. Set ccdtype= to zero. The rest of the defaults should be fine.

Now all of the flats and object images need to be bias subtracted. This is done with ccdproc. Use the same parameters as before for ccdproc except set zerocor= to yes and set zero= to Zero.fits. overscan= and trim= can be set to no but if these options are not changed, IRAF keeps track of what operations have been done on which images and will not redo an operation.

Now the flat frames need to be combined using flatcombine. Set output= to Flat. Set combine= to median. The rest of the defaults should be fine. flatcombine will automatically combine the flats by filter and the output will be files named Flat002.fits, Flat003.fits, etc, according to the filter number. The filters that I used BVR in IRAF are numbers 002, 003, and 004. Filter information is stored in the headers of all of the images.

Finally, the object frames need to be flat fielded. This is also done with ccdproc. Set flatcor= to yes. Set flat= to Flat*.fits. The wildcard accounts for the master flats in different filters. Once again IRAF will take care of flat fielding the different images with different filters separately. Now the reduction is complete!

Once this process is comfortable it can be scripted from within IRAF using a command called mkscript. This command must be run after all of the relevant packages are loaded, in this case ccdred. Then following the prompts, each command can be added to the script and all the parameters for each command can be edited. After all of the commands have been added mkscript will prompt if the entire script is ok, and will then prompt if the script is to be run as a background job. An example reduction script can be seen here. This script can also clear up any possible ambiguities in the parameters that I used for the image reduction.

After every image frame was reduced, I used the commands imalign and imcombine to combine all image frames of the same object in the same filter from the same night. There weren't a lot of these frames, but doing so simplified the presentation of my results and decreased my errors. If the frames are reasonably well lined up then imalign will not require a shifts= option. To use imalign set input= to all of the images to be combined, for example Mrk421-B*.fits. Set referenc= to one of the images to be combined, for example Mrk421-B_0.fits. Set coords= to the same coordinate file used for the photometry, so, Mrk421.coo. All of the other defaults should be fine.

If this proceeds with no errors then the images can be combined. If errors occur due to alignment, then attempt imalign again, using a shifts file for the frames. The easier way to make a shifts file is to use your favorite text editor and open each of the images to be combined in the display window. Pick one object and record its x and y coordinates in each frame. Use 0 0 for the first frame, and for each subsequent frame calculate the shifts by taking the coordinate of the object in the first frame and subtracting the coordinate of the object in the current frame. The shifts file must have as many rows as images to be aligned or IRAF will not perform imalign.

Once the images are aligned, they can be combined, using imcombine. Set input= to the images that have been aligned. Set output= to a single file name, for example Mrk421-B.fits. Set combine= to average. The rest of the defaults should be sufficient. Once again I made several scripts to carry out this align and combine process. An example is here.

Back to the REU homepage!
REU homepage