From b1915277c2b2c70598a7f0d8902f3f92f7d4ba83 Mon Sep 17 00:00:00 2001
From: Daniel Toyra <dtoyra@star.sr.bham.ac.uk>
Date: Thu, 14 Apr 2016 00:55:51 +0100
Subject: [PATCH] Add Python 3 support for zernike.py and minor fixes and
 comments in maps.py

---
 pykat/maths/zernike.py | 1 +
 pykat/optics/maps.py   | 9 +++------
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/pykat/maths/zernike.py b/pykat/maths/zernike.py
index 6661cd9..3c9bb11 100644
--- a/pykat/maths/zernike.py
+++ b/pykat/maths/zernike.py
@@ -1,5 +1,6 @@
 import numpy as np
 from scipy.misc import factorial as fac
+from six.moves import xrange
 import math
 
 def zernike_R(m, n, rho):
diff --git a/pykat/optics/maps.py b/pykat/optics/maps.py
index 8d1b4c6..ef03d94 100644
--- a/pykat/optics/maps.py
+++ b/pykat/optics/maps.py
@@ -801,7 +801,7 @@ class surfacemap(object):
             return A1,xbeta,ybeta,zOff
         
 
-    def rmSphericalSurf(self, Rc0, w=None, zOff=None, isCenter=[False,False]):
+    def rmSphericalSurf(self, Rc0, w=None, zOff=None, isCenter=[False,False], maxfev=2000):
         '''
         Fits spherical surface to the mirror map and removes it.
 
@@ -885,7 +885,7 @@ class surfacemap(object):
         # Using the simplex Nelder-Mead method. This is the same or very
         # similar to the method used in 'FT_remove_curvature_from_mirror_map.m',
         # but there are probably better methods to use.
-        opts = {'xtol': 1.0e-5, 'ftol': 1.0e-9, 'maxiter': 1000, 'maxfev': 1000, 'disp': False}
+        opts = {'xtol': 1.0e-5, 'ftol': 1.0e-9, 'maxiter': 10000, 'maxfev': maxfev, 'disp': False}
         out = minimize(costFunc, p, method='Nelder-Mead', options=opts)
         if not out['success']:
             msg = '  Warning: ' + out['message'].split('.')[0] + ' (nfev={:d}).'.format(out['nfev'])
@@ -1725,7 +1725,7 @@ def read_map(filename, mapFormat='finesse', scaling=1.0e-9, mapType='phase', fie
     Reads surface map files and returns a surfacemap object.
     
     filename  - name of surface map file.
-    mapFormat - 'finesse', 'ligo', 'zygo'. Currently only for ascii formats.
+    mapFormat - 'finesse', 'ligo', 'zygo', 'metroPro' (binary).
     scaling   - scaling of surface height of the mirror map [m].
     '''
     
@@ -2088,9 +2088,6 @@ def readHeaderMP(f):
     return hData
 
 
-
-
-
 class BinaryReaderEOFException(Exception):
     def __init__(self):
         pass
-- 
GitLab