DM-5462 and RFC-164 introduce a standard way to correct non-linearity (linearize data) as part of Instrument Signature Removal (ISR). This post provides an overview.
Linearization is performed by new functors in ip_isr:
-
LinearizeBase
is an abstract base class. It is called with an image and the detector information and the correction is performed in place (like all other ISR corrections inIsrTask
). -
LinearizeSquared
performs a simple square correction:corrImage = uncorrImage + c0*uncorrImage^2
wherec0
is the first coefficient in in the linearity coefficients of the amp into catalog. This is the model used byobs_subaru
for SuprimeCam and HSC. -
LinearizeLookupTable
uses a lookup table to determine an offset (read the code doc string for details). The lookup table is saved with the linearizer, but the linearizer also performs a sanity check against the provided detector when called. - You can easily add other linearizers as desired.
- Each linearizer has a class variable
LinearizationType
, a string whose value should be used as the linearization type in the amplifier info catalog. The linearizer checks this value when performing linearization.
All detector in a camera must use the same type of linearizer. However linearization can easily be disabled on a detector-by-detector basis by setting linearity type = lsst.afw.cameraGeom.NullLinearityType. For a camera that does not need linearization, do this for all detectors.
Linearizers are obtained from the butler, like any other calibration product.
- For
LinearizeSquared
and other linearizers that get coefficients from the amplifier info catalog, only one instance is needed for all detectors. In that case the simplest technique is to definemap_linearize
andbypass_linearize
methods on the camera mapper to return an instance; see theobs_subaru
package for an example. - For
LinearizeLookupTable
and other linearizers that store detector-specific data, the obs_ package developer must pickle one linearizer for each detector and make them available as dataset type “linearizer”. - If the camera does not want linearization then no “linearizer” dataset type is required because
IsrTask
realizes linearization is not wanted before it tries to unpersist the linearizer. You may leaveIsrConfig.doLinearize
set to its default value ofTrue
without significant performance penalty.