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

Fresnel - Circular Aperture test case failing. #106

Closed
mperrin opened this issue Aug 23, 2018 · 2 comments
Closed

Fresnel - Circular Aperture test case failing. #106

mperrin opened this issue Aug 23, 2018 · 2 comments

Comments

@mperrin
Copy link
Collaborator

mperrin commented Aug 23, 2018

Issue by mperrin
Monday Aug 17, 2015 at 19:14 GMT
Originally opened as mperrin/poppy#106


I just reimplemented the Anderson and Enmark test case in PROPER, and get a peak intensity=3.13422, which agrees within the available precision with the value 3.134 that I digitized from the Anderson and Enmark PDF figure using GraphClick.

So that is clearly the value we should be aiming for. But not the value we are currently getting. :-(

That disagrees with both the value I get with @douglase's original code (peak=3.36), or my current code after various edits related to #103 and #104 (peak=3.89). In fact it looks like something is pretty off because the number of oscillations is quite different. See attached. I will try to dig into this more.

circularaperturepropagation

@mperrin
Copy link
Collaborator Author

mperrin commented Aug 23, 2018

Comment by mperrin
Monday Aug 17, 2015 at 19:47 GMT


Found it. in fresnel.Wavefront.ptp() when calculating the rho value, the x and y separations are divided by 2. I believe that factor of 2 is unnecessary and wrong.
Changing that gets the periodicity of the oscillations correct:

circularaperturepropagation_v2

The peak value is still a bit high compared to our references, and the POPPY output is visibly more jagged than PROPER. I believe both of these may be due to aliasing from the discrete (0 or 1) pupil amplitude, compared with the smoother gray edge that PROPER draws circles with. I've tested this by increasing the sampling and the POPPY output maybe does trend toward the PROPER and Anderson & Enmark values with increasingly fine sampling (at a cost in speed). I'm not totally sure though.

A while ago I started working (in a separate branch) to implement similar grayscale antialiasing of edges in POPPY, but never got that working entirely robustly. Might be worth revisiting that now, I suppose. Though I kind of don't want to be juggling too many significant code overhauls at the same time!

@mperrin
Copy link
Collaborator Author

mperrin commented Aug 23, 2018

Comment by mperrin
Monday Aug 17, 2015 at 20:47 GMT


The peak value is still a bit high compared to our references, and the POPPY output is visibly more jagged than PROPER. I believe both of these may be due to aliasing from the discrete (0 or 1) pupil amplitude, compared with the smoother gray edge that PROPER draws circles with. I've tested this by increasing the sampling and the POPPY output maybe does trend toward the PROPER and Anderson & Enmark values with increasingly fine sampling (at a cost in speed). I'm not totally sure though.

Nope! Other way around: in this case it turns out that POPPY was actually running at finer resolution than the default setup I'd made in PROPER, and likewise finer than whatever calculation Anderson and Enmark did.

If I brute-force it in PROPER (npix=16384, beam_ratio=0.125), I get a peak intensity equal to 3.30790.
And all those little ripples on the outer large ripples show up as well. There are only tiny remaining differences when compared to POPPY running at moderately high sampling:

circular_aperture_propagation_v2

circular_aperture_comparison_v3

If you click through to full resolution in the above image, you can see faint hints of some extra crosshatch/grid pattern noise near the center of the POPPY result, which I think is still the aliasing from the sharp-edged circle, just relatively faint since the sampling is not too low.

(NB. when doing such comparisons, one must keep in mind the slightly different conventions between PROPER and POPPY: PROPER defines npix as "number of pixels per side of the array including zero padding" while POPPY defines it as "number of pixels per side of the actual pupil, prior to padding". In the above figure I have labeled both using the PROPER convention so that it's the total number of pixels in the array that is FFTed.)

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