From 8a55e2af4c382ce9e316cc327da42d7424e81e48 Mon Sep 17 00:00:00 2001 From: Daniel Brown <ddb@star.sr.bham.ac.uk> Date: Wed, 22 Jul 2015 14:20:30 +0100 Subject: [PATCH] updates --- examples/beam_trace.py | 10 +++++----- pykat/finesse.py | 17 +++++++++++++---- pykat/optics/maps.py | 6 +++--- pykat/tools/plotting/beamtrace.py | 2 +- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/examples/beam_trace.py b/examples/beam_trace.py index 4a2acff..6c2e023 100644 --- a/examples/beam_trace.py +++ b/examples/beam_trace.py @@ -8,9 +8,9 @@ kat = pykat.finesse.kat() cmds = """ l l1 1 0 n0 -s s0 1000 n0 n1 +s s0 100 n0 n1 m m1 0.5 0.5 0 n1 n2 -s s1 10 n2 n3 +s s1 100 n2 n3 m m2 0.5 0.5 0 n3 n4 s s2 20 n4 n5 bs bs1 0.5 0.5 0 0 n5 n6 n7 n8 @@ -25,13 +25,13 @@ bs bs2 0.5 0.5 0 0 n9 n12 n13 n14 s s6 3 n12 n15 -lens lens1 20 n15 n16 +lens lens1 200 n15 n16 s s7 500 n16 n17 -gouy g1 x s0 s1 s2 +#gouy g1 x s0 s1 s2 -bp bp1 x w0 n5 +#bp bp1 x w0 n5 gauss g1 l1 n0 8e-3 -1000 4e-3 -1200 noxaxis maxtem 0 diff --git a/pykat/finesse.py b/pykat/finesse.py index 0e7e2a3..109fd27 100644 --- a/pykat/finesse.py +++ b/pykat/finesse.py @@ -527,6 +527,9 @@ class kat(object): if kat_file != None: self.loadKatFile(kat_file) + def deepcopy(self): + return copy.deepcopy(self) + def getAll(self, type): """ Returns a collection of all objects of the type argument that are @@ -725,12 +728,18 @@ class kat(object): pkex.PrintError("Error processing constants:", ex) sys.exit(1) - def removeBlock(self, name): + def getBlocks(self): + return self.__blocks.keys() + + def removeBlock(self, name, failOnBlockNotFound=True): if name not in self.__blocks: - pkex.PrintError("Error removing block:", pkex.BasePyKatException('Block "{0}" was not found'.format(name))) - sys.exit(1) - + if failOnBlockNotFound: + pkex.PrintError("Error removing block:", pkex.BasePyKatException('Block "{0}" was not found'.format(name))) + sys.exit(1) + else: + return + for o in self.__blocks[name].contents: self.remove(o) diff --git a/pykat/optics/maps.py b/pykat/optics/maps.py index fd77ec0..9fc663a 100644 --- a/pykat/optics/maps.py +++ b/pykat/optics/maps.py @@ -347,7 +347,7 @@ class surfacemap(object): fig = pylab.figure() - pcm = pylab.pcolormesh(xRange, yRange, self.data, vmin=zmin, vmax=zmax) + pcm = pylab.pcolormesh(xRange, yRange, self.data) pcm.set_rasterized(True) pylab.xlabel('x [cm]') @@ -358,8 +358,8 @@ class surfacemap(object): pylab.title('Surface map {0}, type {1}'.format(self.name, self.type)) - cbar = fig.colorbar(axes) - cbar.set_clim(zmin, zmax) + cbar = pylab.colorbar() + #cbar.set_clim(zmin, zmax) if clabel is not None: cbar.set_label(clabel) diff --git a/pykat/tools/plotting/beamtrace.py b/pykat/tools/plotting/beamtrace.py index 2d385e1..6f9f3c9 100644 --- a/pykat/tools/plotting/beamtrace.py +++ b/pykat/tools/plotting/beamtrace.py @@ -64,7 +64,7 @@ def plot_beam_trace(_kat, from_node, to_node): for n in range(len(spaces)): s = spaces[n] Lmax = s.L - N = 100 + N = 1000 node = None cmds = """ -- GitLab