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 plot_data_overview able to plot single trace data #137

Merged
merged 2 commits into from
Feb 23, 2023

Conversation

s-weigand
Copy link
Member

@s-weigand s-weigand commented Feb 5, 2023

This change allows plot_data_overview to be able to plot single trace data without crashing on a single axis dataset.
The SVD part of the plot will be skipped since it does not make sense.

Pseudo code to try it our:

from glotaran.io import load_result
from pyglotaran_extras import plot_data_overview

result = load_result("my_result/result.yaml")
plot_data_overview(result.data['dataset1'].sel(spectral=0,method="nearest"))

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 February 5, 2023 01:26
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 5, 2023

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 2.68 ⭐ 2.71 ⭐ 0.03 👎
Method Length 89.11 🙂 88.27 🙂 -0.84 👍
Working memory 8.51 🙂 8.64 🙂 0.13 👎
Quality 70.88% 🙂 70.47% 🙂 -0.41% 👎
Other metrics Before After Change
Lines 596 682 86
Changed files Quality Before Quality After Quality Change
pyglotaran_extras/plotting/plot_data.py 44.05% 😞 47.66% 😞 3.61% 👍
pyglotaran_extras/plotting/utils.py 75.31% ⭐ 75.59% ⭐ 0.28% 👍
tests/plotting/test_utils.py 80.22% ⭐ 80.26% ⭐ 0.04% 👍

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_data.py plot_data_overview 5 ⭐ 301 ⛔ 16 ⛔ 39.22% 😞 Try splitting into smaller methods. Extract out complex expressions
pyglotaran_extras/plotting/utils.py select_plot_wavelengths 3 ⭐ 136 😞 11 😞 59.58% 🙂 Try splitting into smaller methods. Extract out complex expressions
pyglotaran_extras/plotting/plot_data.py _plot_single_trace 1 ⭐ 76 🙂 11 😞 69.55% 🙂 Extract out complex expressions
tests/plotting/test_utils.py test_abs_max 0 ⭐ 136 😞 5 ⭐ 76.11% ⭐ Try splitting into smaller methods

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 Feb 5, 2023

Binder 👈 Launch a binder notebook on branch s-weigand/pyglotaran-extras/plot_data_overview-single-trace

@codecov
Copy link

codecov bot commented Feb 5, 2023

Codecov Report

Base: 44.94% // Head: 44.79% // Decreases project coverage by -0.15% ⚠️

Coverage data is based on head (816850f) compared to base (08d18d3).
Patch coverage: 30.76% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #137      +/-   ##
==========================================
- Coverage   44.94%   44.79%   -0.15%     
==========================================
  Files          29       29              
  Lines         930      942      +12     
  Branches      131      134       +3     
==========================================
+ Hits          418      422       +4     
- Misses        505      513       +8     
  Partials        7        7              
Impacted Files Coverage Δ
pyglotaran_extras/plotting/plot_data.py 34.09% <18.18%> (-4.15%) ⬇️
pyglotaran_extras/plotting/utils.py 30.63% <100.00%> (+1.27%) ⬆️

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.

@s-weigand s-weigand force-pushed the plot_data_overview-single-trace branch from 1724884 to 605244f Compare February 9, 2023 20:46
@s-weigand s-weigand force-pushed the plot_data_overview-single-trace branch from 605244f to 0e74501 Compare February 19, 2023 21:14
@s-weigand s-weigand force-pushed the plot_data_overview-single-trace branch from 0e74501 to 816850f Compare February 23, 2023 22:33
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.

Looks good. It's important to note that this is not suggesting to use plot_data_overview for plotting single traces, but more that when you end up calling this function in a larger context it doesn't crash when the dataset happens to a single trace.

@s-weigand s-weigand merged commit 0ed9a7b into glotaran:main Feb 23, 2023
@s-weigand s-weigand deleted the plot_data_overview-single-trace branch February 23, 2023 23:02
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