IRAF processing RECIPES for the Glenlea Observatory:

(Feb. 2, 2006)

Processing with Iraf

    Firing up Iraf
  1. Producing Calibration Frames: For each of the frames, we will first set the parameters for the ccdprocessing software appropriately and then we will run the software on the individual frames. Subsequently we will combine the individual frames into their calibration image.
    1. Zero Bias Frames:
      1. Using epar ccdproc set parameters so that only the overscan region will be subtracted from your bias images. That is, set fixpix, trim and all corrections to no and

        ccdtype = ""
        overscan = yes
        biassec = [1:6,1:512]

      2. process by typing (or epar'ing) (assuming your images are prefixed with b1)

        ccdproc b1*.fit

      3. New processed files will have been produced. They will be in 2 parts - imh and pix files. The latter will be in your imdir. You can check these using imhead and displaying the new images.

      4. combine your bias frames into one zero frame image:
        1. set the following parameters in zerocombine (the rest can be their defaults)

          processing = no
          combine = average
          reject = minmax
          ccdytype =""
          nlow = 0
          nhigh = 1
          scale = none

        2. type
          zerocombine b1*imh out=zero1.imh
    2. Dark Frames:
      1. set ccdproc parameters so that the overscan region and the zero frame will be subtracted from your dark images. (Note: this has to be done for each different each different exposure time.) That is,

        ccdtype = ""
        overscan = yes
        zerocor = yes
        biassec = [1:6,1:512]
        zero = zero1.imh

        An example of settings is in ccdprocdark.list
      2. process by typing (or epar'ing)

        ccdproc d*.fit
      3. your files will have been overwritten with processed images. You can check these using imhead and displaying the new images.
      4. combine your dark frames into one dark frame image:
        1. set parameters in darkcombine

          processing = no
          combine = median
          reject = none
          ccdtype = ""
          scale = none

        2. select a name for your calibration image (like darky1.imh) and type
          darkcombine d*.imh out=darky1.imh
    3. Flat Field Frames:
      Recall that for 2006, we are using sky frames to create the flatfield frames. Let's assume that they are prefixed with "s".
      1. set ccdproc parameters so that the overscan region and the zero frame will be subtracted from your flatfield images. (Note: this has to be done for each different filter separately and for each different exposure time.) That is,

        ccdtype = ""
        overscan = yes
        zerocor = yes
        darkcor = yes
        biassec = [1:6,1:512]
        zero = zero1.imh
        dark = dark1.imh

      2. process by typing (or epar'ing)

        ccdproc s*.fit
      3. your files will have been overwritten with processed images. You can check these using imhead and displaying the new images.
      4. combine your flat frames into one flatfield frame image:
        1. set parameters in flatcombine

          output = flatsky1.imh
          processing = no
          combine = median
          reject = none
          ccdtype = ""
          scale = mode
          statsec = "" # this gives stats on whole image

          subset = "no"
          An example of settings is in flatcombine.list.
        2. type
          flatcombine s*.imh out=flatsky1.imh
        3. Check that the flatfield is adequate using display. Eg. in the command line type "display flatsky1.imh 1" where the 1 stands for frame 1. (Also see Tricks below for another example.)


  2. Process your target images:
    1. Do basic processing for each different filter and each different exposure time :
      1. Write settings to ccdproc which will
        (1) subtract the overscan, the zero frame and the dark frame
        (2) divide the flatfield
        from each target image per filter and per exposure time. An complete example of settings is in ccdproctarget.list. In general, the following parameters change.

        ccdtype = ""
        overscan = yes
        zerocor = yes
        darkcor = yes
        flatcor = yes
        biassec = [1:6,1:512]
        zero = "zero1.imh"
        dark = "dark1.imh"
        flat = "flatsky1.imh"

      2. Run the ccdproc task, either from the command line or using epar.
      3. Check the file that this worked correctly. Use imhead with the "long" option to check the values for the calibration images. Use display to examine the image.

    2. Analyze your Image Quality. See Course Outline.

    3. Combine your target fields:
      1. Shift your images so that they are aligned using imalign. Imalign will refine your estimate of the position of the centres of stars in your images, and calculate the shift needed to match each image up to a reference image. Then it will shift the image. More information is available via "help imalign".
        1. Pick the sharpest image to be your reference image, that is, an image that the others are shifted to match.
        2. In your reference image, using the cursor in the image display, roughly determine the centres of more than 3 stars that appear all the target images. Enter these coordinates into a text file with the first column for pixel x and the second column for pixel y. (At the end of the line for the last star enter a carriage return.) Here is an example named refcoords.
        3. Estimate the sizes of the centering boxes. To do this determine the largest separaton of your reference stars between images, including out to the faint "wings" of the stars. And determine the separation between images of the peak brightness of the same reference star. These 2 sizes will be used for the bigbox and boxsize parameters needed for centering.
          You can look at the PSF using imexamine. This will also give you a centre for your star if you use the "r" key. This key gives you a radial profile; plot parameters can be set in rimexam. (Note to galaxy researchers, you can set one of the axes to log so that you can make an Intensity Profile.)
        4. If you have more than a few images to shift, it is easiest to make an input list of names and an output list with new names for your shifted images. You can use any UNIX editor to do this (e.g. textedit, vi, emacs; I can help you with emacs.)
          Suppose you have images of different exposure times and filters and you wish to combine those of 300 seconds in the r filter. To make your input list, in IRAF you can type:
          dir target* ncol=1 > inlist-r-300s
          then type:
          copy inlist-r-300s outlist-r-300s
          Then edit outlist-r-300s to give new names, so you don't overwrite the originals, and save this edited file.
        5. If you have large shifts, you will have complexities. In this case, do NOT trim the images. Instead set trimimages="no".
        6. Epar the task imalign which is the task that will calculate the stars' centres and shift your target images. You can use the lists in the second step to ensure your original images won't be overwritten. The lists are inserted in the input and output parameters with an @ as the prefix to the listname. An example of settings is in imalign.list.
        7. Run imalign and copy the verbose information on your screen into your logfile. Note that your images will be trimmed to the common area in all your images.
        8. Place your shifted images into the image display in different frames and blink them to confirm the shift worked.
        9. If you have used at least 5 stars and your images do not shift accurately, see the section on Complexities.

      2. Combine your images using imcombine:
        Use images from the same filter and the same exposure time. (See the section on Complexities if you have different exposure times.)
        1. Use imcombine
        2. If you have more than 2 images then median the images together. If you have 2, then average them.
        3. You can try to compensate for different observing conditions by scaling the images. Pick a region within the image that is free of stars or the galaxy and use this as the region for the statistics. An example of parameters for scaling is shown in combine.avgscale.list.
        4. An example of parameters for averaging using the simplest combination algorithm is shown in combine.avg_noscale.list.
        5. If you have only 2 images, and need to remove cosmic rays and other defects, you can use a clipping algorithm. For clipping, check out the specifications for readnoise and gain for the ccd and have the task produce a sigma image displaying clipped pixels to check that the algorithm isn't producing artefacts.

    4. Remove cosmetic defects:
      To remove cosmetic defects such as cosmic rays and satellite trails, one can use imedit. Check the help file to learn how to interactively edit your data.

    5. Save your greyscale stretches:
      1. By setting the parameters in the display task you can display all of your raw data values or your can re-map the display to show different features. (See Complexities below.)
      2. Once displayed these stretches can be saved to fits files which can be put into other manipulation packages (such as GIMP or PhotoShop)
      3. In an image manipulation package, make further contrast adjustments and save in tiff, gif and/or jpeg formats.

      Complexities

      • Flatfielding:
        • Divide by zero error. If you get an arithmatic error during flatfielding, it means that there are numbers between 1 and zero (i.e. fractions) that during division are causing the pixel value to blow up to infinity. The offending pixels can be replaced using imreplace. Read the help file and speak to Jayanne.
      • Different exposure times:
        The simplest thing to do to get them to give the same counts per second, is to divide all images by exposure time in each of their headers using imarith. Then you don't have to keep track of how to scale images, etc.
      • Images won't align:
        If you have used at least 5 stars and your images do not shift accurately, then you may need to refine the estimates of the centres of your stars. This can be done using imcentroid and the resultant shifts need to be listed in a file which can be input into the "shifts" parameter in imalign. Read these tasks' help files for more information and talk to Jayanne.