calculate_coupling_increment¶
- sofia_redux.scan.source_models.source_numba_functions.calculate_coupling_increment(map_indices, base_values, map_values, map_noise, sync_gains, source_gains, frame_data, frame_weight, frame_gains, frame_valid, sample_flags, channel_indices, min_s2n, max_s2n, exclude_flag)[source]¶
Calculate and return the coupling increment factor.
The coupling increment factor may be used to increment current coupling values and weights for each channel by:
increment = sum_{frames}(fw * residual * expected) / sum_{frames}(fw * expected^2)
where fw are the frame weights, d are the frame data and:
expected = frame_gain * channel_source_gain * map_value prior = frame_gain * channel_sync_gain * base_value residual = d + prior - expected
The channel sync gains and base values are the channel source gains and map values from the previous iteration.
- Parameters:
- map_indicesnumpy.ndarray (int)
The indices of each frame/channel sample on the source map. Should be of shape (n_dimensions, n_frames, all_channels) with dimensions in (x, y) FITS order.
- base_valuesnumpy.ndarray (float)
An image of arbitrary grid shape in n_dimensions. Contains the base map values (priors).
- map_valuesnumpy.ndarray (float)
The current map image of arbitrary grid shape in n_dimensions.
- map_noisenumpy.ndarray (float)
The current map noise values of arbitrary grid shape in n_dimensions.
- sync_gainsnumpy.ndarray (float)
The previous channel source gains (sync gains) of shape (all_channels,).
- source_gainsnumpy.ndarray (float)
The current channel source gains of shape (all_channels,).
- frame_datanumpy.ndarray (float)
The integration frame data of shape (n_frames, all_channels,).
- frame_weightnumpy.ndarray (float)
The relative frame weights of shape (n_frames,).
- frame_gainsnumpy.ndarray (float)
The frame gains of shape (n_frames,).
- frame_validnumpy.ndarray (bool)
A boolean mask of shape (n_frames,) where
False
excludes a frame from processing.- sample_flagsnumpy.ndarray (int)
The integration sample flags of shape (n_frames, all_channels) where any sample flagged with
exclude_flag
will be excluded from processing.- channel_indicesnumpy.ndarray (int)
The channel indices for which to calculate coupling increments of shape (n_channels,).
- min_s2nfloat
The minimum signal-to-noise ratio on the map for which to calculate coupling increments.
- max_s2nfloat
The maximum signal-to-noise ratio on the map for which to calculate coupling increments.
- exclude_flagint
An integer flag used to exclude samples from processing.
- Returns:
- coupling_incrementnumpy.ndarray (float)
The coupling increment factors of shape (all_channels,).