Skip to content

Commit 66e887c

Browse files
nanmean to nanmedian when fitting linear stage trajectory, avoids buggy behavior
1 parent 885dd77 commit 66e887c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/reconstruction/lookup.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ def fit_plane_trajectory(calibration_directory):
830830

831831
tvecs = np.squeeze(np.array(tvecs))
832832
rvecs = np.squeeze(np.array(rvecs))
833-
median_rvec = np.nanmean(rvecs, axis=0)
833+
median_rvec = np.nanmedian(rvecs, axis=0)
834834

835835
C, N = fit_line(tvecs[~np.isnan(tvecs).any(axis=1)])
836836
if np.dot(N, [0, 0, 1]) > 0:
@@ -843,7 +843,7 @@ def fit_plane_trajectory(calibration_directory):
843843
# so we don't need to divide it by that to get the step in the N direction
844844
steps = np.dot(np.diff(tvecs, axis=0), N)
845845
idx = np.abs(steps - np.nanmedian(steps)) < np.nanstd(steps)
846-
stride = np.nanmean(steps[idx])
846+
stride = np.nanmedian(steps[idx])
847847

848848
save_json({
849849
'stride': stride,

0 commit comments

Comments
 (0)