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
...
@@ -1480,6 +1480,9 @@ class kat(object):
...
@@ -1480,6 +1480,9 @@ class kat(object):
are the x and y beam parameters. If no tracing is done a None
are the x and y beam parameters. If no tracing is done a None
is returned.
is returned.
usePipe - Version of Finesse 2.1 allow piping between kat and pykat for transfer data an progress.
Switching this off means some data and variables won't be populated, but it will work with
older versions of Finesse.
rethrowExceptions - if true exceptions will be thrown again rather than being excepted and calling sys.exit()
rethrowExceptions - if true exceptions will be thrown again rather than being excepted and calling sys.exit()
"""
"""
start=time.time()
start=time.time()
...
@@ -1545,7 +1548,10 @@ class kat(object):
...
@@ -1545,7 +1548,10 @@ class kat(object):
pipe_name=katfile.name+str(uuid.uuid4())
pipe_name=katfile.name+str(uuid.uuid4())
cmd=[kat_exec,"--pykat="+pipe_name]
ifusePipe:
cmd=[kat_exec,"--pykat="+pipe_name]
else:
cmd=[kat_exec,"--perl1"]
ifself.__time_code:
ifself.__time_code:
cmd.append('--perf-timing')
cmd.append('--perf-timing')
...
@@ -1586,41 +1592,43 @@ class kat(object):
...
@@ -1586,41 +1592,43 @@ class kat(object):
duration=2# Duration for searching for open pipe
duration=2# Duration for searching for open pipe
try:
try:
whilefifoisNone:
ifusePipe==True:
try:
whilefifoisNone:
iftime.time()<_start_kat+duration:
try:
time.sleep(0.1)
iftime.time()<_start_kat+duration:
fifo=codecs.open(pipe_name,"r","utf-8")
time.sleep(0.1)
self.__looking=False
fifo=codecs.open(pipe_name,"r","utf-8")
else:
self.__looking=False
raisepkex.BasePyKatException("Could not connect to pykat pipe in {0} seconds. Ensure you are using Finesse >= v2.1 and Pykat >= v1.0.0.".format(duration))
else:
exceptFileNotFoundErrorasex:
raisepkex.BasePyKatException("Could not connect to pykat pipe in {0} seconds. Ensure you are using Finesse >= v2.1 and Pykat >= v1.0.0. Or set usePipe=False when making kat object.".format(duration))
ifself.verbose:
exceptFileNotFoundErrorasex:
ifnotself.__looking:
ifself.verbose:
print("Looking for pykat pipe...")
ifnotself.__looking:
self.__looking=True
print("Looking for pykat pipe...")
self.__looking=True
forlineinfifo:
iffifoisnotNone:
forlineinfifo:
#if (sys.version_info < (3, 0)):
#if (sys.version_info < (3, 0)):
# line = line.decode("utf8") # Make sure we're using unicode encoding
# line = line.decode("utf8") # Make sure we're using unicode encoding