Report on making BADPIX masks for the Optical Imagers


Based on the Calibration Plan for Optical Imagers meeting held in August 2002, it was decided to standardise how we create BADPIXEL masks for all of the optical imagers on La Silla. Two methods were tested: In the end, it was decided to use the CCDMASK for the optical imagers primarily because it did a much better job at finding and masking out bad columns (in fact it is designed for this), which are the main problem for optical imagers but are not an issue in IR arrays.

The following details the program written to automate the process, the parameters used in CCDMASK, and compares the newly generated BADPIXEL masks to real images and previous BADPIXEL masks (if they exist).

The Program and Parameters

I have written a Perl program ( to automatically create the BADPIXEL masks for the optical imagers. There are small differences in exactly how the program treats the data from the different imagers, these are detailed below.

What data are needed requires the following images as input:

What (basically) happens to the data

The parameters of CCDMASK

The following parameters (i.e. a sigma of 20) were found to produce the best results. The bad columns are detected easily, and there are few good pixels masked out.

                    Image Reduction and Analysis Facility
PACKAGE = ccdred
   TASK = ccdmask

image   =                       Input image
mask    =                       Output pixel mask
(ncmed  =                    7) Column box size for median level calculation
(nlmed  =                    7) Line box size for median level calculation
(ncsig  =                   15) Column box size for sigma calculation
(nlsig  =                   15) Line box size for sigma calculation
(lsigma =                   20.) Low clipping sigma
(hsigma =                   20.) High clipping sigma
(ngood  =                    5) Minimum column length of good pixel seqments
(linterp=                    2) Mask value for line interpolation 
(cinterp=                    3) Mask value for column interpolation 
(eqinter=                    2) Mask value for equal interpolation
(mode   =                   ql)

How to run

Since I have volunteered to make all the BADPIX masks for the optical imagers, the program (and related miscellania that are needed for the program to run) are currently located on the machine wfidrl. A single command line is needed to run the script. instrument date

where instrument is one of WFI, EMMI, EFOSC, SUSI and date is the date the images were taken.

How to use the BADPIX masks

The file you download has the This does not indicate a perl script but rather this is the default extension for a BADPIX mask make with CCDMASK. Again - these are NOT perl scripts (though the labelling is misleading). These are the files that you indicate in the FIXFILE keyword of CCDPROC . Simply enter the names of the badpix files there and run CCDPROC . That's all there is to it!


In general, this method (using a sigma of 20) does a pretty good job. It finds and masks the real bad columns and pixels successfully, and does not mask too many areas that are in fact good pixels (though see below). NOTE: many bad pixels/columns actually disappear when you divide one image by another (in this case one flatfield by another).

One thing to note when looking at the comparisons for each imager below. mkBADPIX occasionally appears to mask out columns that do not seem to appear in the flatfields. These columns seem to be due to residuals left over from the BIAS subtraction. The following is an example from WFI. You can see two bad columns (the right-most one is very faint) on the right hand side of FLATSLOW.fits which is picked up in FLATSLOWHIGH.fits and the BADPIX mask. The remaining columns masked in the BADPIX mask correspond with bad columns in BIAS.fits. Based on these comparisons, seems to mask out more than it should.

However, below is the same part of a WFI observation, overscan subtracted, trimmed, bias subtracted and flatfielded. You can see very clearly that the bad columns detected by are real.

So in fact although these bad columns are not easily visible in flatfield images, they are apparent in the images themselves and need to be masked out.

Results for Individual Imagers

More details on the reduction process for each individual imager with pictures illustrating the main points of the final reduction are found at:

WFI results Download the Badpixel Mask from 2003-05-30
EFOSC2 results Download the Badpixel Mask from 2003-06-21
EMMI-RED results Download the Badpixel Mask from 2003-06-02
SUSI2 results Download the Badpixel Mask from 2003-05-29