cosimoNigro / agnpy

Modelling jetted Active Galactic Nuclei radiative processes with python
https://agnpy.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
47 stars 32 forks source link

Fix the issues with the InterpolatedDistributions #145

Closed cosimoNigro closed 1 year ago

cosimoNigro commented 1 year ago

Hello,

this PR fixes the issues reported in #135 with the InterpolatedDistribution.

The latter could not be used with the classes corresponding to the radiative processes as it had no parameter. I added a norm parameter that is just a multiplicative factor of the interpolated distribution. The latter is propagated to the gammapy and sherpa wrappers as a log10_norm fit parameter.

Fixes #135.

codecov[bot] commented 1 year ago

Codecov Report

Merging #145 (6268784) into master (832d532) will decrease coverage by 0.01%. The diff coverage is 98.33%.

@@            Coverage Diff             @@
##           master     #145      +/-   ##
==========================================
- Coverage   96.95%   96.95%   -0.01%     
==========================================
  Files          40       40              
  Lines        3256     3318      +62     
==========================================
+ Hits         3157     3217      +60     
- Misses         99      101       +2     
Flag Coverage Δ
unittests 96.95% <98.33%> (-0.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
agnpy/absorption/absorption.py 96.39% <ø> (+0.03%) :arrow_up:
setup.py 0.00% <ø> (ø)
agnpy/spectra/spectra.py 95.57% <94.11%> (-0.73%) :arrow_down:
agnpy/compton/synchrotron_self_compton.py 87.80% <100.00%> (ø)
agnpy/fit/core.py 100.00% <100.00%> (ø)
agnpy/fit/gammapy_wrapper.py 95.51% <100.00%> (+0.11%) :arrow_up:
agnpy/fit/sherpa_wrapper.py 100.00% <100.00%> (ø)
agnpy/synchrotron/synchrotron.py 94.11% <100.00%> (ø)
agnpy/tests/test_spectra.py 98.94% <100.00%> (+0.05%) :arrow_up:
agnpy/tests/test_wrappers.py 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

cosimoNigro commented 1 year ago

Will try to extend the code coverage. I added some checks in the wrappers, in case the InterpolatedDistribution is selected. They are not touched by the current tests.

cosimoNigro commented 1 year ago

These last commits should finish fixing the usage of InterpolatedDistribution by the wrappers and also increase the test coverage.