From 741fe40efc2522257f5f686651a3b534db872682 Mon Sep 17 00:00:00 2001
From: Andreas Freise <adf@star.bham.ac.uk>
Date: Wed, 27 Apr 2016 23:37:54 +0100
Subject: [PATCH] making lkat files python2/3 compatible'

---
 examples/lkat_optimisation.py | 13 +++++++++----
 examples/lkat_trace.py        | 10 +++++++---
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/examples/lkat_optimisation.py b/examples/lkat_optimisation.py
index 089002c..cc70213 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 1abd652..1530d6c 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)
-- 
GitLab