andykee / lentil

Heart-healthy physical optics
https://andykee.github.io/lentil/
Other
14 stars 6 forks source link

Plane transformations are not being applied to wavefront tilt terms #4

Closed andykee closed 2 years ago

andykee commented 4 years ago

Plane transformations (Rotate and Flip) are only applied to Wavefront's data attribute at the moment. This is fine, unless the Wavefront's tilt attribute is populated. This is pretty clear from the example below:

import lentil
pupil = lentil.Pupil(amplitude=lentil.util.circle((256, 256), 128), diameter=1,
                     focal_length=10, pixelscale=1/256)
detector = lentil.Detector(pixelscale=5e-6, shape=(1024, 1024))
psf = lentil.propagate([pupil, detector], wave=650e-9, npix=(64, 64))

image

tilt = lentil.Tilt(x=10e-6, y=0)
psf = lentil.propagate([tilt, pupil, detector], wave=650e-9, npix=(64, 64))

image

psf = lentil.propagate([tilt, pupil, lentil.Rotate(angle=30), detector], wave=650e-9, npix=(64, 64))

image

I'm not entirely sure how to deal with this yet, but I wanted to capture the problem before I forgot.