Skip to content
Snippets Groups Projects
Commit 80983e07 authored by chad.hanna's avatar chad.hanna
Browse files

metric.py: add some additional safety checks

parent 1cccfb82
No related branches found
No related tags found
No related merge requests found
Pipeline #84723 passed with warnings
......@@ -405,15 +405,18 @@ class Metric(object):
def metric_match(self, metric_tensor, c1, c2):
d2 = self.distance(metric_tensor, c1, c2)**2
if d2 < 1:
if d2 < 1 and d2 >= 0:
return 1 - d2
else:
return 0.
def pseudo_match(self, metric_tensor, c1, c2):
d2 = self.distance(metric_tensor, c1, c2)**2
d2 = (numpy.arctan(d2**.5 * numpy.pi / 2) / numpy.pi * 2)**2
return 1. - d2
if d2 < 1 and d2 >= 0:
d2 = (numpy.arctan(d2**.5 * numpy.pi / 2) / numpy.pi * 2)**2
return 1. - d2
else:
return 0.
def explicit_match(self, c1, c2):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment