sync_map_samples¶
- sofia_redux.scan.source_models.source_numba_functions.sync_map_samples(frame_data, frame_valid, frame_gains, channel_indices, map_values, map_valid, map_masked, map_indices, base_values, base_valid, source_gains, sync_gains, sample_flags, sample_blank_flag)[source]¶
Remove map source gains from frame data and flag samples.
For a given sample at frame i and channel j, frame data d_{i,j} will be decremented by dg where:
dg = fg * ( (gain(source) * map[index]) - (gain(sync) * base[index]) )
Here, fg is the frame gain and index is the index on the map of sample (i,j).
Any masked map value will result in matching samples being flagged.
- Parameters:
- frame_datanumpy.ndarray (float)
The frame data of shape (n_frames, all_channels). Data will be updated in-place.
- frame_validnumpy.ndarray (bool)
A boolean mask of shape (n_frames,) where
False
excludes a frame from all processing.- frame_gainsnumpy.ndarray (float)
An array of frame gains of shape (n_frames,).
- channel_indicesnumpy.ndarray (int)
The channel indices of shape (n_channels,) for which to sync map gains.
- map_valuesnumpy.ndarray (float)
The current map supplied as a regular grid of arbitrary shape and dimensions (image_shape,).
- map_validnumpy.ndarray (bool)
A boolean mask of shape (image_shape,) where
False
excludes a map element from synchronization.- map_maskednumpy.ndarray (bool)
A boolean mask of shape (image_shape,) where
True
will result in any frame/channel sample being flagged with thesample_blank_flag
flag. Similarly,False
will unflag samples.- map_indicesnumpy.ndarray (int)
The sample map indices of shape (n_dimensions, n_frames, all_channels) where dimensions are ordered in (x,y) FITS format. These contain map (pixel) indices for each sample. For pixel maps, all pixels will have zero position values, so the array should be of shape (n_dimensions, n_frames, 1) in this case.
- base_valuesnumpy.ndarray (float)
The base map values (priors) of shape (image_shape,).
- base_validnumpy.ndarray (bool)
A boolean mask of shape (image_shape,) where
False
indicates that the corresponding base map value is invalid and will be set to zero during processing.- source_gainsnumpy.ndarray (float)
The channel source gains of shape (all_channels,).
- sync_gainsnumpy.ndarray (float)
The prior channel source gains of shape (all_channels,).
- sample_flagsnumpy.ndarray (int)
The sample flags of shape (n_frames, all_channels,). Will be updated in-place.
- sample_blank_flagint
The integer flag with which to flag samples that contain a masked map value.
- Returns:
- None