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:
- 
LinearizeBaseis 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).
- 
LinearizeSquaredperforms a simple square correction:corrImage = uncorrImage + c0*uncorrImage^2wherec0is the first coefficient in in the linearity coefficients of the amp into catalog. This is the model used byobs_subarufor SuprimeCam and HSC.
- 
LinearizeLookupTableuses 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 LinearizeSquaredand 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_linearizeandbypass_linearizemethods on the camera mapper to return an instance; see theobs_subarupackage for an example.
- For LinearizeLookupTableand 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 IsrTaskrealizes linearization is not wanted before it tries to unpersist the linearizer. You may leaveIsrConfig.doLinearizeset to its default value ofTruewithout significant performance penalty.