Skip to content. | Skip to navigation

Personal tools
You are here: Home Telescopes Magellan Instruments MagIC Reducing MagIC Images with IRAF

Reducing MagIC Images with IRAF

Table of Contents

1. Introduction

The SITe 2048x2048 CCD in MagIC is read out using all four amplifiers. The resulting raw image contains both serial and parallel overscans, and looks like the following:

Old image -- pre-August 2006 data: raw.jpg

New image -- post-August 2006 data: MagIC_SITE_new.png

The four-amplifier readout is very efficient (readout time is ~24 seconds), but complicates somewhat the reduction of the images due to the overscans which divide the quadrants. In this manual, several IRAF scripts designed to work with the MagIC SITe images are described.

In order to load these scripts, start IRAF in an xgterm window on the Observer Workstation (currently named "llama") and type magic [return].

2. Calculating the Gain and Readout Noise

The script "magic_gain" allows the observer to check the gain and readout noise for the four quadrants of the SITe CCD. Input for the script are the names of two dome flat field and two bias images. Each quadrant of the CCD is divided into a 6 x 6 grid and gain and readout noise values are calculated (using the task "findgain") for each of these 36 elements. Measurements for which the noise is discrepant by > 3 sigma level are discarded, and final averages for the gain and noise are printed out as shown in the following example:

    Quadrant: ll
     # of measurements: 32
     gain, sigma :   1.991   0.046
     noise, sigma:   6.967   0.184 
    Quadrant: lr
     # of measurements: 28
     gain, sigma :   1.991   0.039
     noise, sigma:   5.800   0.137 
    Quadrant: ul
     # of measurements: 30
     gain, sigma :   2.092   0.056
     noise, sigma:   6.294   0.183 
    Quadrant: ur
     # of measurements: 30
     gain, sigma :   1.901   0.088
     noise, sigma:   6.662   0.280

It is strongly recommended that observers check the gain and noise at the beginning of their run. Typical values are given for reference in the Magic manual.

3. Adding the "FILTERS" Keyword to the Image Headers

The top and bottom filter positions of the MagIC filter wheel are stored in the FITS header as two separate keywords. For example, an image taken with the top filter wheel set to the B filter and the bottom wheel set to the open position will generate the following keywords in the image header:

    FILTERT = 'MagIC_B '           / top filter
    FILTERB = 'MagIC_b0'           / bottom filter

In order to use the subset translation file feature of the "ccdred" package in IRAF, it is useful to combine these two keywords into a single keyword called "FILTERS". This may be accomplished using the "magic_filters" task. For example, if the image named 020129F.100 has the FILTERT and FILTERB keywords as given in the above example, typing

    magic_filters 020129F.100

will add the following keyword to the image header:

    FILTERS = 'MagIC_B MagIC_b0'

Note that this operation will alter the original image header slightly and so you may want to copy the images to a separate directory before running this script.

4. Overscan Correction and Trimming

The first step in reducing the quad-readout MagIC SITe images is to perform the overscan correction for each quadrant separately, and then to trim and combine the quadrants into an image with no gaps. This is accomplished by running the "ccdmagic" task, which was kindly provided by Nick Suntzeff (CTIO). In preparation for running this task, it necessary first to edit the parameters of the "ccdred" package as follows:

    PACKAGE = imred
             TASK = ccdred
       (pixeltype = "real real")        Output and calculation pixel datatypes
         (verbose = yes)                Print log information to the standard output?
         (logfile = "logfile")          Text log file
        (plotfile = "")                 Log metacode plot file
          (backup = "")                 Backup directory or prefix
      (instrument = "magic$/magic.dat") CCD instrument file
          (ssfile = "magic$/magic.sub") Subset translation file
        (graphics = "stdgraph")         Interactive graphics output device
          (cursor = "")                 Graphics cursor input
         (version = "2: October 1987") 
            (mode = "ql")           
          ($nargs = 0)

The instrument file "magic.dat" and the subset translation file "magic.sub" have been set up specifically for reducing MagIC SITe CCD data. (Note that it is necessary to run the "magic_filters" task first in order to use these files.)

Next, edit the "ccdproc" task parameters to the following:

    PACKAGE = ccdred
             TASK = ccdproc
           images = ""              List of CCD images to correct
          (output = "")             List of output CCD images
         (ccdtype = "")             CCD image type to correct
       (max_cache = 0)              Maximum image caching memory (in Mbytes)
          (noproc = no)             List processing steps only?\n
          (fixpix = no)             Fix bad CCD lines and columns?
        (overscan = no)             Apply overscan strip correction?
            (trim = no)             Trim the image?
         (zerocor = no)             Apply zero level correction?
         (darkcor = no)             Apply dark count correction?
         (flatcor = no)             Apply flat field correction?
        (illumcor = no)             Apply illumination correction?
       (fringecor = no)             Apply fringe correction?
         (readcor = no)             Convert zero level image to readout correction?
         (scancor = no)             Convert flat field image to scan correction?\n
        (readaxis = "line")         Read out axis (column|line)
         (fixfile = "")             File describing the bad lines and columns
         (biassec = "")             Overscan strip image section
         (trimsec = "")             Trim data section
            (zero = "")             Zero level calibration image
            (dark = "")             Dark count calibration image
            (flat = "")             Flat field ima
           (illum = "")             Illumination correction images
          (fringe = "")             Fringe correction images
      (minreplace = 1.)             Minimum flat field value
        (scantype = "shortscan")    Scan type (shortscan|longscan)
           (nscan = 1)              Number of short scan lines\n
     (interactive = no)             Fit overscan interactively?
        (function = "leg")          Fitting function
           (order = 1)              Number of polynomial terms or spline pieces
          (sample = "*")            Sample points to fit
        (naverage = 1)              Number of sample points to combine
        (niterate = 1)              Number of rejection iterations
      (low_reject = 3.)             Low sigma rejection factor
     (high_reject = 3.)             High sigma rejection factor
            (grow = 0.)             Rejection growing radius
            (mode = "ql")

The parameters for the "ccdmagic" script are (post-August 2006; SITe):

    PACKAGE = magic
             TASK = ccdmagic
           images = "020130.010"             input images
           (bias1 = "[2089:2128,2:1025]")    bias for ll amp
           (bias2 = "[2129:2168,2:1025]")    bias for lr amp
           (bias3 = "[2089:2128,1026:2049]") bias for ul amp
           (bias4 = "[2129:2168,1026:2049]") bias for ur amp
           (trim1 = "[41:1064,2:1025]")      trim for ll amp
           (trim2 = "[1065:2088,2:1025]")    trim for lr amp
           (trim3 = "[41:1064,1026:2049]")   trim for ul amp
           (trim4 = "[1065:2088,1026:2049]") trim for ur amp
          (prefix = "r")                     Prefix for reduced data
           (niter = 3)                       Number of iterations for bias
          (reject = 2.5)                     Low and high sigma rejection
         (imglist = "")             
            (mode = "ql")

ccdmagic will read the header for the date and subsitute the correct values for any images taken earlier. For old (pre-August 2006) SITe data: 

    PACKAGE = magic
             TASK = ccdmagic
           images = "020130.010"             input images
           (bias1 = "[1057:1075,6:1025]")    bias for ll amp
           (bias2 = "[1078:1096,6:1025]")    bias for lr amp
           (bias3 = "[1057:1075,1057:2075]") bias for ul amp
           (bias4 = "[1078:1096,1057:2075]") bias for ur amp
           (trim1 = "[23:1046,2:1025]")      trim for ll amp
           (trim2 = "[1107:2130,2:1025]")    trim for lr amp
           (trim3 = "[23:1046,1057:2079]")   trim for ul amp
           (trim4 = "[1107:2130,1057:2079]") trim for ur amp
          (prefix = "r")                     Prefix for reduced data
           (niter = 3)                       Number of iterations for bias
          (reject = 2.5)                     Low and high sigma rejection
         (imglist = "")             
            (mode = "ql")

The bias and trim parameters should not be modified from these values. Note that a prefix should be given for the reduced image using the "prefix" parameter. The "niter" and "reject" parameters are used for the overscan correction, and may be adjusted if necessary. Running "ccdmagic" should yield an output image something like the following:


5. Bias Subtraction and Flat Fielding

At this point, the reductions of the MagIC SITe images can be carried out using the standard IRAF tasks. Bias and dome flat field images are best accomplished using the "zerocombine" and "flatcombine" tasks, respectively. Object images can then be bias-subtracted and flat-fielded using the "ccdproc" task. The final processed images should not show any trace of the original quad format, as illustrated in the following example:


6. Downloading and Installing the Scripts

To grab a tar file with these scripts, click here. Unpack the tar file in your home directory by typing:

    tar xvf magic_tools.tar

Next type the following line in your IRAF window (or add them to your "" file if you want to have these scripts available whenever you open a new IRAF window):

    task magic = home$magic_tools/iraf/

Finally, to load the magic package, type in your IRAF window:


(IMPORTANT: If using IRAF V2.11 or less, replace the line which reads "obsutil" in the script "" with the line "nproto".)

Document Actions