Skip to content
Snippets Groups Projects
Commit 9ca63ba9 authored by Chad Hanna's avatar Chad Hanna
Browse files

metric.py: add pseudo match

parent d9b5d9c6
No related branches found
No related tags found
No related merge requests found
...@@ -49,8 +49,8 @@ output = [] ...@@ -49,8 +49,8 @@ output = []
for n, vec1, in enumerate(vec1s): for n, vec1, in enumerate(vec1s):
g, det = g_ij(vec1[1:]) g, det = g_ij(vec1[1:])
def match(vec2, vec1 = vec1, g = g): def match(vec2, vec1 = vec1, g = g):
return (vec1[0], vec2[0], g_ij.metric_match(g, vec1[1:], vec2[1:])) return (vec1[0], vec2[0], g_ij.pseudo_match(g, vec1[1:], vec2[1:]))
thisoutput = [row for row in map(match, vec2s) if row[2] > 0.0] thisoutput = [row for row in map(match, vec2s) if row[2] > 0.01]
print n, len(thisoutput) print n, len(thisoutput)
output += thisoutput output += thisoutput
......
...@@ -410,6 +410,11 @@ class Metric(object): ...@@ -410,6 +410,11 @@ class Metric(object):
else: else:
return 0. 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
def explicit_match(self, c1, c2): def explicit_match(self, c1, c2):
def fftmatch(w1, w2): def fftmatch(w1, w2):
......
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