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

👌 Make result input for plot_coherent_artifact more generic #134

Merged
merged 4 commits into from
Jan 29, 2023

Conversation

s-weigand
Copy link
Member

@s-weigand s-weigand commented Jan 29, 2023

This PR allows the passing of Result and file paths as input to plot_coherent_artifact in addition users now get a warning when passing a Result with multiple datasets to the high level plot functions where load_data picks the first dataset for user convenience and to prevent crashes.

Change summary

Checklist

  • ✔️ Passing the tests (mandatory for all PR's)
  • 🧪 Adds new tests for the feature (mandatory for ✨ feature and 🩹 bug fix PR's)

@s-weigand s-weigand requested a review from a team as a code owner January 29, 2023 18:35
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 29, 2023

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 4.42 ⭐ 4.67 ⭐ 0.25 👎
Method Length 126.75 😞 132.06 😞 5.31 👎
Working memory 13.88 😞 14.20 😞 0.32 👎
Quality 51.86% 🙂 50.31% 🙂 -1.55% 👎
Other metrics Before After Change
Lines 590 617 27
Changed files Quality Before Quality After Quality Change
pyglotaran_extras/io/load_data.py 72.73% 🙂 57.35% 🙂 -15.38% 👎
pyglotaran_extras/plotting/plot_coherent_artifact.py 37.45% 😞 37.16% 😞 -0.29% 👎
pyglotaran_extras/plotting/plot_data.py 44.16% 😞 44.05% 😞 -0.11% 👎
pyglotaran_extras/plotting/plot_guidance.py 59.75% 🙂 59.46% 🙂 -0.29% 👎
pyglotaran_extras/plotting/plot_overview.py 49.81% 😞 49.68% 😞 -0.13% 👎
tests/conftest.py 97.80% ⭐ 97.80% ⭐ 0.00%

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

File Function Complexity Length Working Memory Quality Recommendation
pyglotaran_extras/plotting/plot_overview.py plot_overview 5 ⭐ 272 ⛔ 27 ⛔ 34.30% 😞 Try splitting into smaller methods. Extract out complex expressions
pyglotaran_extras/plotting/plot_coherent_artifact.py plot_coherent_artifact 7 ⭐ 352 ⛔ 16 ⛔ 35.95% 😞 Try splitting into smaller methods. Extract out complex expressions
pyglotaran_extras/plotting/plot_data.py plot_data_overview 4 ⭐ 272 ⛔ 16 ⛔ 41.28% 😞 Try splitting into smaller methods. Extract out complex expressions
pyglotaran_extras/plotting/plot_overview.py plot_simple_overview 3 ⭐ 206 ⛔ 14 😞 48.36% 😞 Try splitting into smaller methods. Extract out complex expressions
pyglotaran_extras/io/load_data.py load_data 9 🙂 122 😞 10 😞 57.35% 🙂 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!

Help us improve this quality report!

@github-actions
Copy link
Contributor

Binder 👈 Launch a binder notebook on branch s-weigand/pyglotaran-extras/improve-plot_coherent_artifact

@@ -1,3 +1,10 @@
# isort: off
# Hack around https://github.com/pydata/xarray/issues/7259 which also affects pyglotaran <= 0.7.0
import numpy # noqa

Check notice

Code scanning / CodeQL

Unused import

Import of 'numpy' is not used.
# isort: off
# Hack around https://github.com/pydata/xarray/issues/7259 which also affects pyglotaran <= 0.7.0
import numpy # noqa
import netCDF4 # noqa

Check notice

Code scanning / CodeQL

Unused import

Import of 'netCDF4' is not used.
@codecov
Copy link

codecov bot commented Jan 29, 2023

Codecov Report

Base: 44.32% // Head: 43.25% // Decreases project coverage by -1.08% ⚠️

Coverage data is based on head (199954c) compared to base (6c6a7a4).
Patch coverage: 8.47% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #134      +/-   ##
==========================================
- Coverage   44.32%   43.25%   -1.08%     
==========================================
  Files          28       29       +1     
  Lines         855      904      +49     
  Branches      130      133       +3     
==========================================
+ Hits          379      391      +12     
- Misses        470      506      +36     
- Partials        6        7       +1     
Impacted Files Coverage Δ
pyglotaran_extras/plotting/plot_data.py 38.23% <0.00%> (ø)
pyglotaran_extras/plotting/plot_guidance.py 31.81% <0.00%> (ø)
pyglotaran_extras/plotting/plot_overview.py 37.50% <0.00%> (ø)
tests/io/test_load_data.py 0.00% <0.00%> (ø)
...glotaran_extras/plotting/plot_coherent_artifact.py 21.42% <20.00%> (-2.39%) ⬇️
pyglotaran_extras/io/load_data.py 90.90% <100.00%> (+54.06%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@jsnel jsnel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are some really nice enhancements, nice work!

@s-weigand s-weigand merged commit c1385c9 into glotaran:main Jan 29, 2023
@s-weigand s-weigand deleted the improve-plot_coherent_artifact branch January 29, 2023 23:35
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.

2 participants