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

[FEATURE] Interpolator #165

Open
henryiii opened this issue Mar 23, 2021 · 4 comments
Open

[FEATURE] Interpolator #165

henryiii opened this issue Mar 23, 2021 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@henryiii
Copy link
Member

We should add an Interpolator class that can interpolate histograms.

Idea for usage:

# Linear interpolation
f = hist.interp.Linear(h)
x = f(2.3)

An Interpolator would take a histogram, and would be callable, with the positional or keyword axes, and would return the interpolated value at that point, making the histogram act like a function. We could have a shortcut directly on the hist to do the above, but the design should be as seen above.

@henryiii henryiii added the enhancement New feature or request label Mar 23, 2021
@lukasheinrich
Copy link

just as a consideration in pyhf we have a few interpolators, but often they are initialized with multiple hisotgrams

e.g.

f = Interp(hdown,hnom,hup)
x = f(2.3)

where f(1.0)==hup, f(-1.0)==hdown, f(0.0)==hnom

@henryiii
Copy link
Member Author

So these return histograms, rather than values?

@lukasheinrich
Copy link

yeah usually we're interested in interpolating between histograms so that you have a parametrised family of histograms, such that for each parameter value you get a full histogram.. for most of the interpolations you can also think of it as a single bin interpolation (returning a float) just applied to all bins

@eduardo-rodrigues
Copy link
Member

FWIW I like the idea of an interface such as hist.interp.Linear(h) because it means interpolation stays separate from a histogram. You can then have hist.interp.Cubic(h) or whatever else even fancier. It will also make it easier, I hope, to provide interpolation with error propagation, where it makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants