Skip to content

Commit

Permalink
Clean up accuracy visualizer logs
Browse files Browse the repository at this point in the history
  • Loading branch information
papr committed Sep 21, 2021
1 parent 61208b8 commit 846a174
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions pupil_src/shared_modules/accuracy_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ def update(
and self.gazer_class_name != gazer_class_name
):
logger.debug(
f'Overwriting gazer_class_name from "{self.gazer_class_name}" to "{gazer_class_name}" and resetting the input.'
f'Overwriting gazer_class_name from "{self.gazer_class_name}" to '
f'"{gazer_class_name}" and resetting the input.'
)
self.clear()

Expand Down Expand Up @@ -275,7 +276,8 @@ def ignore(_):
self,
"Angular Accuracy",
setter=ignore,
getter=lambda: self.accuracy
getter=lambda: f"{self.accuracy.result:.3f} deg. Samples used: "
f"{self.accuracy.num_used} / {self.accuracy.num_total}"
if self.accuracy is not None
else "Not available",
)
Expand All @@ -287,7 +289,8 @@ def ignore(_):
self,
"Angular Precision",
setter=ignore,
getter=lambda: self.precision
getter=lambda: f"{self.precision.result:.3f} deg. Samples used: "
f"{self.precision.num_used} / {self.precision.num_total}"
if self.precision is not None
else "Not available",
)
Expand Down Expand Up @@ -391,29 +394,23 @@ def recalculate(self):
logger.warning(NOT_ENOUGH_DATA_COLLECTED_ERR_MSG)
return

accuracy = results.accuracy.result
if np.isnan(accuracy):
if np.isnan(results.accuracy.result):
self.accuracy = None
logger.warning(
"Not enough data available for angular accuracy calculation."
)
else:
self.accuracy = accuracy
logger.info(
"Angular accuracy: {}. Used {} of {} samples.".format(*results[0])
)
self.accuracy = results.accuracy
logger.info(f"Angular accuracy: {results.accuracy.result:.3f}.")

precision = results.precision.result
if np.isnan(precision):
if np.isnan(results.precision.result):
self.precision = None
logger.warning(
"Not enough data available for angular precision calculation."
)
else:
self.precision = precision
logger.info(
"Angular precision: {}. Used {} of {} samples.".format(*results[1])
)
self.precision = results.precision
logger.info(f"Angular precision: {results.precision.result:.3f} degrees.")

self.error_lines = results.error_lines
ref_locations = results.correlation.norm_space[1::2, :]
Expand Down Expand Up @@ -489,8 +486,8 @@ def calc_acc_prec_errlines(
"ij,ij->i", undistorted_3d[:-1, 3:], undistorted_3d[1:, 3:]
)

# if the ref distance is to big we must have moved to a new fixation or there is headmovement,
# if the gaze dis is to big we can assume human error
# if the ref distance is to big we must have moved to a new fixation or there is
# headmovement, if the gaze dis is to big we can assume human error
# both times gaze data is not valid for this mesurement
selected_indices = np.logical_and(
succesive_distances_gaze > succession_threshold,
Expand Down

0 comments on commit 846a174

Please sign in to comment.