Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix validation crash if no reference data was collected #2137

Merged
merged 4 commits into from
Apr 26, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions pupil_src/shared_modules/accuracy_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ def empty() -> "CorrelatedAndCoordinateTransformedResult":
camera_space=np.ndarray([]),
)

@property
def is_valid(self) -> bool:
if len(self.norm_space.shape) != 2:
return False
# TODO: Make validity check exhaustive
return True


class CorrelationError(ValueError):
pass
Expand All @@ -78,6 +85,13 @@ def failed() -> "AccuracyPrecisionResult":
correlation=CorrelatedAndCoordinateTransformedResult.empty(),
)

@property
def is_valid(self) -> bool:
if not self.correlation.is_valid:
return False
# TODO: Make validity check exhaustive
return True


class ValidationInput:
def __init__(self):
Expand Down Expand Up @@ -371,6 +385,9 @@ def recalculate(self):
succession_threshold=self.succession_threshold,
)

if not results.is_valid:
return
romanroibu marked this conversation as resolved.
Show resolved Hide resolved

accuracy = results.accuracy.result
if np.isnan(accuracy):
self.accuracy = None
Expand Down