NL

class romanisim.nonlinearity.NL(coeffs, dq=None, gain=None, saturation=None)

Bases: object

Keep track of non-linearity and inverse non-linearity coefficients.

Construct an NL class handling non-linearity correction.

Parameters:
coeffsnp.ndarray[ncoeff, nx, ny] (float)

Non-linearity coefficients from reference files.

dqnp.ndarray[n_resultant, nx, ny]

Data Quality array

gainfloat or np.ndarray[float]

Gain in electron/DN for converting DN to electrons

saturationfloat or None

Saturation level in DN

Methods Summary

apply(counts[, electrons, reversed])

Compute the correction of DN to linearized DN.

Methods Documentation

apply(counts, electrons=False, reversed=False)

Compute the correction of DN to linearized DN.

Alternatively, when electrons = True, rescale these to DN, correct the DN, and scale them back to electrons using the gain.

Parameters:
countsnp.ndarray[nx, ny] (float)

The observed counts in DN (or electrons if electrons=True)

electronsbool

Set to True for ‘counts’ being in electrons, with coefficients designed for DN. Accordingly, the gain needs to be removed and reapplied.

reversedbool

If True, the coefficients are in reversed order, which is the order that np.polyval wants them. One can maybe save a little time reversing them once ahead of time.

Returns:
correctednp.ndarray[nx, ny] (float)

The corrected DN or electrons (matching input units).