[Creating Improved Bad-pixel Masks]
[Using Bad-pixel masks (fixpix)]
[Tangent-Plane Projection (mscimage)]

Projecting Your Individual Images

Creating Improved Bad-pixel Masks

The first thing we do before projecting our images is to create a mask for the cosmic rays by running craverage. This is an extremly CPU intensive task. Here is the parameter file for craverage (first load crutil):


PACKAGE = crutil
   TASK = craverage

input   =           List of input images
output  =           List of output images
(crmask =         ) List of output cosmic ray and object masks
(average=         ) List of output block average filtered images
(sigma  =         ) List of output sigma images
	  
(navg   =        7) Block average box size
(nrej   =        3) Number of high pixels to reject from the average
(nbkg   =        5) Background annulus width
(nsig   =       50) Box size for sigma calculation
(var0   =       0.) Variance coefficient for DN^0 term
(var1   =       0.) Variance coefficient for DN^1 term
(var2   =       0.) Variance coefficient for DN^2 term
	  
(crval  =        1) Mask value for cosmic rays
(lcrsig =      10.) Low cosmic ray sigma outside object
(hcrsig =     3.75) High cosmic ray sigma outside object
(crgrow =       0.) Cosmic ray grow radius
	  
(objval =        0) Mask value for objects
(lobjsig=      10.) Low object detection sigma
(hobjsig=      5.5) High object detection sigma
(objgrow=       0.) Object grow radius
(mode   =       ql)

You can run this in script mode by creating a script that looks like the example below. A hint for easy creation of this script follows.


craverage obj016f.fits[1]  output="" crmask="crmask016_1"
craverage obj016f.fits[2]  output="" crmask="crmask016_2"
craverage obj016f.fits[3]  output="" crmask="crmask016_3"
craverage obj016f.fits[4]  output="" crmask="crmask016_4"
craverage obj016f.fits[5]  output="" crmask="crmask016_5"
craverage obj016f.fits[6]  output="" crmask="crmask016_6"
craverage obj016f.fits[7]  output="" crmask="crmask016_7"
craverage obj016f.fits[8]  output="" crmask="crmask016_8"
#
craverage obj017f.fits[1]  output="" crmask="crmask017_1"
craverage obj017f.fits[2]  output="" crmask="crmask017_2"
craverage obj017f.fits[3]  output="" crmask="crmask017_3"
craverage obj017f.fits[4]  output="" crmask="crmask017_4"
craverage obj017f.fits[5]  output="" crmask="crmask017_5"
craverage obj017f.fits[6]  output="" crmask="crmask017_6"
craverage obj017f.fits[7]  output="" crmask="crmask017_7"
craverage obj017f.fits[8]  output="" crmask="crmask017_8"

etc...

A quick way to create this without a lot of editing is to run mscstat with parameters set as follows:


PACKAGE = mscred
   TASK = mscstat

images  =   *.fits  Images
(extname=         ) Extension name selection
	 
(gmode  =       no) Global mode statistics?
(fields =    image) Fields to be printed
(lower  =    INDEF) Lower cutoff for pixel values
(upper  =    INDEF) Upper cutoff for pixel values
(binwidt=      0.1) Bin width of histogram in sigma
(format =      yes) Format output and print column labels?
	 
(fd1    =         )
(fd2    =         )
(mode   =       ql)

Do this: mscstat > cravg_script You now have a file called cravg_script that looks like:


#               IMAGE
  obj234pfs.fits[im1]
  obj234pfs.fits[im2]
  obj234pfs.fits[im3]
  obj234pfs.fits[im4]
  obj234pfs.fits[im5]
  obj234pfs.fits[im6]
  obj234pfs.fits[im7]
  obj234pfs.fits[im8]
  obj235pfs.fits[im1]
  obj235pfs.fits[im2]
  obj235pfs.fits[im3]
  obj235pfs.fits[im4]
  obj235pfs.fits[im5]
  obj235pfs.fits[im6]
  obj235pfs.fits[im7]
  obj235pfs.fits[im8]

So basically you have a listing of the images and all their groups. After that you can just use your favorite editor to edit this list to look like the script above. Now you can run your script: cl < cravg_script This will take a significantly long time, depending on your system.

Once craverage finishes you'll have a crmask***.fits (or .pl) mask file for each group of each image. You'll want to blink a couple with the images to make sure it's getting all the cosmic rays (or the vast majority of them anyway).

After this you'll want to combine this cosmic ray mask with your previously created bad pixel masks. We'll do this with a script called crplusbpmask.cl.**LINK THIS TO A COPY OF THE SCRIPT AS WAS DONE FOR SATZAP,ETC.**

This script takes a list of "object numbers". For instance: 145 146 147 etc.

It assumes that the prefix is obj and that there is no suffix before the .fits.

If you have a suffix of s or pfs you should modify this script to account for your naming convention. This task also assumes that your previous bad pixel masks are in directories named bpm123,etc. and containing masks that are named bpm_im1, bpm_im2, etc. It assumes your cosmic ray masks are named crmask123_im1, etc. It will create combined masks in the same directory, bpm123/, with the names bpmcr_im1 etc. And if you're using the correct script for your naming convention it will update the headers with the new mask name and location. This takes almost no time at all. It processes about as fast as it can print what it's doing to the screen.

set task crplusbpmask = crplusbpmask.cl crplusbpmask @yourlist

[Creating Improved Bad-pixel Masks]
[Using Bad-pixel masks (fixpix)]
[Tangent-Plane Projection (mscimage)]

Using Bad-pixel masks (fixpix)

Once you've combined the masks you'll need to apply them to the images with fixpix. Fixpix doesn't take nearly as long as craverage but it will still take a while.


PACKAGE = proto
   TASK = fixpix

images  =           @fixpix_in  List of images to
be fixed
masks   =                  BPM  List of bad pixel
masks
(linterp=                INDEF) Mask values for
line interpolation
(cinterp=                INDEF) Mask values for
column interpolation
(verbose=                   no) Verbose output?
(pixels =                   no) List pixels?
(mode   =                   ql)

Where fixpix_in is a list of images and groups as shown below.You can create this in the same way you created your craverage script. Just use mscstat with only "image" output and then edit.


obj033pfs.fits[1]
obj033pfs.fits[2]
obj033pfs.fits[3]
obj033pfs.fits[4]
obj033pfs.fits[5]
obj033pfs.fits[6]
obj033pfs.fits[7]
obj033pfs.fits[8]
obj034pfs.fits[1]
obj034pfs.fits[2]
obj034pfs.fits[3]
obj034pfs.fits[4]
obj034pfs.fits[5]
obj034pfs.fits[6]
obj034pfs.fits[7]
obj034pfs.fits[8]
etc.

[Creating Improved Bad-pixel Masks]
[Using Bad-pixel masks (fixpix)]
[Tangent-Plane Projection (mscimage)]

Tangent-Plane Projection (mscimage)

Note that for the Deep Wide Survey, on-site users have access to reference images (reference parameter in mscimage) that have already been created with a scale of .258 "/pix with North up. These exist in the /chomper/d10/moscal directory and are called: bootescenterNup.fits, and cetuscenterNup.fits For general users, however, you can either leave the "reference" parameter blank and the task will use the first input image in your input list as the reference image, or you can specify your reference preferences by using the ra,dec,scale and rotation parameters.

Below is an example parameter file for mscimage. We run it from the command line so that we can create a script that will run each image with a constant level that we set by running iterstat on a section of each image to find the mean somewhere close to the middle of the image. Mscimage would be run for an individual frame with a command something like:


mscimage ("obj156pfsz","mos156",constant=6255.)


PACKAGE = mscred
   TASK = mscimage
        input = ""     List of input mosaic exposures
       output = ""        List of output images
      (format = "image")        Output format (image|mef)
     (pixmask = yes)            Create pixel mask?
     (verbose = )_.verbose)     Verbose output?\n\n# Output WCS parameters
   (wcssource = "image")        Output WCS source (image|parameters)
   (reference = "bootescenterNup.fits") Reference image
          (ra = INDEF)          RA of tangent point (hours)
         (dec = INDEF)          DEC of tangent point (degrees)
       (scale = INDEF)          Scale (arcsec/pixel)
    (rotation = INDEF)          Rotation of DEC from N to E (degrees)
# Resampling parmeters
       (blank = 0.)             Blank value
 (interpolant = "sinc17")       Interpolant for data
(minterpolant = "linear")       Interpolant for mask
    (boundary = "constant")     Boundary extension
    (constant = 0.)          Constant boundary extension value
(fluxconserve = no)             Preserve flux per unit area?
       (ntrim = 7)              Edge trim in each extension
     (nxblock = 4200)           X dimension of working block size in pixels
     (nyblock = 2100)           Y dimension of working block size in pixels
# Geometric mapping parameters
 (interactive = no)             Fit mapping interactively?
          (nx = 10)             Number of x grid points
          (ny = 20)             Number of y grid points
 (fitgeometry = "general")      Fitting geometry
     (xxorder = 4)              Order of x fit in x
     (xyorder = 4)              Order of x fit in y
     (xxterms = "half")         X fit cross terms type
     (yxorder = 4)              Order of y fit in x
     (yyorder = 4)              Order of y fit in y
     (yxterms = "half")         Y fit cross terms type\n\n
       (fd_in = "")             
      (fd_ext = "")             
    (fd_coord = "")             
        (mode = "ql")