calculate_filtering

sofia_redux.scan.signal.signal_numba_functions.calculate_filtering(channel_indices, channel_dependents, overlaps, channel_valid, n_parms, channel_source_filtering, signal_source_filtering)[source]

Calculate the new signal and channel source filtering.

Updates the channel and source filtering by removing the prior correction to the channel filtering before calculating and applying the new corrections to both:

sf = 1 - phi cf = (cf_prior / sf_prior) * sf

where sf is the signal source filtering and cf is the channel source filtering. phi is given by:

phi[i] = sum_{i != j}(overlaps[i, j] * dependents[j]) / n_parms

for channel i using the fractional overlaps between channels i and j and the channel dependents for channel j.

Parameters:
channel_indicesnumpy.ndarray (int)

The channel indices for which all channel type data is applicable. This is an array of shape (n_channels,) which maps n_channels onto all_channels (used in channel_dependents).

channel_dependentsnumpy.ndarray (float)

The channel dependent values of shape (all_channels,).

overlapsnumpy.ndarray (float)

The channel overlap values of shape (n_channels, n_channels) where overlaps[i, j] gives the overlap value between channel i and j and should therefore be triangularly symmetrical.

channel_validnumpy.ndarray (bool)

A boolean mask of shape (n_channels,) where False excludes a given channel from being included in any derivations.

n_parmsfloat

The relative degrees of freedom for the signal. Typically given by sum(weights > 0) * (1 - 1/n_drifts).

channel_source_filteringnumpy.ndarray (float)

The current channel source filtering of shape (n_channels,).

signal_source_filteringnumpy.ndarray (float)

The current signal source filtering of shape (n_channels,).

Returns:
new_channel_filtering, new_signal_filteringndarray, ndarray

The updated channel and signal source filtering, both of shape (n_channels,).