Skip to content

Allow evaluating the ParameterAnalysis model on a finer Q grid - #285

Merged
henrikjacobsenfys merged 6 commits into
developfrom
fine-energy-grid-parameter-analysis
Nov 12, 2026
Merged

henrikjacobsenfys merged 6 commits into
developfrom
fine-energy-grid-parameter-analysis

Conversation

@henrikjacobsenfys

@henrikjacobsenfys henrikjacobsenfys commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Closes #200.

Made by Claude, I have not read it carefully myself yet.

ParameterAnalysis.calculate_model_dataset and ParameterAnalysis.plot take an optional Q (sc.Variable), mirroring the energy argument of plot_data_and_model. When given, the model is evaluated on that grid (converted to the data's Q unit) instead of the data's Q values.

pa.plot(Q=sc.linspace('Q', 0.01, 2.0, 200, unit='1/angstrom'))

Since data and model can now be on different grids, plot passes plopp a dict of DataArrays rather than one sc.Dataset. Works with x_axis='Q^2' too.

🤖 Generated with Claude Code

calculate_model_dataset and plot take an optional Q (sc.Variable) so the
model can be drawn on a finer grid than the data. Closes #200.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@codecov

codecov Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.19%. Comparing base (989a2c6) to head (cbb93a1).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #285   +/-   ##
========================================
  Coverage    98.18%   98.19%           
========================================
  Files           64       64           
  Lines         6243     6247    +4     
  Branches      1042     1043    +1     
========================================
+ Hits          6130     6134    +4     
  Misses          59       59           
  Partials        54       54           
Flag Coverage Δ
unittests 98.19% <100.00%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
src/easydynamics/analysis/parameter_analysis.py 98.93% <100.00%> (+0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@henrikjacobsenfys henrikjacobsenfys added [scope] enhancement Adds/improves features (major.MINOR.patch) [priority] medium Normal/default priority labels Nov 9, 2026
henrikjacobsenfys and others added 5 commits November 9, 2026 11:40
…aset

Q must be a 1D sc.Variable with a unit of inverse length. plot checks it
up front, so a bad Q is no longer silently ignored when there are no
bindings to evaluate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replaces the ParameterAnalysis-specific check, so the Q grid follows the
same rules as everywhere else: a single dimension named 'Q', a unit
convertible to 1/angstrom, and positive values.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Q is validated to have the single dimension 'Q', so the model array can
keep dims=['Q'] as before. The comment said data and model are plotted
as separate Datasets; they are passed as one dict of DataArrays.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The conflict resolution kept a call to add_x_axis_coord, which #287
replaced with with_x_axis_dim, and applied with_x_axis_dim to the dict
of DataArrays instead of to the data and model Datasets. The Q^2 test
took #287's assertions, which treat the plotted object as one Dataset.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@henrikjacobsenfys
henrikjacobsenfys merged commit d413df5 into develop Nov 12, 2026
33 checks passed
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] enhancement Adds/improves features (major.MINOR.patch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant