Skip to content

Ptycho constraints#237

Closed
arthurmccray wants to merge 20 commits into
electronmicroscopy:diffractive_imagingfrom
arthurmccray:ptycho_constraints
Closed

Ptycho constraints#237
arthurmccray wants to merge 20 commits into
electronmicroscopy:diffractive_imagingfrom
arthurmccray:ptycho_constraints

Conversation

@arthurmccray

Copy link
Copy Markdown
Collaborator

This is a followup to PR #234 that does 3 main things:

  • adds ptychography ConstraintParams dataclasses for tab-completable and better-documented constraints. Tutorial for that here
  • Converts pure_phase ptycho objects to being stored as realvalued arrays. This prevents issues of phase wrapping (especially with DIPs) and makes regularization and filtering more consistent/accurate. It does make it fairly duplicitous to potential objects, but I think it can be left for the time being.
  • Moves hard constraints to being computed outside the computational graph with torch.no_grad. This doesn't make much of an difference in results, but it's cleaner and the more standard way of doing hard constraints.

I think it makes sense to keep this PR separate from #234, though it does fix a bug where the first GPU(s) are initialized incorrectly.

Both PRs need to wait for #213 to be merged into dev and tested to make sure non breaking.

@arthurmccray arthurmccray marked this pull request as ready for review June 2, 2026 20:11
@arthurmccray arthurmccray deleted the ptycho_constraints branch June 3, 2026 05:24
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.

1 participant