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

Add Moment Morph Interpolation #229

Merged
merged 10 commits into from
Jun 30, 2023
Merged

Add Moment Morph Interpolation #229

merged 10 commits into from
Jun 30, 2023

Conversation

RuneDominik
Copy link
Member

This is a new version of #221 that gets rid of most classes. It thus supersedes #221. @maxnoe's comments in #221 were included in this version

This PR introduces another interpolation method (Moment Morphing, see [1]). While performing comparably to the already existing Quantile Interpolation the main points in favor of this method is that it can be can be separated into two steps. First, one has to compute interpolation coefficients and then these are used to morph and interpolate the input pdfs. When changing the coefficients (e.g. changing interpolation to extrapolation or changing from interpolation in a triangle to interpolation in a rectangle) the second part remains unchanged. Consequently, using this for extrapolation is quite simple.

This PR is quite extensive in its additions. Most of these are actually tests, checking all kind of broadcasting and border cases.

[1] M. Baak, S. Gadatsch, R. Harrington and W. Verkerke (2015). Interpolation between multi-dimensional histograms using a new non-linear moment morphing method. Nucl. Instrum. Methods Phys. Res. A 771, 39-48. https://doi.org/10.1016/j.nima.2014.10.033

@RuneDominik RuneDominik changed the title Add Moment Morph Interpolation using Add Moment Morph Interpolation Jun 15, 2023
@codecov
Copy link

codecov bot commented Jun 15, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.94 🎉

Comparison is base (489e954) 92.59% compared to head (b3839f1) 93.53%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #229      +/-   ##
==========================================
+ Coverage   92.59%   93.53%   +0.94%     
==========================================
  Files          50       52       +2     
  Lines        2120     2429     +309     
==========================================
+ Hits         1963     2272     +309     
  Misses        157      157              
Impacted Files Coverage Δ
pyirf/interpolation/__init__.py 100.00% <100.00%> (ø)
pyirf/interpolation/moment_morph_interpolator.py 100.00% <100.00%> (ø)
...erpolation/tests/test_moment_morph_interpolator.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@RuneDominik RuneDominik requested a review from maxnoe June 15, 2023 15:00
@RuneDominik RuneDominik requested a review from maxnoe June 16, 2023 10:57
Copy link
Member

@maxnoe maxnoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good aside from readability in the tests, would be great if the test case data would be easier to read, e.g. by factoring out some functions to reduce the nesting levels.

@RuneDominik RuneDominik requested a review from maxnoe June 30, 2023 13:51
@RuneDominik RuneDominik merged commit fc688fc into main Jun 30, 2023
@maxnoe maxnoe deleted the RefactorMomentMorph branch June 30, 2023 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants