Cosmic-ray Identification Step

The cosmic rays and bad pixels are now identified by comparing the input images with the associated blotted,median-cleaned images created.

Mask blemishes in dithered data by comparison of an image with a model image and the derivative of the model image.


Warren Hack



drizzlepac.drizCR.createCorrFile(outfile, arrlist, template)[source]

Create a _cor file with the same format as the original input image.

The DQ array will be replaced with the mask array used to create the _cor file.

drizzlepac.drizCR.drizCR(input=None, configObj=None, editpars=False, **inputDict)[source]

The blotted median images that are now transformed back into the original reference frame, get compared to the original input images to detect any spurious pixels (which may include pixels impacted by cosmic rays) in each input. Those spurious pixels then get flagged as ‘bad’ in the output cosmic ray mask files, which get used as input for the final combination so that they do not show up in the final product. The identified bad pixels get flagged by updating the input mask files. Optionally, copies of the original images with the bad pixels removed can be created through the use of the driz_cr_corr parameter.

inputstr or list of str (Default = None)

A Python list of blotted median image filenames, or just a single filename.

configObjconfigObject (Default = None)

An instance of configObject which overrides default parameter settings.

editparsbool (Default = False)

A parameter that allows user to edit input parameters by hand in the GUI. True to use the GUI to edit parameters.

inputDictdict, optional

An optional list of parameters specified by the user, which can also be used to override the defaults.

Other Parameters:
driz_crbool (Default = False)

Perform cosmic-ray detection? If set to True, cosmic-rays will be detected and used to create cosmic-ray masks based on the algorithms from deriv and driz_cr.

driz_cr_corrbool (Default = False)

Create a cosmic-ray cleaned input image? I set to True, a cosmic-ray cleaned _cor image will be generated directly from the input image, and a corresponding _crmask file will be written to document detected pixels affected by cosmic-rays.

driz_cr_snrlist of floats (Default = ‘3.5 3.0’)

The values for this parameter specify the signal-to-noise ratios for the driz_cr task to be used in detecting cosmic rays. See the help file for driz_cr for further discussion of this parameter.

driz_cr_growint (Default = 1)

The radius, in pixels, around each detected cosmic-ray, in which more stringent detection criteria for additional cosmic rays will be used.

driz_cr_ctegrowint (Default = 0)

Length, in pixels, of the CTE tail that should be masked in the drizzled output.

driz_cr_scalestr (Default = ‘1.2 0.7’)

Scaling factor applied to the derivative in driz_cr when detecting cosmic-rays. See the help file for driz_cr for further discussion of this parameter.


These tasks are designed to work together seemlessly when run in the full AstroDrizzle interface. More advanced users may wish to create specialized scripts for their own datasets, making use of only a subset of the predefined AstroDrizzle tasks, or add additional processing, which may be usefull for their particular data. In these cases, individual access to the tasks is important.

Something to keep in mind is that the full AstroDrizzle interface will make backup copies of your original files and place them in the OrIg/ directory of your current working directory. If you are working with the stand alone interfaces, it is assumed that the user has already taken care of backing up their original datafiles as the input file with be directly altered.


Basic example of how to call drizCR yourself from a Python command line using the default parameters for the task.

>>> from drizzlepac import drizCR
>>> drizCR.drizCR('*flt.fits')[source]
drizzlepac.drizCR.rundrizCR(imgObjList, configObj, procSteps=None)[source]

Return a dictionary of the default parameters which also been updated with the user overrides.

Print out syntax help for running drizCR.

filestr (Default = None)

If given, write out help to the filename specified by this parameter Any previously existing file with this name will be deleted before writing out the help.