From cbb6705de04a26097078fd622460e04806ccbde3 Mon Sep 17 00:00:00 2001 From: Andreas Freise <adf@star.bham.ac.uk> Date: Thu, 16 Jan 2014 17:31:11 +0000 Subject: [PATCH] I seem to have forgotten to commit a further change from wz -> w for gaussian parameters. --- pykat/utilities/optics/gaussian_beams.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pykat/utilities/optics/gaussian_beams.py b/pykat/utilities/optics/gaussian_beams.py index e757204..8179373 100644 --- a/pykat/utilities/optics/gaussian_beams.py +++ b/pykat/utilities/optics/gaussian_beams.py @@ -14,7 +14,7 @@ class gauss_param(object): usage: q = gauss_param(w0=w0, z=z) q = gauss_param(z=z, zr=zr) - q = gauss_param(wz=wz, rc=rc) + q = gauss_param(w=w, rc=rc) q = gauss_param(q=a) # where a is a complex number or change default wavelength and refractive index with: @@ -34,7 +34,7 @@ class gauss_param(object): if "q" in kwargs: self.__q = complex(kwargs["q"]) else: - raise pkex.BasePyKatException("Must specify: z and w0 or z and zr or rc and wz or q, to define the beam parameter") + raise pkex.BasePyKatException("Must specify: z and w0 or z and zr or rc and w or q, to define the beam parameter") elif len(kwargs) == 2: @@ -42,11 +42,11 @@ class gauss_param(object): q = float(kwargs["z"]) + 1j *float(math.pi*kwargs["w0"]**2/(self.__lambda/self.__nr) ) elif "z" in kwargs and "zr" in kwargs: q = float(kwargs["z"]) + 1j *float(kwargs["zr"]) - elif "rc" in kwargs and "wz" in kwargs: - one_q = 1 / kwargs["rc"] - 1j * self.__lamda / (math.pi * self.__nr * kwargs["wz"]**2) + elif "rc" in kwargs and "w" in kwargs: + one_q = 1 / kwargs["rc"] - 1j * self.__lamda / (math.pi * self.__nr * kwargs["w"]**2) q = 1/one_q else: - raise pkex.BasePyKatException("Must specify: z and w0 or z and zr or rc and wz or q, to define the beam parameter") + raise pkex.BasePyKatException("Must specify: z and w0 or z and zr or rc and w or q, to define the beam parameter") self.__q = q else: @@ -69,7 +69,8 @@ class gauss_param(object): @property def w(self): - return self.w0 * math.sqrt(1 + (self.__q.real/self.__q.imag)**2) + return abs(self.__q)*math.sqrt(self.__lambda / (self.__nr * math.pi * self.__q.imag)) + #return self.w0 * math.sqrt(1 + (self.__q.real/self.__q.imag)**2) @property def w0(self): -- GitLab