-
Notifications
You must be signed in to change notification settings - Fork 39
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
Adding user-defined Fresnel wavefront error #261
Comments
Never mind, you can do this with the ArrayOpticalElement class, which I did not have with version 0.6. Here is an implementation below showing that it is doing the right thing import poppy
import numpy as np
import astropy.units as u
if __name__ == "__main__":
wl = 500e-9
#create a wavefront
wf = poppy.FresnelWavefront(0.01*u.m,
wavelength=wl,
npix=1024,
oversample = 2)
#add 1 nm surface error through a "screen"
surf_error = np.random.normal(loc = 0, scale = 1e-9, size = wf.shape)
#convert to phase
error = np.exp(2*np.pi*1j/wl*surf_error)
#Use the poppy version
error_p= poppy.ArrayOpticalElement(opd = surf_error)
#make sure the phasor is in accordance with expectation
print np.allclose(error, error_p.get_phasor(wl*u.m))
wf *= error_p |
Great, glad you figured this out, Michael. The problem with the first version is that the The other way you could have done this in your first example is by directly accessing the wavefront data as an ndarray rather than via the Wavefront class:
It would be simple enough to extend the Cleaning up and improving the documentation is on our to-do list for the next release this fall. I'll make sure we include an example along these lines! |
Thanks Marshall. In my opinion it would be useful to allow for multiplication by complex matrices of the correct shape natively, without passing to an optical element class...but it seems straightforward enough to do it either way. |
cf #1: Is it possible to add wavefront error to a Fresnel wavefront if it is not one of the standard wavefront error classes? The following code crashes:
A scan through the API documentation did not suggest a solution.
The text was updated successfully, but these errors were encountered: