diff --git a/examples/lkat_optimisation.py b/examples/lkat_optimisation.py index 089002c03fe4efdb8a8ebf292e43904c98c98de4..cc70213d11763071e05c0d74c73e9906f825fc9f 100644 --- a/examples/lkat_optimisation.py +++ b/examples/lkat_optimisation.py @@ -10,6 +10,11 @@ https://code.google.com/p/ctypesgen/. The command I use to generate the wrapper You then also need to build libkat.so shared library from the python_shared branch of Finesse. Once the above is done the following script may or may not work... """ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + import ctypes import pylibkat @@ -29,7 +34,7 @@ def callback(lkat, maxphi): lkat - The handle to the finesse instance maxphi - a shared object between this and the main process, see multiprocessing.Value """ - print "Entering callback..." + print ("Entering callback...") # first we need to get a handle on the internals of Finesse inter = pylibkat.interferometer.in_dll(lkat, "inter") @@ -51,8 +56,8 @@ def callback(lkat, maxphi): maxphi.value = m1.phi - print "Process: Maximum power =", circ.re - print "Process: Mirror tuning =", m1.phi + print ("Process: Maximum power =", circ.re) + print ("Process: Mirror tuning =", m1.phi) cmd = """ l l1 1 0 n1 @@ -80,4 +85,4 @@ p = kat.getProcess(callback, maxphi=maxphi) p.start() p.join() -print "Host: Received maximum phi =", maxphi.value +print ("Host: Received maximum phi =", maxphi.value) diff --git a/examples/lkat_trace.py b/examples/lkat_trace.py index 1abd65245c1cfa767aa92825c6c11b598bcd484c..1530d6c5acddc04f829f37e30449a91f3189047f 100644 --- a/examples/lkat_trace.py +++ b/examples/lkat_trace.py @@ -1,3 +1,7 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals import pykat import pylab import numpy @@ -28,9 +32,9 @@ kat.parseCommands(cmd) info = kat.lkat_trace() -print "n1 qx =", info["n1"].qx +print ("n1 qx =", info["n1"].qx) -print "Cavity info ", info["c1"] +print ("Cavity info ", info["c1"]) import numpy @@ -66,7 +70,7 @@ try: g_factors.append(cav.stability_x) except Exception as ex: - print "Exception caught in python: ", ex.message + print ("Exception caught in python: ", ex.message) finally: # This should always be called no matter what lkat._pykat_finish(0)