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

Zernike decomposition of the wavefront - mismatch btw Oslo and ray-optics #155

Open
yohann95 opened this issue Sep 2, 2024 · 1 comment

Comments

@yohann95
Copy link

yohann95 commented Sep 2, 2024

Hello Mike,
When I compare the Zernike decomposition for the wavefront got by Oslo and ray-optics, I find a mismatch. Oslo gives directly the Zernike coefficients (in wave unit and not normalized). I get them through ray-optics calculating the projections myself, using the functions wave_abr_full_calc then sm.trace_grid to get the wavefront. Specially, there is a mismatch for the tilt ( Z(x,y)=2x or 2y ). It is nearly zero in Oslo and not in ray-optics.
I have tracked a bit the problem and I think this is because the reference sphere is centred at the intersection of the image plan with the optical axis and not with the emerging chief ray. Am I correct ? If yes, how can I change the center of the reference sphere ?
Thanks in advance,
Yohann

@mjhoptics
Copy link
Owner

mjhoptics commented Sep 3, 2024

Hi Yohann,

Yes, you can control the center of the reference sphere in ray-optics. The analyses module has the class RayGrid whose main purpose is to compute grid sampled wavefronts.

RayGrid has several attributes used to determine the center of the reference sphere. The eval_wavefront() function in the analyses module traces the ray grid through the current optical model and returns a grid of opd values.

There is another way to compute wavefronts with RayGrid. This separates the process into:

This allows the (potentially very compute intensive) ray trace to be done once, while evaluating the wavefront with different amounts of image tilt and defocus is quick enough to allow interactive changes to be displayed in a jupyter notebook. The wavefront notebook is in the ray-optics-notebooks repo.

The slider_update() function in create_focus_dashboard shows how the UI can be hooked up to do this.

Some pseudo-code demonstrating the idea follows:

ray_grid.foc = z offset from the last/image interface
ray_grid.image_pt_2d = base image point, x, y, referenced to the defocused image surface
ray_grid.update_data(build='rebuild')  # this traces the rays
for dfoc_val in range of focus values
    ray_grid.foc = dfoc_val
    ray_grid.image_delta = np.array([dx, dy]) # this is an (optional) delta from image_pt_2d
    ray_grid.update_data(build='update')  # calculate wavefront wrt new reference point

Display of data from a RayGrid can be done with the Wavefront class in the analysisfigure module.

Feel free to ask questions about any of this.

Thanks! Mike

Edit: for clarity

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

2 participants