From 3149d10ae02872915f088a57da008ae3b69df926 Mon Sep 17 00:00:00 2001
From: Daniel Brown <ddb@star.sr.bham.ac.uk>
Date: Thu, 7 May 2015 18:40:17 +0100
Subject: [PATCH] more py3 bug fixes

---
 pykat/finesse.py       | 11 +++++++++--
 pykat/optics/maps.py   |  2 +-
 pykat/optics/romhom.py |  2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/pykat/finesse.py b/pykat/finesse.py
index e06f322..81bc400 100644
--- a/pykat/finesse.py
+++ b/pykat/finesse.py
@@ -1186,14 +1186,18 @@ class kat(object):
             
             [out,errpipe] = p.communicate()
 
-            _out = str(out).split("\n")
-
+            if six.PY2:
+                _out = str(out).split("\n")
+            else:
+                _out = str(out).split("\\n")
+            
             for line in _out[::-1]:
                 if line.lstrip().startswith('computation time:'):
                     try:
                         r.runtime = float(line.split(":")[1].replace("s",""))
                     except:
                         r.runtime = 0.0
+            
             if printout == 1: 
                 print (out)
             else:
@@ -1317,6 +1321,9 @@ class kat(object):
 
             rtn = [r]
             
+            if sys.version > '3':
+                long = int
+            
             if self.__time_code:
                 perffile = open(root[0] + ".perf",'r')
                 
diff --git a/pykat/optics/maps.py b/pykat/optics/maps.py
index cfea937..07fd5b0 100644
--- a/pykat/optics/maps.py
+++ b/pykat/optics/maps.py
@@ -577,7 +577,7 @@ def read_map(filename):
         f.readline()
         name = f.readline().split(':')[1].strip()
         maptype = f.readline().split(':')[1].strip()
-        size = tuple(map(lambda x: int(x), f.readline().split(':')[1].strip().split()))
+        size = tuple(map(lambda x: float(x), f.readline().split(':')[1].strip().split()))
         center = tuple(map(lambda x: float(x), f.readline().split(':')[1].strip().split()))
         step = tuple(map(lambda x: float(x), f.readline().split(':')[1].strip().split()))
         scaling = float(f.readline().split(':')[1].strip())
diff --git a/pykat/optics/romhom.py b/pykat/optics/romhom.py
index 1f6a9e6..4048910 100644
--- a/pykat/optics/romhom.py
+++ b/pykat/optics/romhom.py
@@ -686,7 +686,7 @@ def MakeROMFromHDF5(hdf5Filename, greedyFilename=None, EIFilename=None, tol=1e-1
         
         Names = range(NProcesses)
         procs = [Process(name="process_%i" % l[0], target=_worker_ROM, 
-                         args=(hdf5Filename, queue, l[1], l[2], l[3])) for l in itertools.izip(Names, result_err, result_idx, locks)]
+                         args=(hdf5Filename, queue, l[1], l[2], l[3])) for l in zip(Names, result_err, result_idx, locks)]
 
         max_res = np.zeros((NProcesses), dtype='d')
         max_idx = np.zeros((NProcesses), dtype='i')
-- 
GitLab