Skip to content
Snippets Groups Projects

Plot horizon distance from ranking statistics

Merged ChiWai Chan requested to merge plot_psd_horizon into master
1 unresolved thread
1 file
+ 4
1
Compare changes
  • Side-by-side
  • Inline
@@ -28,6 +28,8 @@ from ligo.lw.utils import ligolw_add
from ligo.lw.utils import coincs as ligolw_coincs
from ligo.lw.utils import process as ligolw_process
from gstlal import spawaveform
from scipy.spatial import Voronoi, ConvexHull, Delaunay
from scipy.spatial.qhull import QhullError
class ApproxID(object):
@@ -53,6 +55,7 @@ class ApproxID(object):
if self.in_hull(inj_point, region):
best_tmplt = self.vor.points[i]
tmplt_id = list(self.bank.keys())[np.where(np.sum(np.array(list(self.bank.values()))==best_tmplt,axis=1)==2)[0][0]]
#FIXME: this line can fail if self.in_hull(inj_point, region) is always False. We should find a more robust way to handle this
else:
tmplt_id = list(self.bank.keys())[np.argmin(abs(np.array(list(self.bank.values()))[:,0]-inj_point[0]))]
return tmplt_id
@@ -75,7 +78,7 @@ class ApproxID(object):
if not isinstance(hull, Delaunay):
try:
hull = Delaunay(hull)
except scipy.spatial.qhull.QhullError:
except QhullError:
hull = Delaunay(hull, qhull_options=('Qs'))
return hull.find_simplex(p) >= 0
Loading