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

ENH: Allow left and right arguments to numpy.interp to be functions #8817

Open
jhamman opened this issue Mar 23, 2017 · 2 comments
Open

ENH: Allow left and right arguments to numpy.interp to be functions #8817

jhamman opened this issue Mar 23, 2017 · 2 comments

Comments

@jhamman
Copy link

jhamman commented Mar 23, 2017

It would be useful to allow numpy.interp to take a (optional) function for the left/right arguments. This would allow user specified handling of the tails in interpolations operations.

(sorry I somehow submitted this issue prematurely, I have edited the summary now.)

@jhamman jhamman changed the title interp Feature: numpy.interp takes function optional function as left, right arguments Mar 23, 2017
@eric-wieser
Copy link
Member

eric-wieser commented Mar 23, 2017

Alternatively, perhaps it should just take arrays that broadcast to x? So the call would become:

np.interp(x, xp, fp, left=f_left(x), right=f_right(x))

Yes, this means computing values that might not be needed, but it also means that the computation of those values is vectorized

@eric-wieser eric-wieser changed the title Feature: numpy.interp takes function optional function as left, right arguments ENH: Allow left and right arguments to numpy.interp to be functions Mar 23, 2017
@SpoorthyBhat
Copy link

How exactly would this work? Do you mean f_left(x) and f_right(x) produce arrays of the same length as x and the required values are picked up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants