diff --git a/pykat/__init__.py b/pykat/__init__.py index 1474e2085f64e36af0c16e10995e65b851a2fd58..c77886a91a753172c55d278a926bdb73bd81a782 100644 --- a/pykat/__init__.py +++ b/pykat/__init__.py @@ -3,7 +3,7 @@ from __future__ import division from __future__ import print_function from __future__ import unicode_literals -__version__ = "1.0.8" +__version__ = "1.0.9" # This flag is used to switch on the gui features in pkat at import time USE_GUI = False diff --git a/pykat/components.py b/pykat/components.py index f7834a2d69c9538eb462eee8905d63c8af6a5408..168490e69a7406d1bb342ef1527f15338f419b39 100644 --- a/pykat/components.py +++ b/pykat/components.py @@ -504,8 +504,8 @@ class mirror(AbstractMirrorComponent): return mirror(values[0], values[4], values[5], T=None, R=values[1], L=values[2], phi=values[3]) def getFinesseText(self): - if self.R+self.T+self.L != 1: - raise pkex.BasePyKatException("Mirror {0} has R+T+L != 1".format(self.name)) + if abs(self.R + self.T + self.L - 1) > 1e-14: + raise pkex.BasePyKatException("Mirror {0} has R+T+L = {1}, must equal 1 +- 1e-14".format(self.name, self.R+self.T+self.L)) rtn = [] @@ -639,8 +639,8 @@ class beamSplitter(AbstractMirrorComponent): values[1], None, values[2], values[3], values[4]) def getFinesseText(self): - if self.R+self.T+self.L != 1: - raise pkex.BasePyKatException("Beamsplitter {0} has R+T+L != 1".format(self.name)) + if abs(self.R + self.T + self.L - 1) > 1e-14: + raise pkex.BasePyKatException("Beamsplitter {0} has R+T+L = {1}, must equal 1 +- 1e-14".format(self.name, self.R+self.T+self.L)) rtn = [] diff --git a/pykat/finesse.py b/pykat/finesse.py index 5f9dd62a4a5a210522a13916da813be0bdea4ebd..e9d7ef0476650f2b8f0524268705a26a7452d91c 100644 --- a/pykat/finesse.py +++ b/pykat/finesse.py @@ -321,6 +321,9 @@ class katRun(object): import matplotlib.pyplot as pyplot import pykat.plotting as plt + if self.noxaxis == True: + raise pkex.BasePyKatException("This kat object has noxaxis=True, so there is nothing to plot.") + if not show: pyplot.ioff() @@ -1662,12 +1665,11 @@ class kat(object): a = line.split(':', 1) if a[0].isdigit(): - #print("Found %s" % a[0]) - values = a[1].split() - + node_name = values[1].split("(")[0] - + component_name = values[2].split("(")[0] + line1x = ifile.readline().replace('(','').replace(')','') line2x = ifile.readline().replace('(','').replace(')','') line1y = ifile.readline().replace('(','').replace(')','') @@ -1679,7 +1681,7 @@ class kat(object): qx = spqx[0].split("=")[1].replace('i','j').replace(' ','') qy = spqy[0].split("=")[1].replace('i','j').replace(' ','') - traceData[-1][node_name] = (pykat.beam_param(q=complex(qx)), pykat.beam_param(q=complex(qy))) + traceData[-1][node_name] = (pykat.beam_param(q=complex(qx)), pykat.beam_param(q=complex(qy)), component_name) finally: ifile.close()