Flat fielding and Bias subtraction

If there is a problem(s) as I'm sure they will surface, then please contact me at reventropy2003@yahoo.com

Flat types-

There are three general types of flats. The first, and most common, is a flat exposure taken from the sky at twilight or dawn. This is commonly referred to as a sky flat, or "SF". The second is performed using a dome lamp, and is commonly referred to as a dome flat, or "DF". The third, which is more difficult (more reduction work), is considered slightly more accurate. It consists of combining images taken throughout the night and removing the actual image from the frame (sometimes called "superflats", or "SF") leaving behind a zeroth flat image. I will deal with all three to a point. All data reduction methods will be described using IRAF.

Taking sky flats-

First and foremost, sky flats should NOT be taken through clouds or any other impeding weather disturbances. If clouds are present in the flats they will likely present themselves in the processed images as a phantom of the flatcombine file. If clouds are permeating the sky (assuming they're expected to clear as the night draws on) than choose another method for obtaining flats. Sky flats are taken at twilight or at dawn. The window for taking sky flats is very narrow. Using multiple filters may buy you some time (although not in each filter). Because the sky is more transparent to longer wavelengths i.e. infra-red, there is an order that the flats for each filter should be taken in. You should start with the shorter wavelength filters first because they can be taken when it's brighter out. For example, at twilight the order should follow B,V,R,I. At dawn the order should be reversed. Ideally, one wants to keep the image max as close as possible to (but below) 20,000. Make sure the min. is positive. The usual integration time is one second. Although the integration can be lengthened, the window for sky flats narrows quickly and this option may be a waste of valuable time. It is recommended to try and get it done right the first time. With one second exposures it is likely that you will only get 5-7 sky flats in each filter. 10 is ideal if at all possible. Since different parts of the sky aren't illuminated evenly (and you won't have time to move the scope around anyway) it is recommended that you stay in one spot while taking sky flats. The supposed best position to take flats is the so called Chromery spot (approx. 20 degrees from the zenith side opposite sun) which is the position in the sky that is most evenly illuminated at sunrise and sunset. If object integrations will be kept within one hour of the meridian, flats at the zenith should be sufficient.

Taking dome flats-

Although sky flats are preferred over dome flats for various reasons, sometimes they may be more convenient. If working at NURO, first type the "fs" command on MOVE. This will send the telescope to the illumination screen. Turn on the screen. Make sure tracking is turned off and begin taking tests starting with a one second exposure. When a good count level (as close as possible to 20,000) is obtained, begin taking the flat exposures. Do tests on each filter before taking the actual exposures. The main difference between dome and sky flats is that there is no specific filter order.

Taking "superflats"-

"Superflats", or zeroth order fringe frames, are the most accurate type of flat in broadband filters. One major upside to superflats is that the exposure times and fluxes match the images. This is because the flats are extracted from the images themselves. In other words, don't worry about taking superflats. If you have multiple images of the same object than the flats have already been taken.

Processing sky/dome flats-

zerocombine:

There will be a fair number of hot pixels in the object images and in the flats. Most of this can be taken out by bias subtracting a combined bias file from the flats and the images. To create a combined bias frame, first place all of the bias files for the night in one directory. Make the directory using the "mkdir" command. Then move the files into the directory with the "mv" command. It is also a good idea to organize the images and flats in each filter into their own directories. This will make some tasks (discussed later) much more simple. If no biases were taken, ones from a previous night may be used. If all of the biases are named in a similar way (for instance Zero_0012.fits), than changes can be applied to all of them at once using a command like "Zero_00*". The files will have likely been compressed. All compressed files will have a .Z extension. To uncompress the files first change to the folder where the files have been stored. From the IRAF prompt type:

cl>uncompress .Z*

To make a list of all the bias frames while in the bias directory type something like this:

> files * > biaslist

The list can be viewed with text editor by typing:

xemacs biaslist

You should see a list of all of the bias files in the bias folder. If any are missing or duplicates than enter or remove them respectively. To combine the list of files use the zerocombine task. First, if working from x, or xgterm, open IRAF with the command "cl". Then enter the path:

cl>noao,\ cl>imred, cl>ccdred

Before combining the biases, configure the "zerocombine" parameters by typing:

epar zerocombine

A good example of what the zerocombine parameter file could look like can be found here. If you would like to view a description of each parameter than click here. Remember to change the list (first parameter) to @(list). The @ symbol is very important. Without it the flatcombine program will not recognize that the list is a list of images. Also, remember to label the output file with a .fits extension. Otherwise it will be saved as a .imh file and will only be viewable from IRAF. Leave ccdtype blank and set processing to no. Combine type should be median. To

flatcombine:

Sky flats should be organized by date and filter. Using the "flatcombine" task in IRAF all of the flats in a particular filter on a particular night will be combined into one file.

The files should be uncompressed. Next, the file names should be combined into a list to be read by "flatcombine". At the prompt type something like this:

cl>files * > biaslist

Next you must choose the parameters to input into the "flatcombine" parameter file. Change directories to:

cl>noao,\ cl>imred, cl>ccdred.

Type "ls" to display the functions and folders available in your present directory. You should see "flatcombine". To adjust the parameters of the program, type:

epar flatcombine

This page contains some good examples of what parameter files for various reduction tasks could look like. Each parameter is explained in detail here. Set L, and H sigma values to 20. Turn processing and subsets to no. Combine type should be median Important!! Before combining the flats, see imstat and imarith.

Imarith:

Before "flatcombine is run, each file should be normalized using imarith. First, a pixel mode should be determined on each flat. To do this, type:

vflat fields="(image name),mode"

To normalize the flatfield using imarith, type:

imarith ("file name") / ("mode value") <("new file name")

When this is done you should be ready to subtract the biases from the flats and the images using imarith. First, copy all of the zerocombined files to the image directory. This will make the process more convenient.

imarith @(flat list file)-(zero list file) (new file name)

Once the biases have been subtracted from the flats, the flats can be combined using the "flatcombine" command.

The flats can then be divided off of the images using imarith:

imarith @(object list file)/(flatfield file) (new file name)

Imcopy:

The final step in processing the image is taking out the residual strip on the side of the image. This cleans up the image's appearance and ensures that pixels in the strip aren't detected as excess noise. First, find where the image ends and the strip begins. In the NURO CCD it is at 512 pixels on the x axis. The process can be done using the imcopy program in IRAF. Make sure you're in the directory you need to be in. Once in IRAF go to the cl>"images" directory. At the prompt type:

cl>imcopy *fit(s)[1:512,*] *fit(s)

This should subtract the strip from all the images with the .fit(s) suffix.

Using imarith on lists only seems to work correctly if the command is typed in at the prompt. If instead the parameter file is manipulated there seems to be an error. If you find a way around this than please contact me at the address listed above. Remember when your done using IRAF to exit properly by typing logout at the cl>. To check the images open them in Ds9 or "object". There should be minimal noisy pixels, and no pre-flatfield blotches should be seen. To check the procedure, run "imstat" on the new file. The mode value should be equal to one.

Similar processes from Console in CDE-

There are a few subtle differences between working in xgterm and CDE console. I hope to clarify them here.

In order to uncompress multiple images, first place them all in the same directory. After you've moved to that directory type:

uncompress *

You should not be prompted.

Another notable difference is in making a list. Using the line provided above in console will create a file, but it will be blank. To make a list, open text editor from the accessories box. With the mouse highlight the images in the console and right click. Edit and copy. Paste the image names into the editor window and save the file to the directory you're in.

It is important that all of the files are listed in a vertical column with no commas or numbering. When zerocombine reads the list it must be able to read the files exactly as the image files are listed. Use the same procedure to make an image or flat list.