Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Features/fixes
Added support for far-field detector-scale refinement through a new
RealSpaceScalingreconstruction parameter. This parameter is now part of the standardParameterGroupalongside the object, probe, probe positions, and OPR weights, and is initialized as a scalar tensor of shape(1,)with default value1.0. The feature is disabled by default so existing reconstructions remain unchanged unless explicitly enabled. When enabled, Pty-Chi applies a multiplicative real-space scaling to the exit wave before detector propagation, matching the detector-scale correction strategy used in PtychoShelves. For analytical reconstructors, the corresponding adjoint scaling is applied on the backward pass so the modified forward and inverse propagation operators remain consistent. The update rule inRealSpaceScalingfollows the PtychoShelves geometry-refinement formulation: it uses object gradients, Tukey-window-weighted spatial coordinates, and probe weighting to estimate a scalar correction from the current exit-wave residual. In far-field reconstructions, this gives a direct way to refine detector pixel scale, and equivalently sample-to-detector distance, within the non-autodiff reconstruction framework.The API exposes this through
real_space_scaling_options. A typical setup looks like:To avoid double-counting the same far-field geometry ambiguity, the API now warns if real_space_scaling is enabled at the same time as affine probe-position refinement with AffineDegreesOfFreedom.SCALE, which is the Pty-Chi equivalent of the mutual-exclusion warning in PtychoShelves.
Checklist (Don't skip!)
To check a checklist item, change the space in the backets with an
x, i.e.,[ ] -> [x].Have you...