get_mem_correction

sofia_redux.scan.flags.flag_numba_functions.get_mem_correction(data, noise, multiplier=0.1, valid=None, model=None)[source]

Determine the Maximum-Entropy-Method (MEM) correction.

The MEM correction is given by:

dx = sign(x) * n * multiplier * log(sqrt(x^2 + n^2) / sqrt(m^2 + n^2))

Where x is a data value, n is the noise, and m is the model. Any invalid values (NaN, zero-divisions, marked invalid etc.) will result in zero valued MEM correction (dx) on output.

Parameters:
datanumpy.ndarray (float)

A data array of values with arbitrary shape (shape,).

noisenumpy.ndarray (float)

The noise array with shape (shape,).

multiplierfloat, optional

The Lagrange multiplier.

validnumpy.ndarray (bool), optional

A boolean mask of shape (shape,) where False excludes an element from the MEM correction.

modelnumpy.ndarray (float), optional

An optional model of shape (shape,). By default, all model values are zero.

Returns:
mem_correctionnumpy.ndarray (float)

The MEM correction of shape (shape,).