andykee / lentil

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

Plane.multiply() isn't robust to multiplication with a default Plane #33

Closed andykee closed 3 years ago

andykee commented 3 years ago

The following snippet causes all sorts of issues..

import lentil

pupil = lentil.Pupil(amplitude=lentil.circle((256,256), 128), focal_length=10, pixelscale=1/100)
plane = lentil.Plane()

field = lentil.propagate([pupil, plane], wave=650e-9, npix=128)

Some thought needs to be put in to whether wavefront really needs a pixelscale attribute, if so how it should be used in conjunction with Field.pixelscale, and how the following line in Plane.multiply should be changed to make this all work as expected:

out.data.append(Field(data=np.broadcast_to(field.data, self.shape)[s] * phasor,
                                      pixelscale=self.pixelscale,
                                      offset=lentil.util.slice_offset(s, self.shape),
                                      tilt=tilt))