A Classic Nonlinearity Correction Algorithm for Detectors Read Out Up-The-Ramp
Timothy D. Brandt
TL;DR
This work tackles correcting classic nonlinearity in up-the-ramp nondestructive readouts under constant illumination by deriving a forward polynomial correction $z_i = \sum_{k=0}^N a_k y_i^k$ fitted via a covariance-aware $\chi^2$ across many ramps with varying illumination. It reformulates the problem in terms of read-difference statistics $g_{i,k}$ and solves a linear system $\mathbf{A}\mathbf{a} = \boldsymbol{\xi}$ for the nonlinear coefficients, while enforcing a constraint on the total ramp slope to avoid degeneracy; conditioning is improved using a Legendre basis. The method is validated on synthetic data, revealing that high-order corrections (up to $N \approx 9$–$20$) are often required and that biases can arise when mixing ramps with different count rates, with recommended mitigations such as grouping ramps by count-rate or neglecting photon-noise in the covariance. Applied to Roman-WFI detector data, the approach achieves good formal agreement for $N \ge 9$ and demonstrates practical feasibility for large-format detectors, supported by an open-source Python implementation. Overall, the algorithm provides a scalable, statistically principled way to derive nonlinearity corrections from heterogeneous ramp data, enabling accurate linearization across wide dynamic ranges.
Abstract
We derive an algorithm for computing a classic nonlinearity correction -- applicable to constant and uniform illumination -- in the presence of read noise and photon noise. The algorithm operates simultaneously on many nondestructive ramps at a range of count rates and directly computes the function transforming measured counts into linearized counts. We also compute chi squared for the corrected ramps, enabling the user to identify the polynomial degree beyond which chi squared ceases to improve significantly. The computational cost of our algorithm is linear in the number of reads and ramps, reaching ~100 hours to derive a correction for all 4096 x 4096 pixels of a Hawaii-4 RG detector from 186 illuminated 55-read ramps on a 2023 Macbook Pro laptop (~10,000 reads per pixel). We identify a potential source of bias in the nonlinearity correction when combining ramps of very different illuminations, together with effective mitigations. We apply our algorithm to a random set of pixels from the Roman Space Telescope's Wide Field Instrument. We find that a >=9th order nonlinearity correction is needed, at which point chi squared is close to its theoretically expected value and beyond which chi squared improves little with increasing polynomial order. Python software implementing our algorithm is available at https://github.com/RomanSpaceTelescope/SOCReferenceFileCode.
