Ejemplo n.º 1
0
 def test_line_intersection(self):
     data = self.collagen
     x = getx(data)
     sort = np.argsort(x)
     x = x[sort]
     ys = data.X[:, sort]
     boola = intersect_curves_chunked(x, ys, np.array([0, 1.15]),
                                      np.array([3000, 1.15]))
     intc = np.flatnonzero(boola)
     np.testing.assert_equal(intc, [191, 635, 638, 650, 712, 716, 717, 726])
Ejemplo n.º 2
0
 def intersect_curves(self, q1, q2):
     x, ys = self.data_x, self.data.X
     if len(x) < 2:
         return []
     x1, x2 = min(q1[0], q2[0]), max(q1[0], q2[0])
     xmin = closestindex(x, x1)
     xmax = closestindex(x, x2, side="right")
     xmin = max(0, xmin - 1)
     xmax = xmax + 2
     sel = np.flatnonzero(intersect_curves_chunked(x, ys, self.data_xsind, q1, q2, xmin, xmax))
     return sel
Ejemplo n.º 3
0
 def intersect_curves(self, q1, q2):
     x, ys = self.graph.data_x, self.graph.data_ys
     if len(x) < 2:
         return []
     x1, x2 = min(q1[0], q2[0]), max(q1[0], q2[0])
     xmin = closestindex(x, x1)
     xmax = closestindex(x, x2, side="right")
     xmin = max(0, xmin - 1)
     xmax = xmax + 2
     x = x[xmin:xmax]
     ys = ys[:, xmin:xmax]
     sel = np.flatnonzero(intersect_curves_chunked(x, ys, q1, q2))
     return sel