find_inconsistencies

sofia_redux.scan.custom.hawc_plus.integration.hawc_integration_numba_functions.find_inconsistencies(frame_valid, frame_data, frame_weights, modeling_frames, frame_parms, sample_flags, exclude_sample_flag, channel_indices, channel_parms, min_jump_level_frames, jump_flag, fix_each, fix_subarray, has_jumps, subarray, jump_counter, drift_size, flag_before=0, flag_after=0)[source]

Find, fix (or flag) jumps and return the number corrected per channel.

This function is a wrapper around fix_jumps() the processes chunks of frames (the size of which is determined by drift_size) sequentially, and returns the number of chunk blocks found with jumps for each channel. Jumps may be ignored, levelled, or flagged depending on min_jump_level_frames, fix_each, and fix_subarray.

Parameters:
frame_validnumpy.ndarray (bool)

A boolean mask of shape (n_frames,) where False excludes a frame from any processing.

frame_datanumpy.ndarray (float)

The frame data values of shape (n_frames, all_channels).

frame_weightsnumpy.ndarray (float)

The relative frame weights of shape (n_frames,).

modeling_framesnumpy.ndarray (bool)

A boolean mask of shape (n_frames,) where True marks a frame as a modeling frame. Modeling frames will still be levelled, but will not be included when updating the frame or channel dependents.

frame_parmsnumpy.ndarray (float)

The frame dependents. Will be updated in-place if levelling occurs.

sample_flagsnumpy.ndarray (int)

The frame data sample flags. Typically non-zero samples will be excluded from processing. However, those samples not flagged with only exclude_sample_flag will be included.

exclude_sample_flagint

The sample flag to explicitly exclude from processing.

channel_indicesnumpy.ndarray (int)

The channel indices of shape (n_channels,) indicating which channels to process and mapping n_channels onto all_channels.

channel_parmsnumpy.ndarray (float)

The channel dependents of shape (all_channels,). Will be updated in-place when levelling occurs.

min_jump_level_framesint

The minimum number of frames in a jump block required for levelling. If this value is not reached, all samples in the block are flagged with jump_flag instead.

jump_flagint

The integer flag identifier with which to flag samples if the jump block length to which they belong is less than min_jump_level_frames and cannot be levelled.

fix_eachbool

If False, do not fix any channel with jumps.

fix_subarraynumpy.ndarray (bool)

An array of shape (n_subarrays,) where True indicates that any channel belonging to that subarray should have jumps corrected. Ignored if fix_each is False.

has_jumpsnumpy.ndarray (bool)

A boolean mask of shape (n_channels,) where True indicates that a channel has jumps that may be corrected.

subarraynumpy.ndarray (int)

An array of shape (n_channels,) containing the subarray number for each channel.

jump_counternumpy.ndarray (int)

The channel jumps of shape (n_frames, n_channels).

drift_sizeint

The number of frames that constitute a single chunk that will have jumps either levelled or flagged (see min_jump_level_frames). Each chunk will be processed separately.

flag_beforeint, optional

The number of frames to flag in the sample flags prior to a jump detection with jump_flag.

flag_afterint, optional

The number of frames to flag in the sample flags following a jump detection with jump_flag.

Returns:
inconsistenciesnumpy.ndarray (int)

An array of shape (n_channels,) containing the number of frame blocks found in the data that contain jumps which have either been levelled or flagged for each channel.