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

Parameter resolution cannot be used for implementing super-resolution ptychography #577

Open
jcesardasilva opened this issue Sep 5, 2024 · 3 comments

Comments

@jcesardasilva
Copy link
Contributor

I thought I could use the parameter resolution in Ptypy to implement the super-resolution approach, but it does not work as expected. Images of the results below.
The pixel size of the object and probe arrays are indeed modified accordingly. Still, although the array shape of the
object changed (not to the expected value, which was twice bigger, but it changed), the one for the probe did not change, causing potential problems with sampling when using large probes. The probe array size should also change if it is to be used for super-resolution, given the probe pixel size has changed. If not changed, we access only a tiny area of the probe array. If I pad the data using numpy before loading the data in Ptypy, I can do super-resolution properly without using the parameter resolution.

After a discussion with @bjoernenders @daurer, I can imagine that that parameter was not made for this goal, so I wonder what the best solution would be. Maybe I should consider an additional method for HDF5_loader that implements the padding according to the aimed pixel size?

Normal calculations
Capture d’écran 2024-09-05 à 18 12 19
Capture d’écran 2024-09-05 à 18 16 52

Calculations using the resolution parameter with a pixel size of half the original.
Capture d’écran 2024-09-05 à 18 12 04
Capture d’écran 2024-09-05 à 18 16 59

@jcesardasilva
Copy link
Contributor Author

jcesardasilva commented Sep 9, 2024

I used the approach proposed by @bjoernenders, which involved adding a mask to the areas where the padding was applied. But somehow, it did not work well.
The exit wave propagated to the detector, after the phase retrieval using the data with padding and with the mask, gives this weird image:
Screenshot 2024-09-09 at 15 50 22
And the retrieved image gets weird artifacts on the images (left = normal, right = super-resolution):
Screenshot 2024-09-09 at 15 50 11

@jcesardasilva
Copy link
Contributor Author

@pierrethibault suggested using the p.engines.engine00.probe_fourier_support = 0.3 to impose support on the Fourier transform of the probe function since it is supposed to represent the image of the pupil. This improved the reconstruction quality, although we still observed unwanted Fourier frequencies in the padded area. We are progressing.

One diffraction pattern
Screenshot 2024-09-10 at 16 39 53

The reconstructed object
Screenshot 2024-09-10 at 16 39 19

@jcesardasilva
Copy link
Contributor Author

Following the suggestion by @bjoernenders , I tried the approach on simulated data. I picked the moonflower example and applied the zero padding. As seen in the results shown below, I got the sample problem as in the case using the experimental data:

Diffraction pattern:
Screenshot 2024-09-11 at 16 09 31

Reconstruction
Screenshot 2024-09-11 at 16 12 06

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

No branches or pull requests

1 participant