mask_from_array for scalar_masks_XY
Hello,
I have a 2 dim. array which contains pixelated phase data. I would like to create a mask for it, so I defined a function “mask_from_array” inside scalar_masks_XY.py.
def mask_from_array(self,
index,
a1,
a2,
radius,
mask = True,
x0=0, y0=0):
if isinstance(radius, (float, int, complex)):
radius = (radius, radius)
k = 2 * pi / self.wavelength
if mask is True:
amplitude = Scalar_mask_XY(self.x, self.y, self.wavelength)
#amplitude.slit(x0, radius)
t = amplitude.u
else:
t = np.ones_like(self.x)
F1 = a1
F2 = a2
self.u = t * np.exp(1.j * k * (index - 1) * (F2 - F1))
However, I am not sure how to define it in such a way that it works.
My array has a shape of (4002,4002). It is basically a Fresnel diffractive lens. But in order to simulate manufacturing tolerances I have to simulate it as 2d array.
Could you please help me with defining the function?
I think also it would be a nice addition to your package.
Best regards,
Jonas
Comments (3)
-
repo owner -
reporter <!doctype html> <html> <head> <meta name="viewport" content="width=device-width"> <meta http-equiv="Content-Type" content="text/vnd.ui.insecure+html;charset=utf-8"> </head>
-
repo owner - changed status to resolved
- Log in to comment
Dear Jonas Herbst.
Thank you very much for you commentary.
Let us consider that you have a lens, defined by a 2D array.
Then, to load the mask in Scalar_mask_XY, you just need to define the x,y arrays:
and then, load the mask, in the .u parameter.
Consider that the matrices size and x,y arrays should be the same.
Perhaps I have not understood properly. If not, please contact me again.
regards
Luis Miguel