deepof.annotation_utils.calculate_close_range

deepof.annotation_utils.calculate_close_range(df: DataFrame, mouse_id: str, bodypart: str, threshold: float)

Detects for a given set of mouse coordinates if the selected bodypart of the selected mouse is close to any bodypart of any other mouse for each frame.

Parameters:
  • df (pd.DataFrame) – Dataframe containing coordinates of multiple mice

  • mouse_id (str) – Id of the target mouse

  • bodypart (str) – Bodypart of the target mouse that should be used for distance calculation

  • threshold (float) – Maximum distance that triggers “closeness”

Returns:

Boolean numpy array set to True for each frame in which the lected bodypart of the selected mosue was closer than threshold to any other mouse, False otherwise.

Return type:

proximity_mask (np.array)