Commit 3afbe7ae authored by Daniel Brown's avatar Daniel Brown
Browse files

Merge branch 'master' of gitmaster.atlas.aei.uni-hannover.de:pykat/pykat

parents a3d4397a 344c732d
......@@ -38,11 +38,13 @@ xaxis b1 phi lin 0 180 100
yaxis deg % plotting the phase of the results
"""
kat = finesse.kat()
kat = finesse.kat(tempdir = "/home/sleavey/Desktop/")
kat.parseCommands(code)
maxtem = np.arange(0, 2, 2)
kat.trace = 17
for tem in maxtem:
print "Calculating maxtem ", tem, "..."
kat.maxtem = tem
......
......@@ -363,6 +363,7 @@ class kat(object):
self.retrace = None
self.deriv_h = None
self.scale = None
self.__trace = None
self.__phase = None
self.__maxtem = None
self.__noxaxis = None
......@@ -383,6 +384,17 @@ class kat(object):
@property
def signals(self): return self.__signals
@property
def trace(self): return self.__trace
@trace.setter
def trace(self, value):
value = int(value)
if value < 0 or value > 255:
raise pkex.BasePyKatException('trace command only accepts values in the range 0-255.')
else:
self.__trace = value
@property
def maxtem(self): return self.__maxtem
@maxtem.setter
......@@ -578,6 +590,12 @@ class kat(object):
self.maxtem = -1
else:
self.maxtem = int(v[1])
elif(first == "trace"):
v = line.split()
if len(v) > 2:
raise pkex.BasePyKatException("Trace command `{0}` is incorrect.".format(line))
elif len(v) == 2:
self.trace = v[1]
elif(first == "retrace"):
v = line.split()
if len(v) > 2:
......@@ -688,7 +706,7 @@ class kat(object):
Runs the current simulation setup that has been built thus far.
It returns a katRun or katRun2D object which is populated with the various
data from the simulation run.
printoutput=1 prints the Finesse banner
printout=1 prints the Finesse banner
printerr shows the Finesse progress (set kat.verbose=1 to see warnings and errors)
"""
start = datetime.datetime.now()
......@@ -846,6 +864,15 @@ class kat(object):
if self.verbose: print "Kat file saved to '{0}'".format(newkatfile)
if self.trace != None and self.trace > 0:
#print "{0}".format(out)
#if self.trace & 1:
#search = out.find(' --- highest order of TEM modes')
#if search > -1:
#print "Trace 1: {0}".format(out[search:])
# for now, just try to print the trace block in full
print out[out.find(' ---') :]
katfile.close()
perfData = []
......@@ -1072,6 +1099,7 @@ class kat(object):
if self.scale != None and self.scale !='': out.append("scale {0}\n".format(self.scale))
if self.phase != None: out.append("phase {0}\n".format(self.phase))
if self.trace != None: out.append("trace {0}\n".format(self.trace))
if self.maxtem != None:
if self.maxtem == -1:
out.append("maxtem off\n")
......
Supports Markdown
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