-
Notifications
You must be signed in to change notification settings - Fork 67
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
unexpected ZernikeWFE.get_opd() behavior #199
Comments
Comment by josePhoenix Well, that's weird. I'll take a look. |
Comment by josePhoenix Something having to do with the physical dimensions of the input wavefront is getting set in |
Comment by josePhoenix By the way: thanks for the high-quality bug report, @douglase! |
Comment by josePhoenix The relevant section of # somewhat complicated logic here for historical reasons.
# if we have a first optical plane, check and see if it specifies the entrance sampling.
npix=None
diam=None
if len(self.planes) > 0:
if self.planes[0].shape is not None:
npix=self.planes[0].shape[0]
if hasattr(self.planes[0], 'pupil_diam') and self.planes[0].pupil_diam is not None:
diam = self.planes[0].pupil_diam
# if sampling is still undefined, fall back to what is set for this optical system itself
if npix is None:
npix=self.npix if self.npix is not None else 1024
if diam is None:
diam = self.pupil_diameter if self.pupil_diameter is not None else 1
# if the diameter was specified as an astropy.Quantity, cast it to just a scalar in meters
if isinstance(diam, u.Quantity):
diam = diam.to(u.m).value What's happening is that in your first case, you're computing the Zernike disk on a 1024 px square array that corresponds to a diameter of self.pupil_diam = pad_factor * 2 * self.radius (Pad factor is In the second case, you're computing the Zernike disk on a Wavefront that's created "just in time" by a wrapper called |
Comment by josePhoenix Here's a workaround: import poppy
zernike_optic = poppy.ZernikeWFE(radius=r,
coefficients=[0, 0, 0.000001, 0])
r = 0.0254
osys = poppy.OpticalSystem()
osys.add_pupil(poppy.CircularAperture(radius=r))
osys.add_pupil(zernike_optic)
osys.display(what='both')
plt.imshow(zernike_optic.get_opd(poppy.Wavefront(600e-9, diam=2 * r))) |
Comment by douglase Thanks for clearing that up, I didn't see that |
Comment by josePhoenix Agreed, this is not the least astonishing API. The decorator there should be used consistently as well; a lot of optics have some variant of that test copied and pasted in their various methods. It's on my to-do list, though far from the top... |
Issue by douglase
Tuesday Nov 22, 2016 at 03:31 GMT
Originally opened as mperrin/poppy#199
Kudos to @tukyab for helping find this one.
setup of problem:
Expected behavior:
gives:
unexpected behavior:
This works when the aperture is a few meters across, but only there, it doesn't rescale at all (if you make r=8 then you can't see the circle anymore), the pixel_scale seems to be getting lost when you just pass a wavelength to get_opd().
The documentation says you can pass a wavelength as a float or a wavefront, but I don't actually see why it doesn't throw an error, since the
self.circular_aperture.get_transmission(wave)
function tests that wave is a wavefront.@josePhoenix ?
The text was updated successfully, but these errors were encountered: