Here's an actual description of the proxy flux. We have two measurements for the linearity, an independent variable (a photodiode charge or an exposure time, called `X` below), and a dependent variable (the measured flux, called `F` below).

We know/strongly suspect that `F` isn't linear in `X`, such that `F = g0 + g1*X + g2*X^2 + ...`. When `X` is small, we're in a linear regime, so we can ignore `g2` and higher order terms. The ~~DM-26845~~ linearity code does this by filtering `F`, using two config options, such that only values `minLinearAdu < F < maxLinearAdu` are retained. `minLinearAdu` should likely be set to zero, but due to the use of neutral density filters, a non-zero value may be necessary (possibly only when `X` is the exposure time).

The filtered values, `f` and `x`, are then fit with a linear fit `f = h0 + h1*x`. With this, the full set of `X` can be converted into the proxy flux `L`, by calculating `L = h0 + h1 * X`. In this transformed coordinate, `F = k0 + k1*L + k2*L^2 + ...`, which is identical to what we had before, but with the result that `k0 = 0` and `k1 = 1`. This removes any need for rescaling the final measured linearity, and moves the problem to the regime of "measured flux" as a function of "ideal linear flux". This also makes the fits independent of the scaling of `X`, so exposure time and photodiode results can be directly compared.

Here's an actual description of the proxy flux. We have two measurements for the linearity, an independent variable (a photodiode charge or an exposure time, called

Xbelow), and a dependent variable (the measured flux, calledFbelow).We know/strongly suspect that

Fisn't linear inX, such thatF = g0 + g1*X + g2*X^2 + .... WhenXis small, we're in a linear regime, so we can ignoreg2and higher order terms. The~~DM-26845~~linearity code does this by filteringF, using two config options, such that only valuesminLinearAdu < F < maxLinearAduare retained.minLinearAdushould likely be set to zero, but due to the use of neutral density filters, a non-zero value may be necessary (possibly only whenXis the exposure time).The filtered values,

fandx, are then fit with a linear fitf = h0 + h1*x. With this, the full set ofXcan be converted into the proxy fluxL, by calculatingL = h0 + h1 * X. In this transformed coordinate,F = k0 + k1*L + k2*L^2 + ..., which is identical to what we had before, but with the result thatk0 = 0andk1 = 1. This removes any need for rescaling the final measured linearity, and moves the problem to the regime of "measured flux" as a function of "ideal linear flux". This also makes the fits independent of the scaling ofX, so exposure time and photodiode results can be directly compared.