cta-observatory / pyirf

Python IRF builder
https://pyirf.readthedocs.io/en/stable/
MIT License
15 stars 25 forks source link

Refactor interpolation structure #228

Closed RuneDominik closed 1 year ago

RuneDominik commented 1 year ago

After discussion in the context of #221 with @maxnoe, he asked to change the current interpolation structure in a way that has completely decoupled inter- and extrapolator classes that are instantiated by a specific estimator class for each IRF HDU. This structure also handles the data checks currently done in the interpolator classes. This removes the old interpolate_xyz functions (definitively a breaking change) in favor of an API with actual reusable objects and some kind of configurability.

Please check carefully, if this structure is now as desired. I'll add missing documentation afterwards.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 97.57% and project coverage change: +0.12 :tada:

Comparison is base (c939be6) 92.46% compared to head (489e954) 92.59%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #228 +/- ## ========================================== + Coverage 92.46% 92.59% +0.12% ========================================== Files 49 50 +1 Lines 2005 2120 +115 ========================================== + Hits 1854 1963 +109 - Misses 151 157 +6 ``` | [Impacted Files](https://app.codecov.io/gh/cta-observatory/pyirf/pull/228?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cta-observatory) | Coverage Δ | | |---|---|---| | [.../interpolation/tests/test\_griddata\_interpolator.py](https://app.codecov.io/gh/cta-observatory/pyirf/pull/228?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cta-observatory#diff-cHlpcmYvaW50ZXJwb2xhdGlvbi90ZXN0cy90ZXN0X2dyaWRkYXRhX2ludGVycG9sYXRvci5weQ==) | `100.00% <ø> (ø)` | | | [pyirf/interpolation/quantile\_interpolator.py](https://app.codecov.io/gh/cta-observatory/pyirf/pull/228?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cta-observatory#diff-cHlpcmYvaW50ZXJwb2xhdGlvbi9xdWFudGlsZV9pbnRlcnBvbGF0b3IucHk=) | `98.14% <85.71%> (-1.86%)` | :arrow_down: | | [...ion/tests/test\_component\_estimator\_base\_classes.py](https://app.codecov.io/gh/cta-observatory/pyirf/pull/228?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cta-observatory#diff-cHlpcmYvaW50ZXJwb2xhdGlvbi90ZXN0cy90ZXN0X2NvbXBvbmVudF9lc3RpbWF0b3JfYmFzZV9jbGFzc2VzLnB5) | `96.03% <96.03%> (ø)` | | | [pyirf/interpolation/component\_estimators.py](https://app.codecov.io/gh/cta-observatory/pyirf/pull/228?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cta-observatory#diff-cHlpcmYvaW50ZXJwb2xhdGlvbi9jb21wb25lbnRfZXN0aW1hdG9ycy5weQ==) | `98.33% <98.33%> (ø)` | | | [pyirf/interpolation/\_\_init\_\_.py](https://app.codecov.io/gh/cta-observatory/pyirf/pull/228?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cta-observatory#diff-cHlpcmYvaW50ZXJwb2xhdGlvbi9fX2luaXRfXy5weQ==) | `100.00% <100.00%> (ø)` | | | [pyirf/interpolation/base\_interpolators.py](https://app.codecov.io/gh/cta-observatory/pyirf/pull/228?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cta-observatory#diff-cHlpcmYvaW50ZXJwb2xhdGlvbi9iYXNlX2ludGVycG9sYXRvcnMucHk=) | `96.29% <100.00%> (-2.24%)` | :arrow_down: | | [pyirf/interpolation/griddata\_interpolator.py](https://app.codecov.io/gh/cta-observatory/pyirf/pull/228?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cta-observatory#diff-cHlpcmYvaW50ZXJwb2xhdGlvbi9ncmlkZGF0YV9pbnRlcnBvbGF0b3IucHk=) | `100.00% <100.00%> (ø)` | | | [...irf/interpolation/tests/test\_base\_interpolators.py](https://app.codecov.io/gh/cta-observatory/pyirf/pull/228?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cta-observatory#diff-cHlpcmYvaW50ZXJwb2xhdGlvbi90ZXN0cy90ZXN0X2Jhc2VfaW50ZXJwb2xhdG9ycy5weQ==) | `100.00% <100.00%> (+1.70%)` | :arrow_up: | | [...tests/test\_component\_estimator\_specific\_classes.py](https://app.codecov.io/gh/cta-observatory/pyirf/pull/228?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cta-observatory#diff-cHlpcmYvaW50ZXJwb2xhdGlvbi90ZXN0cy90ZXN0X2NvbXBvbmVudF9lc3RpbWF0b3Jfc3BlY2lmaWNfY2xhc3Nlcy5weQ==) | `100.00% <100.00%> (ø)` | | | [.../interpolation/tests/test\_quantile\_interpolator.py](https://app.codecov.io/gh/cta-observatory/pyirf/pull/228?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cta-observatory#diff-cHlpcmYvaW50ZXJwb2xhdGlvbi90ZXN0cy90ZXN0X3F1YW50aWxlX2ludGVycG9sYXRvci5weQ==) | `100.00% <100.00%> (ø)` | |

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