Skip to content

Improved constraints - #395

Merged
rozyczko merged 9 commits into
polarized_channelsfrom
improved_constraints
Aug 31, 2026
Merged

Improved constraints#395
rozyczko merged 9 commits into
polarized_channelsfrom
improved_constraints

Conversation

@rozyczko

Copy link
Copy Markdown
Member

New constraint helpers and API exposure:

  • Added constrain, constrain_equal, and unconstrain functions in the new src/easyreflectometry/constraints.py module, providing user-friendly wrappers for parameter dependencies.
  • Exposed these helpers in the public API via src/easyreflectometry/__init__.py and included them in __all__.

Documentation updates:

  • Added a comprehensive "Constraining Parameters" section to the model.md tutorial, including examples for tying parameters, functional constraints, removing constraints, and caveats.
  • Updated the assemblies library documentation to reference the new constraints tutorial section.

@rozyczko rozyczko added chore Chore changes to the code [scope] maintenance Code/tooling cleanup, no feature or bugfix (major.minor.PATCH) [priority] medium Normal/default priority labels Aug 21, 2026
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.36153% with 34 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.89%. Comparing base (e92b6b7) to head (47a97d5).

Files with missing lines Patch % Lines
src/easyreflectometry/inequality_constraints.py 93.96% 12 Missing ⚠️
src/easyreflectometry/project.py 92.54% 12 Missing ⚠️
src/easyreflectometry/model/model.py 83.33% 4 Missing ⚠️
src/easyreflectometry/orso_utils.py 55.55% 4 Missing ⚠️
src/easyreflectometry/fitting.py 97.26% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                  Coverage Diff                   @@
##           polarized_channels     #395      +/-   ##
======================================================
+ Coverage               93.69%   93.89%   +0.20%     
======================================================
  Files                      51       54       +3     
  Lines                    4519     5098     +579     
======================================================
+ Hits                     4234     4787     +553     
- Misses                    285      311      +26     
Flag Coverage Δ
integration 39.40% <38.30%> (-0.03%) ⬇️
unittests 93.89% <94.36%> (+0.20%) ⬆️

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

Files with missing lines Coverage Δ
src/easyreflectometry/__init__.py 85.71% <100.00%> (+10.71%) ⬆️
src/easyreflectometry/_bumps_constraints.py 100.00% <100.00%> (ø)
src/easyreflectometry/analysis/bayesian.py 97.05% <100.00%> (+<0.01%) ⬆️
src/easyreflectometry/constraints.py 100.00% <100.00%> (ø)
src/easyreflectometry/model/model_collection.py 88.00% <100.00%> (+6.05%) ⬆️
...syreflectometry/sample/assemblies/base_assembly.py 99.03% <100.00%> (+0.46%) ⬆️
src/easyreflectometry/summary/summary.py 90.40% <100.00%> (ø)
src/easyreflectometry/utils.py 70.45% <100.00%> (+3.01%) ⬆️
src/easyreflectometry/fitting.py 99.17% <97.26%> (-0.50%) ⬇️
src/easyreflectometry/model/model.py 94.90% <83.33%> (-2.09%) ⬇️
... and 3 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rozyczko
rozyczko merged commit 3b683b6 into polarized_channels Aug 31, 2026
50 checks passed
rozyczko added a commit that referenced this pull request Sep 1, 2026
* initial version

* added magnetic SLD profile

* added magnetic parameters

* ruff

* code review comments addressed

* code review fixes for Phase 2, added notebook

* ruff

* PR code review comments

* fixed polarized file load issue

* enable magnetic layers

* new LayerMagnetism component

* ruff

* ruff on notebooks

* bind calculator to model for performance

* attempt at fixing package testing

* package tests only on master

* don't run ruff twice

* code review fixes

* added polarized fitting example/notebook

* fixed default sample generation

* improved wording in the magnetic fitting notebook

* move the most expensive test to integration

* Improved constraints (#395)

* improved handling of constraints

* ruff

* wording

* additional cell in a notebook to showcase the new way of doing
constraints

* fixed notebook

* initial checkin

* .bounds -> min, max

* updates so the code is self-contained and doesn't depend on changes to
core

* Code review comments addressed

* Updated docs (#398)

* move everything to MKDocs
minor updates/fixes after code review

* ruff fix for notebook

* Fix broken conflict resolutions from develop merge

The merge of develop (2042778) left two files with damaged conflict
resolutions: magnetism.ipynb gained a corrupt hybrid cell (invalid
notebook JSON, duplicate cell id) and project.py gained a duplicated
copy of the spin-asymmetry method block with an orphaned method body.
Both files are restored to the branch-side version, which already
contained everything develop had for them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* code review issues addressed

* removed explicit EasyCore constraints factory reliance

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Chore changes to the code [priority] medium Normal/default priority [scope] maintenance Code/tooling cleanup, no feature or bugfix (major.minor.PATCH)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant