Skip to content

Fix units of model_base - #234

Merged
henrikjacobsenfys merged 3 commits into
developfrom
fix_sample_model_units
Aug 11, 2026
Merged

Fix units of model_base#234
henrikjacobsenfys merged 3 commits into
developfrom
fix_sample_model_units

Conversation

@henrikjacobsenfys

Copy link
Copy Markdown
Member

model_base creates ComponentCollections with default units, which breaks when non-default units are used.

@henrikjacobsenfys henrikjacobsenfys added [scope] bug Bug report or fix (major.minor.PATCH) [priority] highest Urgent. Needs attention ASAP labels Aug 10, 2026
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@8227592). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             develop     #234   +/-   ##
==========================================
  Coverage           ?   99.01%           
==========================================
  Files              ?       53           
  Lines              ?     4060           
  Branches           ?      706           
==========================================
  Hits               ?     4020           
  Misses             ?       19           
  Partials           ?       21           
Flag Coverage Δ
unittests 99.01% <100.00%> (?)

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

Files with missing lines Coverage Δ
src/easydynamics/analysis/analysis.py 96.41% <100.00%> (ø)
src/easydynamics/analysis/analysis1d.py 99.09% <ø> (ø)
src/easydynamics/base_classes/easydynamics_list.py 100.00% <ø> (ø)
src/easydynamics/convolution/convolution.py 100.00% <100.00%> (ø)
src/easydynamics/convolution/convolution_base.py 100.00% <100.00%> (ø)
...dynamics/convolution/numerical_convolution_base.py 97.56% <100.00%> (ø)
...cs/sample_model/components/expression_component.py 99.15% <100.00%> (ø)
...mics/sample_model/diffusion_model/delta_lorentz.py 97.73% <100.00%> (ø)
...mple_model/diffusion_model/diffusion_model_base.py 100.00% <ø> (ø)
src/easydynamics/sample_model/model_base.py 100.00% <100.00%> (ø)
... and 1 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

henrikjacobsenfys and others added 2 commits August 10, 2026 22:13
…ruction

- ModelBase._convert_axis_unit: convert the template collection as a whole so
  its own unit attribute updates; regenerated per-Q collections then carry the
  converted unit instead of the stale default.
- Analysis1d._to_scipp_array / Analysis._create_model_array: stamp the sample
  model y_unit on model arrays. Previously they were always dimensionless, so
  residuals and plots failed with a UnitError whenever the data had a real
  unit (e.g. counts), regardless of the models units.
- Analysis1d._build_convolution: pass the sample model units to Convolution.
- Convolution plan and ModelComponent wrapping: internal ComponentCollections
  now inherit units instead of silently defaulting to meV/dimensionless.

Add regression tests for all of the above.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@henrikjacobsenfys
henrikjacobsenfys merged commit 66c0639 into develop Aug 11, 2026
32 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[priority] highest Urgent. Needs attention ASAP [scope] bug Bug report or fix (major.minor.PATCH)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant