fix_block

sofia_redux.scan.custom.hawc_plus.integration.hawc_integration_numba_functions.fix_block(from_frame, to_frame, frame_valid, frame_data, frame_weights, modeling_frames, frame_parms, sample_flags, exclude_sample_flag, channel, channel_parms, min_jump_level_frames, jump_flag, skip_start=0, skip_end=0)[source]

Jump correct a block of frames for a given channel.

See fix_jumps() for further details. This function essentially compares the jump block length with min_jump_level_frames and determines whether the block should be flagged or levelled. If the number of frames in the block (to_frame - from_frame) is >= min_jump_level_frames, then leveling will occur. Otherwise, all samples in the block will be flagged with the jump_flag.

Parameters:
from_frameint

The starting frame from which to begin jump correction.

to_frameint

The end frame (non-inclusive) at which to conclude jump correction.

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.

channelint

The channel to process.

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.

skip_startint, optional

The number of frames before the jump to not include in levelling determinations.

skip_endint, optional

The number of frames at the end of the block jump to not include in levelling determinations.

Returns:
None