Correct non-linearity with a persisted lookup table
for each i,j of image:
rowInd = int(c0)
colInd = int(c1 + uncorrImage[i,j])
corrImage[i,j] = uncorrImage[i,j] + table[rowInd, colInd]
where c0, c1 are collimation coefficients from the AmpInfoTable of the detector:
- c0: row index; used to identify which row of the table to use (typically one per amplifier,
though one can have multiple amplifiers use the same table)
- c1: column index offset; added to the uncorrected image value before truncation;
this supports tables that can handle negative image values; also, if the c1 ends with .5
then the nearest index is used instead of truncating to the next smaller index
In order to keep related data together, the coefficients are persisted along with the table.
Definition at line 92 of file linearize.py.
def lsst.ip.isr.linearize.LinearizeLookupTable.__init__ |
( |
|
self, |
|
|
|
table, |
|
|
|
detector |
|
) |
| |
Construct a LinearizeLookupTable
@param[in] table lookup table; a 2-dimensional array of floats:
- one row for each row index (value of coef[0] in the amp info catalog)
- one column for each image value
To avoid copying the table the last index should vary fastest (numpy default "C" order)
@param[in] detector detector information (an instance of lsst::afw::cameraGeom::Detector);
the name, serial, and amplifier linearization type and coefficients are saved
@throw RuntimeError if table is not 2-dimensional,
table has fewer columns than rows (indicating that the indices are swapped),
or if any row index (linearity coefficient 0) is out of range
Definition at line 111 of file linearize.py.
def lsst.ip.isr.linearize.LinearizeLookupTable.__call__ |
( |
|
self, |
|
|
|
image, |
|
|
|
detector, |
|
|
|
log = None |
|
) |
| |
Correct for non-linearity
@param[in] image image to be corrected (an lsst.afw.image.Image)
@param[in] detector detector info about image (an lsst.afw.cameraGeom.Detector);
the name, serial and number of amplifiers must match persisted data;
the bbox from each amplifier is read;
the linearization coefficients are ignored in favor of the persisted values
@param[in] log logger (an lsst.log.Log), or None to disable logging;
a warning is logged if any pixels are out of range of their lookup table
@return an lsst.pipe.base.Struct containing:
- numAmps number of amplifiers found
- numLinearized number of amplifiers linearized (always equal to numAmps for this linearizer)
- numOutOfRange number of pixels out of range of their lookup table (summed across all amps)
@throw RuntimeError if the linearity type is wrong or if the detector name, serial
or number of amplifiers does not match the saved data
Definition at line 151 of file linearize.py.