validate_pixel_indices

sofia_redux.scan.source_models.source_numba_functions.validate_pixel_indices(indices, x_size, y_size, valid_frame=None)[source]

Set pixel indices outside of the map range to (0, 0).

Parameters:
indicesnumpy.ndarray (int)

Pixel indices of shape (2, n_frames, n_channels) containing the (x, y) pixel indices. Any invalid sample (frame, channel) will be updated to (-1, -1) in-place.

x_sizeint

The size of the map in x.

y_sizeint

The size of the map in y.

valid_framenumpy.ndarray (bool), optional

An optional flag mask where False excludes the given frame from the bad sample count (return value).

Returns:
bad_samplesint

The number of pixels that fall outside the range of the map extent.