Skip to content

Commit 8b40bf2

Browse files
authored
Remove scipy deprecation warnings (#354)
* remove scipy deprecation warnings * fix missing variable
1 parent fc4a404 commit 8b40bf2

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

adaptive/learner/learner2D.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ def deviations(ip):
3535
ip.tri, values, tol=1e-6
3636
)
3737

38-
p = ip.tri.points[ip.tri.vertices]
39-
vs = values[ip.tri.vertices]
40-
gs = gradients[ip.tri.vertices]
38+
simplices = ip.tri.simplices
39+
p = ip.tri.points[simplices]
40+
vs = values[simplices]
41+
gs = gradients[simplices]
4142

4243
def deviation(p, v, g):
4344
dev = 0
@@ -68,7 +69,7 @@ def areas(ip):
6869
areas : numpy.ndarray
6970
The area per triangle in ``ip.tri``.
7071
"""
71-
p = ip.tri.points[ip.tri.vertices]
72+
p = ip.tri.points[ip.tri.simplices]
7273
q = p[:, :-1, :] - p[:, -1, None, :]
7374
areas = abs(q[:, 0, 0] * q[:, 1, 1] - q[:, 0, 1] * q[:, 1, 0]) / 2
7475
return areas
@@ -172,8 +173,8 @@ def minimize_triangle_surface_loss(ip):
172173
>>>
173174
"""
174175
tri = ip.tri
175-
points = tri.points[tri.vertices]
176-
values = ip.values[tri.vertices]
176+
points = tri.points[tri.simplices]
177+
values = ip.values[tri.simplices]
177178
values = values / (ip.values.ptp(axis=0).max() or 1)
178179

179180
def _get_vectors(points):
@@ -567,7 +568,7 @@ def _fill_stack(self, stack_till=1):
567568
losses_new = []
568569
for j, _ in enumerate(losses):
569570
jsimplex = np.argmax(losses)
570-
triangle = ip.tri.points[ip.tri.vertices[jsimplex]]
571+
triangle = ip.tri.points[ip.tri.simplices[jsimplex]]
571572
point_new = choose_point_in_triangle(triangle, max_badness=5)
572573
point_new = tuple(self._unscale(point_new))
573574

@@ -685,7 +686,7 @@ def plot(self, n=None, tri_alpha=0):
685686
im = hv.Image(np.rot90(z), bounds=lbrt)
686687

687688
if tri_alpha:
688-
points = self._unscale(ip.tri.points[ip.tri.vertices])
689+
points = self._unscale(ip.tri.points[ip.tri.simplices])
689690
points = np.pad(
690691
points[:, [0, 1, 2, 0], :],
691692
pad_width=((0, 0), (0, 1), (0, 0)),

0 commit comments

Comments
 (0)