Skip to content

Commit 0593b1b

Browse files
committed
test flat bands in the LearnerND
1 parent 94eb632 commit 0593b1b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

adaptive/tests/test_learnernd.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3+
import numpy as np
34
import scipy.spatial
45

56
from adaptive.learner import LearnerND
@@ -38,3 +39,14 @@ def test_interior_vs_bbox_gives_same_result():
3839
simple(learner, goal=lambda l: l.loss() < 0.1)
3940

4041
assert learner.data == control.data
42+
43+
44+
def test_vector_return_with_a_flat_layer():
45+
f = generate_random_parametrization(ring_of_fire)
46+
g = generate_random_parametrization(ring_of_fire)
47+
h1 = lambda xy: np.array([f(xy), g(xy)])
48+
h2 = lambda xy: np.array([f(xy), 0*g(xy)])
49+
h3 = lambda xy: np.array([0*f(xy), g(xy)])
50+
for function in [h1, h2, h3]:
51+
learner = LearnerND(function, bounds=[(-1, 1), (-1, 1)])
52+
simple(learner, goal=lambda l: l.loss() < 0.1)

0 commit comments

Comments
 (0)