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 Synchrotron Self-Absorption for BrokenPowerLaw and added tests on SSA #43

Closed cosimoNigro closed 4 years ago

cosimoNigro commented 4 years ago

@jsitarek noticed in issue #41 that the SSA for the Broken Power Law was not reproducing the results of a previous version. I corrected the error and introduced tests comparing SSA SEDs computed with agnpy with reference SEDs obtained with jetset.

ssa_pwl_comparison_jetset_1 1 2 ssa_bpwl_comparison_jetset_1 1 2 ssa_lp_comparison_jetset_1 1 2

sourcery-ai[bot] commented 4 years ago

Sourcery Code Quality Report (beta)

✅  Merging this PR will increase code quality in the affected files by 0.03 out of 10.

Quality metrics Before After Change
Complexity 0.08 0.09 0.01 🔴
Method Length 60.40 58.17 -2.23 🔵
Quality 8.61 8.64 0.03 🔵
Other metrics Before After Change
Lines 729 725 -4
Changed files Quality Before Quality After Quality Change
agnpy/spectra.py 8.85 8.85 0.00
agnpy/tests/test_compton.py 7.54 7.50 -0.04 🔴
agnpy/tests/test_emission_regions.py 9.04 9.04 0.00
agnpy/tests/test_synchrotron.py 8.27 8.08 -0.19 🔴

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Overall Recommendation
agnpy/tests/test_synchrotron.py TestSynchrotron.test_ssa_reference_sed 0 204.40 6.15 Split out functionality

Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

codecov[bot] commented 4 years ago

Codecov Report

Merging #43 into master will increase coverage by 0.06%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #43      +/-   ##
==========================================
+ Coverage   85.07%   85.14%   +0.06%     
==========================================
  Files          13       14       +1     
  Lines        1320     1299      -21     
==========================================
- Hits         1123     1106      -17     
+ Misses        197      193       -4     
Flag Coverage Δ
#unittests 85.14% <100.00%> (+0.06%) :arrow_up:

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

Impacted Files Coverage Δ
agnpy/spectra.py 96.38% <ø> (+4.81%) :arrow_up:
agnpy/tests/test_emission_regions.py 100.00% <ø> (ø)
agnpy/tests/test_compton.py 100.00% <100.00%> (ø)
agnpy/tests/test_synchrotron.py 100.00% <100.00%> (ø)
agnpy/tests/utils.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 011df71...7dd61f7. Read the comment docs.