Subtracting the Overscan using maestrobiaser.cl in IRAF

Last update:  May 29, 2013
Author:  Jill Bechtold

Since the MAESTRO CCD is read out with two amps, there are two overscan regions.  These are seen in displays of the raw data as a 40 pixel "gap" in the middle of the image. This is not a physical gap, but is where the overscan data is recorded when the ccd is read out.

For various reasons, the file produced by ICE/IRAF is a fits file which is not multi-dimensional.   The AZCAMTOOL software reads out the CCD and normally would write a multi-dimensional fits file, but for MAESTRO, it  "de-laces" it and sends it to the alewife computer as a single order fits file.   Each half of the image must have the appropriate overscan subtracted.  So we have written a script to subtract the overscan region for each half of the image, and produce a single,  trimmed fits file without the overscan. We then edit header information so that ccdproc subsequently can be run.

The cl is called "maestro_biaser.cl"  and was written by Ed Olszewski, Jill Bechtold and Christy Tremonti.

As of April 2008, the script reads the overscan and trim regions from the header and should take care of binned data properly.  However, we have done only limited testing of bin and readout combinations, so check that it is doing what you think it is, and if you have trouble with it, let us know.

How to run maestro_biaser.cl

1.  Make a directory and copy your data to it.  maestro_biaser DESTROYS THE ORIGINAL COPY OF THE IMAGE
so work on copies of your data.

2.  Download maestro_biaser.cl and put it on your computer.

We've had some trouble with the cl being garbled when emailed through the Steward squirellmail system.   The symptom is that when you run the script in iraf, it can't find the parameter file.  Try reformating the carriage returns with the unix command

dos2unix maestro_biaser.cl maestro_biaser.cl

Again, we've done only limited testing on different machines so let us know what you experience.

3.  Set up the task by typing at the iraf prompt:

cl>task maestro_biaser = maestro_biaser.cl

or putting this line in your login.cl file.  

4.  Load packages you'll need.  The script will tell you if you haven't.

cl>ctio
cl>imred
cl>ccdred

5.  lpar and epar should work, and the usual syntax for iraf lists and wildcards:

bi> lpar maestro_biaser
    filenames = "c*"                Images to de-overscan
             (interact = yes)                    Interactively fit overscan?
             (oorder = 5)                         Overscan fitting order
              (flist = "tmp$maestro_tmp4467z") 
              (mode = "ql")           
bi> 

6.  Run maestro_biaser

cl> maestro_biaser c0152.fits

The typical output looks like:
Warning: Image header parameter not found (TRIM)   <-- This warning is normal, and means the image has not been de-biased.  
                                                                                              If it has already had maestro_biaser run on it, the script will skip it.
Processing c0152.fits
tmp$maestro_tmp4467aa: Apr 22 11:36 Trim data section is [1:2048,1:2000]
Fit overscan vector for tmp$maestro_tmp4467aa interactively (yes): 
   (answer yes and a plot window comes up with a red cross-hairs.  See iraf's colbias for instructions on how to fit the overscan.)
tmp$maestro_tmp4467aa: Apr 22 11:36 Overscan section is [2049:2068,1:2000] with mean=1736.617
tmp$maestro_tmp4467ba: Apr 22 11:36 Trim data section is [21:2068,1:2000]
Fit overscan vector for tmp$maestro_tmp4467ba interactively (yes): 
         (answer yes again to fit the overscan in the other side of the image)
tmp$maestro_tmp4467ba: Apr 22 11:36 Overscan section is [1:20,1:2000] with mean=1686.856
delete image `c0152.fits' - f/5 Th Ar ? (yes):                <-- Here it's verifying that you want to keep the bias-subtracted result.


7.  Advice 
 You really have to do the fits interactively.   The overscan contains electrons from the image if the image contains bright pixels, which it does, for example, for standard stars and quartz lamps.  If there's a bright Th-Ar line near the overscan region, it may also bleed into the overscan.  Thus, you will have to fiddle with these fits to get a reasonable bias subtraction.  It's tedious, but echelle observing is slow, so you will not collect vast numbers of images in a typical night.  You can do long sets of zeros non-interactively, of course.

For zeros or faint objects, we find that a legendre polynomial with order = 5 and niter = 3 works well.

For bright stars, quartzs and th-ar lamps 
  use the "s"  "s" command to define sample regions.  The "z" command deletes a region;  "d" deletes individual points.  
  A legendre of order = 3, niter = 3, high_rej=2 


Here's a typical fit:





8.  Logfile. 
maestrobias writes information on what it has been doing to a file called logfile.  A typical logfile looks like this.

9.  If you are new to IRAF: 

Functional fits to the overscan data are carried out in an interactive IRAF fitting routine which is used in many IRAF scripts.  To become


In the fitting routine, you have a red cursor in a plot window.  To change the number of iterations, type

:niter 3

to change the number of iterations to 3.  After changing the number of iterations, you must type

f

to actually perform a new fit.  The new fit will be plotted on top of the data.

When you like the fit, type

q

to quit the fitting routine and proceed to the next step of maestrobiaser.