Skip to content

Enable SLD dependence on material data - #403

Open
rozyczko wants to merge 3 commits into
developfrom
sld_coupled
Open

Enable SLD dependence on material data#403
rozyczko wants to merge 3 commits into
developfrom
sld_coupled

Conversation

@rozyczko

@rozyczko rozyczko commented Sep 3, 2026

Copy link
Copy Markdown
Member

This pull request introduces a new feature to the MaterialDensity class, allowing the SLD (scattering length density) and ISLD parameters to be decoupled from the chemical formula and density, making them directly editable or fittable. The changes also ensure that serialization and deserialization preserve this decoupling state and the associated manual values.

MaterialDensity decoupling and serialization improvements:

  • Added the sld_coupled property and setter to allow toggling whether sld/isld are derived from formula/density or are independent, directly settable parameters. Setting this property updates dependencies and preserves or discards manual values as appropriate.
  • Extended the serialization logic to persist the sld_coupled state and manual sld/isld values, ensuring that decoupled/manual values are not lost on save/load. Backward compatibility is maintained for older project files.
  • Updated the chemical_structure setter to also update the molecular weight when the formula changes, preventing mismatches in derived SLD values.

@rozyczko rozyczko added [scope] enhancement Adds/improves features (major.MINOR.patch) [priority] high Should be prioritized soon enhancement labels Sep 3, 2026
@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.43%. Comparing base (8b13521) to head (0fa1340).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #403      +/-   ##
===========================================
+ Coverage    94.40%   94.43%   +0.03%     
===========================================
  Files           54       54              
  Lines         5500     5532      +32     
===========================================
+ Hits          5192     5224      +32     
  Misses         308      308              
Flag Coverage Δ
integration 38.53% <14.70%> (-0.14%) ⬇️
unittests 94.43% <100.00%> (+0.03%) ⬆️

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

Files with missing lines Coverage Δ
...etry/sample/elements/materials/material_density.py 99.11% <100.00%> (+0.34%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement [priority] high Should be prioritized soon [scope] enhancement Adds/improves features (major.MINOR.patch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant