deepof.annotation_utils.stationary_lookaround
- deepof.annotation_utils.stationary_lookaround(speed_dframe: DataFrame, dist_dframe: DataFrame, likelihood_dframe: DataFrame, mouse_identity: str, close_range: ndarray, tol_speed: float, tol_likelihood: float, min_length: int, animal_id: str = '')
Return true when the mouse is standing still and looking around (moving nose without head being tilted too much).
- Design considerations:
Detecting immobility and activity is relatively straightforward by mostly just checking speed thresholds on bodyparts. The main problem arises from getting a lot of “flickering” out of the detections, as bodyparts from frame to frame may be just above or below that threshold. Respectively most of the detect_activity algorithm is a series of filtering steps to alternatingly smooth the predictions and sharpening the edges of predicted behavior.
- Parameters:
speed_dframe (pandas.DataFrame) – speed of body parts over time
dist_dframe (pandas.DataFrame) – distance between body parts over time
likelihood_dframe (pandas.DataFrame) – likelihood of body part tracker over time, as directly obtained from DeepLabCut
mouse_identity (str) – animal id without the _
close_range (np.ndarray) – boolean array that denotes if the nose of the current mouse is close to any other mouse for each frame.
tol_speed (float) – Maximum tolerated speed for the center of the mouse
tol_likelihood (float) – Maximum tolerated likelihood for the nose.
min_length (int) – minimum length that True segments need to have to not get filtered out.
animal_id (str) – ID of the current animal.
- Returns:
True if the animal is standing still and looking around (moving nose without head being tilted too much), False otherwise
- Return type:
stationary_lookaround (np.array)