ResetBits Update of Input
This module provides the capability to set a specific set of bit values in the input DQ arrays to zero. This allows a user to reset pixels previously erroneously flagged as cosmic-rays to good for reprocessing with improved alignment or detection parameters.
resetbits - A module to set the value of specified array pixels to zero
This module allows a user to reset the pixel values of any integer array, such as the DQ array from an HST image, to zero.
- Authors:
Warren Hack
- License:
PARAMETERS
- filenamestr
full filename with path
- bitsstr
sum or list of integers corresponding to all the bits to be reset
Optional Parameters
- extverint, optional
List of version numbers of the arrays to be corrected (default: None, will reset all matching arrays)
- extnamestr, optional
EXTNAME of the arrays in the FITS files to be reset (default: ‘dq’)
NOTES
This module performs a simple bitwise-and on all the pixels in the specified array and the integer value provided as input using the operation (array & ~bits).
Usage
It can be called not only from within Python, but also from the host-level operating system command line using the syntax:
resetbits filename bits [extver [extname]]
EXAMPLES
The following command will reset the 4096 bits in all the DQ arrays of the file ‘input_flt.fits’:
resetbits input_flt.fits 4096
or from the Python command line:
>>> import resetbits >>> resetbits.reset_dq_bits("input_file_flt.fits", 4096)
To reset the 2,32,64 and 4096 (sum of 4194) bits in the second DQ array, specified as ‘dq,2’, in the file ‘input_flt.fits’:
resetbits input_flt.fits 4194 2
or from the Python command line:
>>> import resetbits >>> resetbits.reset_dq_bits("input_file_flt.fits", 2+32+64+4096, extver=2)
- drizzlepac.resetbits.reset_dq_bits(input, bits, extver=None, extname='dq')[source]
This function resets bits in the integer array(s) of a FITS file.
- Parameters:
- filenamestr
full filename with path
- bitsstr
sum or list of integers corresponding to all the bits to be reset
- extverint, optional
List of version numbers of the DQ arrays to be corrected [Default Value: None, will do all]
- extnamestr, optional
EXTNAME of the DQ arrays in the FITS file [Default Value: ‘dq’]
Notes
The default value of None for the ‘extver’ parameter specifies that all extensions with EXTNAME matching ‘dq’ (as specified by the ‘extname’ parameter) will have their bits reset.
Examples
The following command will reset the 4096 bits in all the DQ arrays of the file input_file_flt.fits:
reset_dq_bits("input_file_flt.fits", 4096)
To reset the 2,32,64 and 4096 bits in the second DQ array, specified as ‘dq,2’, in the file input_file_flt.fits:
reset_dq_bits("input_file_flt.fits", "2,32,64,4096", extver=2)