Skip to content

Commit 7a29ced

Browse files
committed
updates
1 parent b4bc285 commit 7a29ced

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

amadeusgpt/analysis_objects/animal.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,16 @@ def get_path(self, ind):
9292
codes, verts = zip(*path_data)
9393
return mpath.Path(verts, codes)
9494

95-
def get_keypoints(self, average_keypoints=False) -> ndarray:
96-
if average_keypoints:
97-
return np.nanmedian(self.keypoints, axis=1)
95+
def get_keypoints(self) -> ndarray:
96+
# the shape should be (n_frames, n_keypoints, 2)
97+
# extending to 3D?
98+
assert len(self.keypoints.shape) == 3, f"keypoints shape is {self.keypoints.shape}"
9899
return self.keypoints
99100

100101
def get_center(self):
102+
"""
103+
median is more robust than mean
104+
"""
101105
return np.nanmedian(self.keypoints, axis=1).squeeze()
102106

103107
def get_xmin(self):
@@ -222,3 +226,9 @@ def calc_head_cs(self):
222226

223227

224228

229+
if __name__ == "__main__":
230+
# unit testing the shape of kinematics data
231+
# acceleration, acceleration_mag, velocity, speed, and keypoints
232+
233+
234+

0 commit comments

Comments
 (0)