Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stability issues #32

Closed
natashawatkins opened this issue Oct 2, 2018 · 18 comments
Closed

Stability issues #32

natashawatkins opened this issue Oct 2, 2018 · 18 comments

Comments

@natashawatkins
Copy link

Currently trying to switch np.interp to interp, and running into some stability issues - sometimes it works but sometimes I run into this error and my code won't work

screen shot 2018-10-02 at 12 05 29 pm

@albop
Copy link
Member

albop commented Oct 2, 2018

That looks suspiciously like the bug related to extrapolation that I fixed recently. Which version are you running ?

@albop
Copy link
Member

albop commented Oct 2, 2018

If the problem is not with library version this issue is a bit hard for me to address as I have no idea what triggers the faulty behaviour. I would need a reduced example or at least some code that I can run.

@natashawatkins
Copy link
Author

I believe I updated to 2.0.1

@albop
Copy link
Member

albop commented Oct 2, 2018 via email

@natashawatkins
Copy link
Author

Yep I just uninstalled and then reinstalled and I'm still having issues

@albop
Copy link
Member

albop commented Oct 3, 2018

I can't replicate it on my computers. Could you do the following please ?

  • conda remove interpolation
  • uninstall pip version by typing pip uninstall interpolation and repeat the operation twice
  • conda install interpolation
    Then if it still doesn't work, can you send me an example of faulty code ? Are you doing 1d, 2d, or higher dimension interpolation ?

@natashawatkins
Copy link
Author

Do you mean pip install interpolation? I'm almost very sure I have 2.0.1 installed. It only occurs with this specific piece of code I'm using

@natashawatkins
Copy link
Author

natashawatkins commented Oct 3, 2018

Here is the issue again after reinstalling:
image

@albop
Copy link
Member

albop commented Oct 3, 2018

No, I mean pip uninstall .... Sometimes an old pip version can cohabitate with the conda version.

@albop
Copy link
Member

albop commented Oct 3, 2018

hmm, I don't see the issue ;-)

@natashawatkins
Copy link
Author

I did pip uninstall but I couldn't find the conda package? Am I meant to have a channel configured or something?

@albop
Copy link
Member

albop commented Oct 3, 2018 via email

@natashawatkins
Copy link
Author

Ok I installed via conda-forge and still got the same error

image

@albop
Copy link
Member

albop commented Oct 3, 2018

Thank you @natashawatkins . But in order to understand the problem, I need to see the code where the function interp is being called. This is not apparent in the example you supply. Can you point me to the source ?

@natashawatkins
Copy link
Author

@albop
Copy link
Member

albop commented Oct 3, 2018

Thanks, let me have a look.

@albop
Copy link
Member

albop commented Oct 3, 2018

So this comes from the extrapolation behaviour of np.interp and interpolation.interp. The former uses a constant equal to the nearest value on the grid, while the latter extrapolates linearly (see graph).
Apparently this causes the convergence failure of the iterations, maybe by causing negative values.
extrapolation

There are plans for a flexible extrapolation system, but in the meantime I'll commit a small change so that interp works with constant extrapolation and matches better default options of np.interp

@natashawatkins
Copy link
Author

Thanks!!

@albop albop closed this as completed Jan 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants