Skip to content

Fix bug when plotting data with a single Q value#158

Merged
henrikjacobsenfys merged 3 commits into
developfrom
fix-plot-bug
Apr 20, 2026
Merged

Fix bug when plotting data with a single Q value#158
henrikjacobsenfys merged 3 commits into
developfrom
fix-plot-bug

Conversation

@henrikjacobsenfys

@henrikjacobsenfys henrikjacobsenfys commented Apr 15, 2026

Copy link
Copy Markdown
Member

Fixes a small issue found today when working with data with a single Q value.

@henrikjacobsenfys henrikjacobsenfys added [scope] bug Bug report or fix (major.minor.PATCH) [priority] medium Normal/default priority labels Apr 15, 2026
@henrikjacobsenfys henrikjacobsenfys linked an issue Apr 15, 2026 that may be closed by this pull request
@codecov

codecov Bot commented Apr 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.86%. Comparing base (d9cff12) to head (48c56b6).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #158   +/-   ##
========================================
  Coverage    97.86%   97.86%           
========================================
  Files           42       42           
  Lines         2617     2621    +4     
  Branches       453      453           
========================================
+ Hits          2561     2565    +4     
  Misses          33       33           
  Partials        23       23           
Flag Coverage Δ
integration 48.91% <75.00%> (+0.03%) ⬆️
unittests 97.86% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@henrikjacobsenfys henrikjacobsenfys changed the title Fix bug when plotting data with a single Q value Q index Fix bug when plotting data with a single Q value Apr 15, 2026

@rozyczko rozyczko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good! Minor suggestion, but nothing blocking.

Comment thread src/easydynamics/analysis/analysis.py Outdated
Comment on lines +679 to +681
if len(datasets) == 1:
ds = ds.assign_coords(Q=self.Q)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of special-casing len(datasets) == 1, you could assign Q coordinates unconditionally:

ds = sc.concat(datasets, dim='Q')
ds = ds.assign_coords(Q=self.Q)
return ds

This would be correct for all Q counts and eliminate the branch.

@henrikjacobsenfys henrikjacobsenfys merged commit 113b4d9 into develop Apr 20, 2026
41 of 42 checks passed
@henrikjacobsenfys henrikjacobsenfys deleted the fix-plot-bug branch June 3, 2026 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[priority] medium Normal/default priority [scope] bug Bug report or fix (major.minor.PATCH)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

plot_data_and_model doesn't work for single Q data

2 participants