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

👌 Add option to deactivate data/residual plotting in overview plots #118

Merged
merged 3 commits into from
Dec 2, 2022

Conversation

s-weigand
Copy link
Member

@s-weigand s-weigand commented Dec 2, 2022

Especially for big datasets the 2D plots (data/residual) in plot_overview or plot_simple_overview can take a long time (up to 1 minute). This change adds None as a possible value for show_data which allows switching off this part of the plot altogether, instead "Skipped" will be written to the middle of the axis (subplot).

The following code will generate the plot below it

from glotaran.testing.simulated_data.sequential_spectral_decay import SCHEME
from glotaran.optimization.optimize import optimize
from pyglotaran_extras import plot_overview

result = optimize(SCHEME)

plot_overview(
    result.data["dataset_1"],
    figure_only=False,
    nr_of_data_svd_vectors=3,
    nr_of_residual_svd_vectors=1,
    show_data=None,
    linlog=True,
    linthresh=50,
)

image

Change summary

Checklist

  • ✔️ Passing the tests (mandatory for all PR's)

@s-weigand s-weigand requested a review from a team as a code owner December 2, 2022 13:45
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 2, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 4.74 ⭐ 5.13 ⭐ 0.39 👎
Method Length 163.67 😞 167.67 😞 4.00 👎
Working memory 15.83 ⛔ 16.01 ⛔ 0.18 👎
Quality 49.75% 😞 48.36% 😞 -1.39% 👎
Other metrics Before After Change
Lines 310 324 14
Changed files Quality Before Quality After Quality Change
pyglotaran_extras/plotting/plot_overview.py 50.54% 🙂 50.01% 🙂 -0.53% 👎
pyglotaran_extras/plotting/plot_residual.py 47.68% 😞 44.75% 😞 -2.93% 👎

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 ⭐ 263 ⛔ 26 ⛔ 34.93% 😞 Try splitting into smaller methods. Extract out complex expressions
pyglotaran_extras/plotting/plot_residual.py plot_residual 8 ⭐ 199 😞 15 😞 42.76% 😞 Try splitting into smaller methods. Extract out complex expressions
pyglotaran_extras/plotting/plot_overview.py plot_simple_overview 3 ⭐ 203 😞 14 😞 48.58% 😞 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

github-actions bot commented Dec 2, 2022

Binder 👈 Launch a binder notebook on branch s-weigand/pyglotaran-extras/deactivate-2d-plot-option

@s-weigand s-weigand changed the title 👌 Add option to deactivate 2D plotting in overview plots 👌 Add option to deactivate data/residual plotting in overview plots Dec 2, 2022
@codecov
Copy link

codecov bot commented Dec 2, 2022

Codecov Report

Base: 40.66% // Head: 40.61% // Decreases project coverage by -0.05% ⚠️

Coverage data is based on head (65a578d) compared to base (0411135).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #118      +/-   ##
==========================================
- Coverage   40.66%   40.61%   -0.06%     
==========================================
  Files          24       24              
  Lines         718      719       +1     
  Branches       98       98              
==========================================
  Hits          292      292              
- Misses        426      427       +1     
Impacted Files Coverage Δ
pyglotaran_extras/plotting/plot_overview.py 37.50% <0.00%> (+1.29%) ⬆️
pyglotaran_extras/plotting/plot_residual.py 27.58% <0.00%> (-3.19%) ⬇️

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.

LGTM. In the future we can think about a more efficient use of the real estate rather than printing skipped in rather large font. ;)

@jsnel jsnel merged commit 1c02cbf into glotaran:main Dec 2, 2022
@s-weigand s-weigand deleted the deactivate-2d-plot-option branch December 21, 2022 12:05
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