def profile(self, z, f, dx=1.): """ Beam's complex amplitude at an axial distance z from waist. Plane lies perpendicular to z axis and has the same shape as f. ========Input========= z : Axial distance from waist f : 2D Array defining the output array shape dx : Pixel pitch (default value is unit of measurement) ========Raises======== TypeError: If f isn't a 2D array ========Output======== g : 2D complex array (complex amplitude at an axial distance z from waist centered at z axis) """ if (len(tl.shape(f)) != 2): raise TypeError('f must be a 2D array') n, m = tl.shape(f) x = tl.arange(-m * dx / 2, m * dx / 2, dx) y = tl.arange(-n * dx / 2, n * dx / 2, dx) X, Y = tl.meshgrid(x, y) R = tl.sqrt(X**2 + Y**2) P = tl.arctan(Y / X) g = self.value(R, P, z) return g
def gouy_phase(self, z): # Phase retardation due to Gouy effect return tl.arctan(z / self.zO)