Skip to content

Trim the public API to the simulator, its handlers and the built-in sequences - #41

Merged
mcencini merged 2 commits into
mainfrom
claude/project-thread-4pzne2
Oct 12, 2026
Merged

mcencini merged 2 commits into
mainfrom
claude/project-thread-4pzne2

Conversation

@mcencini

Copy link
Copy Markdown
Contributor

What this changes

The public surface is now Simulator, ModelOperator, Subspace, the sequence vocabulary, the *_sim wrappers, estimators (DictionaryMatcher, LookupTable, PERK) and optim.

  • Private: model/, recon/, utils/, execution and offload. Execution is chosen with an execution= keyword.
  • Handler slots: one per Pulseq RF use, plus preparation, other, readout and delay.
  • Removed: NonlinearLeastSquares and the Gauss-Newton solver. Voxelwise fitting is now bartorch's apps.mobafit, and model-based reconstruction is bartorch's nlop.ModelOperator and nlop.IRGNM.
  • Examples: the nonlinear least-squares, joint-relaxometry and nonlinear-inversion examples now use bartorch, which joins the doc extra (bartorch>=0.0.14). The same applies to the model-based reconstruction figure on the explanation pages.

Released before bartorch 0.0.14 and pulserver: pulserver/bartorch and pulserver/pulserver carry the matching changes. The docs build needs bartorch 0.0.14.

How it was checked

pytest tests/ -n 4
1 failed, 1402 passed, 323 skipped

The one failure is tests/optim/test_design.py::test_an_image_quality_design_fits_in_its_budget. It is a wall-clock budget check: its 60-iteration loop took 7.0 s against a 3 s limit while the bartorch suite was running on the same machine. Run on its own, the whole test took 3.9 s, which includes 2 warm-up iterations outside the timed loop.

pre-commit run --all-files is clean. The docs build with executed examples is in progress on the review branch.

Checklist

  • pytest tests/ passes locally, apart from the timing check described above.
  • pre-commit run --all-files is clean.
  • Public functions and classes carry a numpydoc docstring.
  • Comments and docstrings describe the code as it is now.
  • No kernel change.
  • The documentation is updated where the change is visible to a caller, and bash scripts/build_docs.sh still builds. The build is running.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Qarafd1QwmJGNY8ZwdvwUY


Generated by Claude Code

…equences

Model-based reconstruction and the voxelwise least-squares fit move to bartorch
(nlop.ModelOperator, apps.mobafit); the examples that use them run on bartorch.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qarafd1QwmJGNY8ZwdvwUY
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qarafd1QwmJGNY8ZwdvwUY

Copy link
Copy Markdown
Contributor Author

Two checks were red on the first push.

  • pre-commit: ruff's import sort in docs/explanation_figures.py. This is fixed in ef5c595.
  • HTML: the job cannot install the doc extra, because bartorch>=0.0.14 is not on PyPI. That pin is needed: the model-based reconstruction figure and the bartorch examples use nlop.ModelOperator and the new apps.mobafit. bartorch 0.0.14 in turn needs this release (blochsim 0.0.12), so this check can only go green once both are released. The docs were built locally against bartorch's branch with every example executed. The one exception is 05-misc/01-synthetic-data: it is unchanged here and could not download its model in the sandbox. Light and dark renders were reviewed in the project.

I'll re-run the HTML job after bartorch 0.0.14 is published.


Generated by Claude Code

@mcencini
mcencini marked this pull request as ready for review October 12, 2026 16:33
@mcencini
mcencini merged commit 590f782 into main Oct 12, 2026
27 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants