deepof.utils.multi_step_paired_smoothing

deepof.utils.multi_step_paired_smoothing(behavior_in: array, not_behavior: array | None = None, exclude: array | None = None, min_length: int = 6, get_both: bool = False) array

This filtering approach will first gradually merge together very close behavioral instances (how close is regulated by min_length), then filter out remaining short instances. In this way multiple instances close to each other are kept and united and isolated very short bursts are filtered out. It replaces the kleinberg filtering approach with a similar idea as kleinberg was too susceptible to merge events together that were relatively distant on the time scale.

Args:

behavior_in (numpy.ndarray): Boolean instances of detected raw behavior. not_behavior (numpy.ndarray): Boolean instances of raw behavior not occuring. exclude (numpy.ndarray): Additional boolean instances that will always be rated as “no behavior”. min_length (int): Determines the degree of smoothing. The smaller, the more short behavioral instances are kept and the sharper the behavioral edges remain. get_both (bool): If True, will also return the not_behavior instances that get smoothed along with the behavior instances.

Returns:

behavior (numpy.ndarray): Smoothened boolean instances. not_behavior (numpy.ndarray): Smoothened boolean not-behavior instances.