Commit 7820cf03 authored by Daniel Brown's avatar Daniel Brown
Browse files

Fixing R+T+L checking for float eps, adding component from trace output

parent 612925f7
...@@ -3,7 +3,7 @@ from __future__ import division ...@@ -3,7 +3,7 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
from __future__ import unicode_literals 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 # This flag is used to switch on the gui features in pkat at import time
USE_GUI = False USE_GUI = False
......
...@@ -504,8 +504,8 @@ class mirror(AbstractMirrorComponent): ...@@ -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]) return mirror(values[0], values[4], values[5], T=None, R=values[1], L=values[2], phi=values[3])
def getFinesseText(self): def getFinesseText(self):
if self.R+self.T+self.L != 1: if abs(self.R + self.T + self.L - 1) > 1e-14:
raise pkex.BasePyKatException("Mirror {0} has R+T+L != 1".format(self.name)) 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 = [] rtn = []
...@@ -639,8 +639,8 @@ class beamSplitter(AbstractMirrorComponent): ...@@ -639,8 +639,8 @@ class beamSplitter(AbstractMirrorComponent):
values[1], None, values[2], values[3], values[4]) values[1], None, values[2], values[3], values[4])
def getFinesseText(self): def getFinesseText(self):
if self.R+self.T+self.L != 1: if abs(self.R + self.T + self.L - 1) > 1e-14:
raise pkex.BasePyKatException("Beamsplitter {0} has R+T+L != 1".format(self.name)) 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 = [] rtn = []
......
...@@ -321,6 +321,9 @@ class katRun(object): ...@@ -321,6 +321,9 @@ class katRun(object):
import matplotlib.pyplot as pyplot import matplotlib.pyplot as pyplot
import pykat.plotting as plt 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: if not show:
pyplot.ioff() pyplot.ioff()
...@@ -1662,12 +1665,11 @@ class kat(object): ...@@ -1662,12 +1665,11 @@ class kat(object):
a = line.split(':', 1) a = line.split(':', 1)
if a[0].isdigit(): if a[0].isdigit():
#print("Found %s" % a[0])
values = a[1].split() values = a[1].split()
node_name = values[1].split("(")[0] node_name = values[1].split("(")[0]
component_name = values[2].split("(")[0]
line1x = ifile.readline().replace('(','').replace(')','') line1x = ifile.readline().replace('(','').replace(')','')
line2x = ifile.readline().replace('(','').replace(')','') line2x = ifile.readline().replace('(','').replace(')','')
line1y = ifile.readline().replace('(','').replace(')','') line1y = ifile.readline().replace('(','').replace(')','')
...@@ -1679,7 +1681,7 @@ class kat(object): ...@@ -1679,7 +1681,7 @@ class kat(object):
qx = spqx[0].split("=")[1].replace('i','j').replace(' ','') qx = spqx[0].split("=")[1].replace('i','j').replace(' ','')
qy = spqy[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: finally:
ifile.close() ifile.close()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment