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

Added numerical check between agnpy and Finke 2016 for absorption on BLR and DT #89

Closed cosimoNigro closed 3 years ago

cosimoNigro commented 3 years ago

So far we were just producing plots for the crosschecks against the Finke 2016 reference for the case of the gamma-gamma absorption on the BLR and DT.

I added the check_deviation function at the end of the functions checking these absorptions numerically against the reference. These are the automatic plots produced now by the TestAbsorption class

Keeping in mind that, thanks to @jsitarek work, we are also checking against the point-source approximation (for the misaligned case) I think we can close both issues #65 and #66. I think for the BLR and DT the absorption is under control.

codecov[bot] commented 3 years ago

Codecov Report

Merging #89 (561cbb5) into master (2a94ebd) will increase coverage by 0.01%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #89      +/-   ##
==========================================
+ Coverage   94.35%   94.36%   +0.01%     
==========================================
  Files          30       30              
  Lines        2054     2059       +5     
==========================================
+ Hits         1938     1943       +5     
  Misses        116      116              
Flag Coverage Δ
unittests 94.36% <100.00%> (+0.01%) :arrow_up:

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

Impacted Files Coverage Δ
agnpy/utils/geometry.py 100.00% <ø> (ø)
agnpy/tests/test_absorption.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 2a94ebd...561cbb5. Read the comment docs.

sourcery-ai[bot] commented 3 years ago

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 1.57%.

Quality metrics Before After Change
Complexity 0.03 ⭐ 0.03 ⭐ 0.00
Method Length 99.70 🙂 105.15 🙂 5.45 👎
Working memory 13.41 😞 14.23 😞 0.82 👎
Quality 59.47% 🙂 57.90% 🙂 -1.57% 👎
Other metrics Before After Change
Lines 528 545 17
Changed files Quality Before Quality After Quality Change
agnpy/tests/test_absorption.py 55.92% 🙂 54.06% 🙂 -1.86% 👎
agnpy/utils/geometry.py 73.29% 🙂 73.29% 🙂 0.00%

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

File Function Complexity Length Working Memory Quality Recommendation
agnpy/tests/test_absorption.py TestAbsorptionMuS.test_tau_dt_mu_s_far 0 ⭐ 285 ⛔ 18 ⛔ 42.88% 😞 Try splitting into smaller methods. Extract out complex expressions
agnpy/tests/test_absorption.py TestAbsorption.test_absorption_dt_reference_tau 0 ⭐ 180 😞 21 ⛔ 47.17% 😞 Try splitting into smaller methods. Extract out complex expressions
agnpy/tests/test_absorption.py TestAbsorption.test_absorption_blr_reference_tau 0 ⭐ 172 😞 20 ⛔ 48.47% 😞 Try splitting into smaller methods. Extract out complex expressions
agnpy/tests/test_absorption.py TestAbsorptionMuS.test_tau_dt_mu_s_simple 0 ⭐ 212 ⛔ 15 😞 49.67% 😞 Try splitting into smaller methods. Extract out complex expressions
agnpy/tests/test_absorption.py TestAbsorptionMuS.test_abs_blr_mu_s_vs_on_axis 0 ⭐ 167 😞 13 😞 56.01% 🙂 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


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.