Skip to content

Add undo-fit rollback to Analysis and CLI#183

Merged
AndrewSazonov merged 21 commits into
developfrom
undo-fit
May 26, 2026
Merged

Add undo-fit rollback to Analysis and CLI#183
AndrewSazonov merged 21 commits into
developfrom
undo-fit

Conversation

@AndrewSazonov
Copy link
Copy Markdown
Member

EasyDiffraction projects can now undo the most recent fit. Use
project.analysis.undo_fit() in Python or
python -m easydiffraction PROJECT_DIR undo from the CLI to restore
each refined parameter to the value and uncertainty it had just
before the last fit started. Bayesian posterior summaries are
cleared and analysis/results.h5 is truncated when the rolled-back
project is saved.

Use --dry to preview the rollback without writing any files. Undo
is single-level (only the most recent fit) and a no-op when there is
nothing to undo — calling it twice in a row, or on a project that
has never been fit, simply prints No fit to undo. and exits
cleanly. Fit configuration (bounds, aliases, constraints, minimizer
choice, fit mode, joint-fit weights) is not changed by undo.

@AndrewSazonov AndrewSazonov added the [scope] enhancement Adds/improves features (major.MINOR.patch) label May 26, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

Codecov Report

❌ Patch coverage is 87.02290% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.50%. Comparing base (a06f707) to head (9ee8840).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
src/easydiffraction/analysis/analysis.py 86.36% 8 Missing and 4 partials ⚠️
src/easydiffraction/__main__.py 82.14% 1 Missing and 4 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #183      +/-   ##
===========================================
+ Coverage    85.47%   85.50%   +0.02%     
===========================================
  Files          213      213              
  Lines        16896    17013     +117     
  Branches      1965     1985      +20     
===========================================
+ Hits         14442    14547     +105     
- Misses        1688     1693       +5     
- Partials       766      773       +7     
Flag Coverage Δ
integration 71.09% <37.40%> (-0.27%) ⬇️
unittests 78.39% <87.02%> (+0.09%) ⬆️

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

Files with missing lines Coverage Δ
src/easydiffraction/analysis/__init__.py 100.00% <100.00%> (ø)
src/easydiffraction/io/cif/serialize.py 78.84% <100.00%> (+0.39%) ⬆️
src/easydiffraction/project/project.py 86.58% <100.00%> (+0.12%) ⬆️
src/easydiffraction/utils/utils.py 86.20% <100.00%> (ø)
src/easydiffraction/__main__.py 71.42% <82.14%> (+5.47%) ⬆️
src/easydiffraction/analysis/analysis.py 84.29% <86.36%> (+0.21%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AndrewSazonov AndrewSazonov merged commit 5a6fea2 into develop May 26, 2026
25 of 26 checks passed
@AndrewSazonov AndrewSazonov deleted the undo-fit branch June 1, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[scope] enhancement Adds/improves features (major.MINOR.patch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant