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

Remove blob dependency in absorption #76

Merged
merged 5 commits into from
Feb 9, 2021

Conversation

cosimoNigro
Copy link
Owner

@cosimoNigro cosimoNigro commented Feb 9, 2021

This PR removes the dependency, in the absorption class, from any Blob object.
More clearly, I have replaced
Absorption(blob, target, r) -> Absorption(target, r, z, mu_s)
z=0 by default and mu_s=1, such that one is automatically in the blazar scenario.

I have updated the documentation accordingly, I will comment in the pertaining issues where results have actually improved.

Incidentally, I have removed the crosscheck folder, and added it to the .gitignore.
I think it does not make sense to store all those pngs in github, they can be inspected locally after running the tests.
Additionally the check on the deviation from the reference models is performed automatically by np.allclose.

…cy_absorption

Remove blob dependency in absorption (Sourcery refactored)
@sourcery-ai
Copy link

sourcery-ai bot commented Feb 9, 2021

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.78%.

Quality metrics Before After Change
Complexity 1.02 ⭐ 0.79 ⭐ -0.23 👍
Method Length 80.79 🙂 76.69 🙂 -4.10 👍
Working memory 14.61 😞 14.41 😞 -0.20 👍
Quality 62.42% 🙂 63.20% 🙂 0.78% 👍
Other metrics Before After Change
Lines 1971 2100 129
Changed files Quality Before Quality After Quality Change
agnpy/absorption/absorption.py 64.96% 🙂 69.15% 🙂 4.19% 👍
agnpy/compton/external_compton.py 56.10% 🙂 56.10% 🙂 0.00%
agnpy/targets/targets.py 64.37% 🙂 64.94% 🙂 0.57% 👍
agnpy/tests/test_absorption.py 60.83% 🙂 60.96% 🙂 0.13% 👍
agnpy/tests/test_compton.py 61.94% 🙂 61.06% 🙂 -0.88% 👎
agnpy/utils/conversion.py 84.45% ⭐ 84.45% ⭐ 0.00%

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

File Function Complexity Length Working Memory Quality Recommendation
agnpy/compton/external_compton.py ExternalCompton.evaluate_sed_flux_ss_disk 0 ⭐ 260 ⛔ 29 ⛔ 39.42% 😞 Try splitting into smaller methods. Extract out complex expressions
agnpy/targets/targets.py SSDisk.__init__ 9 🙂 208 ⛔ 14 😞 42.42% 😞 Try splitting into smaller methods. Extract out complex expressions
agnpy/compton/external_compton.py ExternalCompton.evaluate_sed_flux_blr 0 ⭐ 197 😞 27 ⛔ 43.64% 😞 Try splitting into smaller methods. Extract out complex expressions
agnpy/absorption/absorption.py Absorption.evaluate_tau_ss_disk 0 ⭐ 233 ⛔ 18 ⛔ 45.35% 😞 Try splitting into smaller methods. Extract out complex expressions
agnpy/compton/external_compton.py ExternalCompton.evaluate_sed_flux_dt 0 ⭐ 182 😞 25 ⛔ 45.37% 😞 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

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.

@codecov
Copy link

codecov bot commented Feb 9, 2021

Codecov Report

Merging #76 (c599edd) into master (a3497b5) will increase coverage by 0.58%.
The diff coverage is 99.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #76      +/-   ##
==========================================
+ Coverage   93.39%   93.97%   +0.58%     
==========================================
  Files          30       30              
  Lines        1725     1727       +2     
==========================================
+ Hits         1611     1623      +12     
+ Misses        114      104      -10     
Flag Coverage Δ
unittests 93.97% <99.14%> (+0.58%) ⬆️

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

Impacted Files Coverage Δ
agnpy/absorption/absorption.py 98.49% <98.66%> (+8.86%) ⬆️
agnpy/compton/external_compton.py 87.50% <100.00%> (ø)
agnpy/targets/targets.py 78.53% <100.00%> (-1.13%) ⬇️
agnpy/tests/test_absorption.py 100.00% <100.00%> (ø)
agnpy/tests/test_compton.py 100.00% <100.00%> (ø)
agnpy/utils/conversion.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 a3497b5...c599edd. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant