Correcting non-linearity

dm-dev
Tags: #<Tag:0x00007f61a62e7b10>

(Russell Owen) #1

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 in IsrTask).
  • LinearizeSquared performs a simple square correction: corrImage = uncorrImage + c0*uncorrImage^2 where c0 is the first coefficient in in the linearity coefficients of the amp into catalog. This is the model used by obs_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 define map_linearize and bypass_linearize methods on the camera mapper to return an instance; see the obs_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 leave IsrConfig.doLinearize set to its default value of True without significant performance penalty.

(Andres Alejandro Plazas Malagon) #2

The work on DM-23023 implements linearity correction for Instrument Signature Removal (ISR) following the discussion and proposal in RFC-665, as an extension of what was adopted and explained in this post.

RFC-665 has a detailed explanation in its description of the changes adopted and implemented.

An important difference in this implementation is that instances of the new Linearizer class are detector-specific; it is no longer possible to use one instance for all detectors, as was suggested in the parent post