diff --git a/pykat/commands.py b/pykat/commands.py index 6b778243bb054efa79efafae0f3db09606f15369..ba6b085282a70f4a29db3b5637300867cf3c1031 100644 --- a/pykat/commands.py +++ b/pykat/commands.py @@ -101,13 +101,17 @@ class func(Command): @staticmethod def parseFinesseText(line, kat): v = line.split(None, 3) + v2 = line.split("=", 2) if "=" in v and len(v) == 4: v.remove("=") + return func(v[1], v[2]) + if len(v2) == 2: + return func(v2[0].split()[1], v2[1]) else: raise pkex.BasePyKatException("'{0}' not a valid Finesse func command".format(line)) - return func(v[1], v[2]) + diff --git a/pykat/components.py b/pykat/components.py index 613bb171d2a339d2413fe0b9d9b582920154311c..0bb6bbcccd9e7cbefc62dfdc94b4a65f58efe191 100644 --- a/pykat/components.py +++ b/pykat/components.py @@ -303,8 +303,8 @@ class AbstractMirrorComponent(Component): self.__phi = Param("phi", self, SIfloat(phi), canFsig=True, fsig_name="phase") self.__Rcx = AttrParam("Rcx", self, SIfloat(Rcx)) self.__Rcy = AttrParam("Rcy", self, SIfloat(Rcy)) - self.__xbeta = AttrParam("xbeta", self, SIfloat(xbeta), canFsig=True, fsig_name="x") - self.__ybeta = AttrParam("ybeta", self, SIfloat(ybeta), canFsig=True, fsig_name="y") + self.__xbeta = AttrParam("xbeta", self, SIfloat(xbeta), canFsig=True, fsig_name="xbeta") + self.__ybeta = AttrParam("ybeta", self, SIfloat(ybeta), canFsig=True, fsig_name="ybeta") self.__mass = AttrParam("mass", self, SIfloat(mass)) self.__Ix = AttrParam("Ix", self, SIfloat(Ix)) self.__Iy = AttrParam("Iy", self, SIfloat(Iy)) diff --git a/pykat/optics/gaussian_beams.py b/pykat/optics/gaussian_beams.py index 19bd97045cff3bbeec37df76f64c754a542cc85b..0ea9e3103cfbe3ed310df5b8d33fdac336df25ef 100644 --- a/pykat/optics/gaussian_beams.py +++ b/pykat/optics/gaussian_beams.py @@ -53,7 +53,7 @@ class gauss_param(object): elif "z" in kwargs and "zr" in kwargs: q = SIfloat(kwargs["z"]) + 1j * SIfloat(kwargs["zr"]) elif "rc" in kwargs and "w" in kwargs: - one_q = 1 / SIfloat(kwargs["rc"]) - 1j * self.__lamda / (math.pi * self.__nr * SIfloat(kwargs["w"])**2) + one_q = 1 / SIfloat(kwargs["rc"]) - 1j * SIfloat(wavelength) / (math.pi * SIfloat(nr) * SIfloat(kwargs["w"])**2) q = 1/one_q else: raise pkex.BasePyKatException("Must specify: z and w0 or z and zr or rc and w or q, to define the beam parameter") diff --git a/pykat/parallel.py b/pykat/parallel.py index 1053718417dd847417be6cc44e0fc7d59b30d9fb..997eb3f5dc20f0733b0f5260f370a0df47227701 100644 --- a/pykat/parallel.py +++ b/pykat/parallel.py @@ -24,12 +24,19 @@ Contact at ddb@star.sr.bham.ac.uk @author: Daniel Brown """ +import IPython + # former syntax depreciated since ipython 4: -#from IPython.parallel import Client -from ipyparallel import Client +if IPython.version_info[0] <= 3: + from IPython.parallel import Client +else: + from ipyparallel import Client + import sys import os +from pykat.external.progressbar import ProgressBar, ETA, Percentage, Bar + def _run(commands, pwd, **kwargs): import os os.chdir(pwd) @@ -46,8 +53,9 @@ class parakat(object): """ Uses the ipython clustering for running kat objects in parallel. - To use this you must have installed ipyparallel, for example, with - pip install ipyparallel + To use this you must have installed ipyparallel, for example, with: + + pip install ipyparallel Then yoy must start an ipython cluster on your computer. From a new terminal use the command: @@ -81,15 +89,20 @@ class parakat(object): self._lview = self._rc.load_balanced_view() self._lview.block = False self._results = [] + self._run_count = 0 def run(self, kat, **kwargs): self._results.append(self._lview.apply_async(_run, "".join(kat.generateKatScript()), os.getcwd(), **kwargs)) + self._run_count += 1 def getResults(self): out = [] - self._lview.wait(self._results) + p = ProgressBar(maxval=self._run_count , widgets=["Parallel jobs: ", Percentage(), Bar()]) + while not self._lview.wait(self._results, timeout=0.1): + p.update(self._run_count - self._lview.queue_status()['unassigned']) + for done in self._results: out.append(done.get()) diff --git a/pykat/tools/redmine.py b/pykat/tools/redmine.py index 7ad3d430183fc31a9b27904a832564e060c2b330..e3c92e61e75f572f1d1aed4713901fb507b84059 100644 --- a/pykat/tools/redmine.py +++ b/pykat/tools/redmine.py @@ -47,7 +47,7 @@ def processRedmineProductionLog(log, output): if ext == "zip" or ext == "tar" or ext == "pdf": ofile.write("%s %s %s\n" %(file, ip, date)) - print file, ip, date + print(file, ip, date) found = -1