Example: ```python import adaptive adaptive.notebook_extension() import numpy as np bounds = [(1, 1.7), (250, 550)] learner = adaptive.Learner2D(lambda x: x[0] * x[1], bounds=bounds) adaptive.runner.simple(learner, goal=lambda l: l.npoints >= 2000) plot_data = learner.plot().Image.I.data print(np.sum(np.isnan(plot_data))) >>> 47 ``` The issue is the precision in `Learner2D._scale` (which is called by `Learner2D.ip`, which itself is used to make the plot): ```python points, values = learner._data_in_bounds() points = learner._scale(points) print(np.min(points[:, 0]), np.max(points[:, 0])) >>> -0.5000000000000001 0.49999999999999983 ``` Points lying exactly at `x = 0.5` will be outside of the convex hull of `points` and `scipy.interpolate.LinearNDInterpolator` [fills them with `nan`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.LinearNDInterpolator.html).
Activity
basnijholt commentedon Apr 9, 2019
Thanks for reporting! I'll fix it tomorrow.
2D: do not return points outside the bounds, closes #181
2D: do not return points outside the bounds, closes #181
basnijholt commentedon Apr 10, 2019
OK this problem only really appears for plotting because
prints
and happens inside the
plotfunction becausex = y = np.linspace(-0.5, 0.5, n).Merge pull request #182 from python-adaptive/fix_nan_2d
2D: do not return points outside the bounds, closes #181
2D: do not return points outside the bounds, closes #181
2D: do not return points outside the bounds, closes #181
2D: do not return points outside the bounds, closes #181