Commit cadd739b authored by lucas_miranda's avatar lucas_miranda
Browse files

Fixed a bug that made contacts too stringent

parent 1f24a2f9
......@@ -56,7 +56,7 @@ class project:
exclude_bodyparts: List = tuple([""]),
exp_conditions: dict = None,
interpolate_outliers: str = "MA",
interpolation_limit: int = 15,
interpolation_limit: int = 5,
interpolation_std: int = 2,
likelihood_tol: float = 0.75,
model: str = "mouse_topview",
......
......@@ -654,15 +654,16 @@ def tag_rulebased_frames(
cv2.ellipse(frame, arena[0], arena[1], arena[2], 0, 360, (0, 255, 0), 3)
# Print body parts for debuging
for bpart in coords.columns.levels[0]:
cv2.circle(
frame,
(int(coords[bpart]["x"][fnum]), int(coords[bpart]["y"][fnum])),
radius=3,
color=(
(255, 0, 0) if bpart.startswith(animal_ids[0]) else (0, 0, 255)
),
thickness=-1,
)
if not np.isnan(coords[bpart]["x"][fnum]):
cv2.circle(
frame,
(int(coords[bpart]["x"][fnum]), int(coords[bpart]["y"][fnum])),
radius=3,
color=(
(255, 0, 0) if bpart.startswith(animal_ids[0]) else (0, 0, 255)
),
thickness=-1,
)
# Print frame number
write_on_frame("Frame " + str(fnum), corners["downleft"])
......
......@@ -395,9 +395,9 @@ def mask_outliers(
mask = None
if mode == "and":
mask = outlier_mask_x & outlier_mask_y & outlier_mask_l
mask = (outlier_mask_x & outlier_mask_y) | outlier_mask_l
elif mode == "or":
mask = (outlier_mask_x | outlier_mask_y) & outlier_mask_l
mask = (outlier_mask_x | outlier_mask_y) | outlier_mask_l
return mask
......@@ -490,6 +490,7 @@ def interpolate_outliers(
interpolated_exp.interpolate(
method="linear", limit=limit, limit_direction="both", inplace=True
)
interpolated_exp[np.isnan(interpolated_exp)] = np.nan
return interpolated_exp
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment