pixreplace: Replace pixels which have one value with another value

This task allows a user to replace pixels in an image or set of images which have one value with a new value; for example, replace all NaNs with a value of -999.9.

Pixreplace – Replace pixels which have one value with another value

License:LICENSE

PARAMETERS

input : str, @-file, list of filenames
Filename(s) of image to be processed.
pixvalue : float
Pixel value from input file to be replaced. [Default: np.nan]
newvalue : float
New pixel value to use to replace pixvalue. [Default: 0.0]
ext : int, list of ints, None
Extensions from input file to process with new pixel values. If None (default), all image extensions (and only image extensions) will be processed.

Usage

It can be called from within Python using the syntax:

>>> from drizzlepac import pixreplace
>>> pixreplace.replace('adriz_nanSCI_drz.fits')
or
>>> epar pixreplace

EXAMPLES

  1. Replace all pixels in all extensions which have a value of NaN in ‘adriz_nanSCI_drz.fits’ with a constant value of 0.0.
>>> from drizzlepac import pixreplace
>>> pixreplace.replace('adriz_nanSCI_drz.fits')
  1. Replace pixels in first extension only which have a value of NaN in both ‘j8c061vnq_drc.fits’ and ‘j8c061nyq_drc.fits’ with a constant value of 0.0.
>>> pixreplace.replace('j8c061vnq_drc.fits,j8c061nyq_drc.fits', ext=1)
  1. Replace pixels in first and fourth extensions which have a value of 0.0 in ‘adriz_nanSCI_drz.fits’ with a value of -999.
>>> pixreplace.replace('adriz_nanSCI_drz.fits',pixvalue=0.0, newvalue=-999, ext=[1,4])
drizzlepac.pixreplace.replace(input, **pars)[source]

Replace pixels in input that have a value of pixvalue with a value given by newvalue.