diff --git a/examples/beam_trace.py b/examples/beam_trace.py index 4a2acffc4bb41e98a929707d7bbee8ca5ce9ca64..6c2e023d0d7de0e6f6a875de72cc42b7e4bd4c78 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 0e7e2a3af2b5a683bcf1b0134504252b642c0b0d..109fd27bcdf81f28174824494140b93595ab575d 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 fd77ec0e73b3a374ea9bbd6c54d7a675f4e9f800..9fc663ab9aee64ae7c23b7b56260728e9b9ba0a7 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 2d385e1043908a36b13b4cae79d691044a5b0dc6..6f9f3c93d341c7d1567c6b88169744154123b59f 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 = """