Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmented and Other Geometry Detector Ptychography #683

Merged
merged 7 commits into from
Sep 18, 2024

Conversation

juliedactyl
Copy link

This PR adds support for performing ptychography with arbitrary detectors, including segmented annular detectors and lower number pixel arrays.

@gvarnavi
Copy link
Member

Ooops, tried to extend the virtual detector ptycho functionality to all classes during the flight and seem to have messed up my git commands to push to someone else's PR 😬.

Closing this one and opening a new one. Apologies -- commits should still be credited correctly.

Extending functionality to other ptycho classes
@juliedactyl
Copy link
Author

juliedactyl commented Sep 15, 2024

This is now ready for review.

Pasting George's comment from PR #684:

Taking a step back, this essentially adds the following snippet to the ptycho Fourier-projection step:

      if virtual_detector_masks is not None:
          masked_values = xp.sum(
              fourier_overlap[:, None, :, :] * virtual_detector_masks[None, :, :, :],
              axis=(-1, -2),
          ).transpose()
          fourier_overlap = xp.zeros_like(fourier_overlap)
          for mask, value in zip(virtual_detector_masks, masked_values):
              fourier_overlap[:, mask] = value[:, None] / xp.sum(mask)

which will bin the forward-model exit-waves using arbitrary (corner-centered) virtual_detector_masks. If the dataset is similarly binned (e.g. by preprocessing a segmented detector dataset), then it provides a flexible way of reconstructing specific forward models.

Attaching a notebook to help review, which illustrates the functionality for an annular segmented detector:
pr-684-comparison

virtual-detector-ptycho-PR684.zip

@juliedactyl juliedactyl marked this pull request as ready for review September 15, 2024 16:40
@gvarnavi gvarnavi requested a review from smribet September 15, 2024 16:47
@smribet
Copy link
Collaborator

smribet commented Sep 15, 2024

Hi @juliedactyl and @gvarnavi, thanks for the PR and test notebook! Look forward to trying this out!

@smribet smribet merged commit 50d0cee into py4dstem:phase_contrast Sep 18, 2024
2 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.

3 participants