Skip to content
Snippets Groups Projects
Commit 7ce58a1d authored by Andreas Freise's avatar Andreas Freise
Browse files

fixing some problems with the priting of the finesse output

Also pdtype was read in by the photdiode code (as a pdxxx)
parent 73421d17
No related branches found
No related tags found
No related merge requests found
...@@ -271,7 +271,7 @@ class kat(object): ...@@ -271,7 +271,7 @@ class kat(object):
obj = pykat.components.lens.parseFinesseText(line) obj = pykat.components.lens.parseFinesseText(line)
elif(first[0:3] == "mod"): elif(first[0:3] == "mod"):
obj = pykat.components.modulator.parseFinesseText(line) obj = pykat.components.modulator.parseFinesseText(line)
elif(first[0:2] == "pd"): elif(first[0:2] == "pd" and first != "pdtype"):
obj = pykat.detectors.photodiode.parseFinesseText(line) obj = pykat.detectors.photodiode.parseFinesseText(line)
elif(first == "xaxis" or first == "xaxis*"): elif(first == "xaxis" or first == "xaxis*"):
obj = pykat.commands.xaxis.parseFinesseText(line) obj = pykat.commands.xaxis.parseFinesseText(line)
...@@ -339,6 +339,8 @@ class kat(object): ...@@ -339,6 +339,8 @@ class kat(object):
Runs the current simulation setup that has been built thus far. Runs the current simulation setup that has been built thus far.
It returns a katRun or katRun2D object which is populated with the various It returns a katRun or katRun2D object which is populated with the various
data from the simulation run. data from the simulation run.
printoutput=1 prints the Finesse banner
printerr shows the Finesse progress (set kat.verbose=1 to see warnings and errors)
""" """
start = datetime.datetime.now() start = datetime.datetime.now()
...@@ -390,6 +392,9 @@ class kat(object): ...@@ -390,6 +392,9 @@ class kat(object):
katfile.writelines(r.katScript) katfile.writelines(r.katScript)
katfile.flush() katfile.flush()
if printout == 1:
cmd=[kat_exec]
else:
cmd=[kat_exec, '--perl1'] cmd=[kat_exec, '--perl1']
if self.__time_code: if self.__time_code:
...@@ -411,18 +416,20 @@ class kat(object): ...@@ -411,18 +416,20 @@ class kat(object):
#if self.verbose: print "Finesse output:" #if self.verbose: print "Finesse output:"
for line in iter(p.stderr.readline, ""): for line in iter(p.stderr.readline, ""):
err += line
if len(line) > 0: if len(line) > 0 and printerr == 1:
if line.rstrip().endswith('%'): if line.rstrip().endswith('%'):
vals = line.split("-") vals = line.split("-")
action = vals[0].strip() action = vals[0].strip()
prc = vals[1].strip()[:-1] prc = vals[1].strip()[:-1]
if self.verbose: sys.stdout.write("\r{0} {1}%".format(action, prc)) sys.stdout.write("\r{0} {1}%".format(action, prc))
elif line[0:3] == '** ': elif line[0:3] == '** ':
if self.verbose: sys.stdout.write(line) if self.verbose: sys.stdout.write(line)
[out,errpipe] = p.communicate() [out,errpipe] = p.communicate()
if printout == 1:
print out
print ""
# get the version number # get the version number
ix = out.find('build ') + 6 ix = out.find('build ') + 6
...@@ -434,8 +441,8 @@ class kat(object): ...@@ -434,8 +441,8 @@ class kat(object):
if p.returncode != 0: if p.returncode != 0:
raise pkex.FinesseRunError(err, katfile.name) raise pkex.FinesseRunError(err, katfile.name)
if printout == 1: print out #if printout == 1: print out
if printerr == 1: print err #if printerr == 1: print err
root = os.path.splitext(katfile.name) root = os.path.splitext(katfile.name)
base = os.path.basename(root[0]) base = os.path.basename(root[0])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment