Skip to content

Learner2D.interpolator and Learner2D.interpolated_on_grid give different results #427

Open
@MCFlowMace

Description

@MCFlowMace

Hi thanks for this awesome package! I have an issue with the use of the interpolated data of the Learner2D with a function that I'm trying to analyze. This is what I try to do:

n = 201
learner.plot(n=n) #1st plot

data = learner.interpolated_on_grid(n)

plt.imshow(data[2])
plt.show() #2nd plot

xs, ys = [np.linspace(*b, num=n) for b in learner.bounds]
ip = learner.interpolator()
zs = ip(xs[:, None], ys[None, :])
plt.imshow(zs[:,:,0])
plt.show() #3rd plot

In the code above learner is an instance of Learner2D after running it until convergence. First I inspect the result with the internal plot function. Result looks good:

For the 2nd plot I use interpolated_on_grid to get the data and plot it myself. Result is consistent with the other plot:

For the 3rd plot I want to use the interpolator myself. The result of that is not the same:

Using a different function for the learner the difference is a lot less significant but still existing.
2nd plot:

3rd plot:

Am I using the interpolator object in the wrong way or is it a bug? I would prefer to use the interpolator object instead of interpolated_on_grid since that gives more flexibility for the evaluation points. I am using adaptive version 0.15.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions