STScI Logo

driz_cr stsdas.analysis.dither



driz_cr -- Create cosmic ray mask based for dithered data


driz_cr images group


images = "" [file name]
The names of the original data images. The name can include a full or relative path. An image with a name of the form PATH/file will be compared with a blotted image, file_bl, and a derivative image, file_bl_deriv, to determine which pixels are corrupted.
group = "" [integer]
The image group being cleaned. In the case of WFPC2 this is 1 for the PC, 2-4 for the WF chips. In the case of NICMOS or STIS images, this corresponds to the fits extension number of the image to be compared, and is typically 1.
(gain = 7.) [real]
The gain, in e- per ADU, of the detector. The default gain is the typical gain of the WFPC2 chips.
(rn = 5.) [real]
The read noise of the detector in e-. The default read noise is the approximate read noise of the WFPC2 detectors.
(SNR = 4.0,3.0) [real]
The significance of the difference between the predicted and observed value of a given pixel required for masking.
(scale = 0.8,0.4) [real]
The multiplication factor applied to the derivative before determining if the difference between the data image and blotted image is sufficiently great to require masking.
(backgrn = "backgrnd") [string]
The header keyword in which the sky background of the image is stored. This value is used to determine the proper noise statistics.
(expkey = "exptime") [string]
Exposure time keyword
(corr = "no") [boolean]
Create corrected image?
(flat = "no") [boolean]
Weight statistics by flat field image?
(flt_im = "") [file name]
Flat field image name
(bl_suffix = "_bl") [string]
Suffix that is appended to the input blotted image.
(deriv_suffix = "_bl_deriv") [string]
Suffix that will be appended to the output derivative image.
(cr_suffix = "_cr") [string]
Suffix that will be appended to the output cosmic ray pixel mask.
(cor_suffix = "_cor") [string]
Suffix that will be appended to the output corrected image.
(verbose = "yes" ) [boolean]
This parameter determines the detail of the output to the user's terminal.


This task compares an image with a model image (usually created by the task "blot") and the absolute derivative of the model image (usually created with the task "deriv") to create a mask of cosmic rays (and other blemishes) in the original image. The user provides the name of the input image(s). The model and derivative images are assumed to be in the present working directory and to have names of the form FILE_bl and FILE_bl_deriv, where the original image has a full pathname PATH/FILE. The program makes two passes over the image. Pixels adjacent to pixels masked in the first pass are tested again with a second (usually more rigorous) set of parameters.

A pixel is masked if for a given pixel

|data - model| > scale*deriv + SNR*sqrt(rn**2 + gain*abs(model + backg))/gain

where rn, scale, and gain are the user supplied parameters, and backg is the background value taken from the image header.

The parameter values provided as defaults to this task will need to be adjusted to match the data available. In particular, the smallest feasible (and therefore best) values for the scale parameters will depend not only on the detector, but also on the dither pattern and the accuracy of the shift determinations.

For an example of the use of this task in reducing dithered WFPC2 observations, see the paper by Fruchter and Mutchler at

Source Code · Package Help · Search Form · STSDAS