From 5d59621e2ce20513fce98fd2ce5292bee97b510c Mon Sep 17 00:00:00 2001
From: Charlotte Bond <czb@star.sr.bham.ac.uk>
Date: Thu, 12 Dec 2013 15:47:33 +0000
Subject: [PATCH] correcting for consitency with current function
 FT_remove_zernike_curvatures...

---
 src/mirror_maps/FT_read_zygo_map.m              | 11 ++++++++---
 .../FT_remove_curvature_from_mirror_map.m       |  5 ++---
 .../ligo_maps/FT_convert_ligo_map_for_finesse.m | 17 +++++++++--------
 src/mirror_maps/zygo_map/FTE_zygo_map_01.m      |  2 +-
 4 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/src/mirror_maps/FT_read_zygo_map.m b/src/mirror_maps/FT_read_zygo_map.m
index 006d6b9..fff444b 100644
--- a/src/mirror_maps/FT_read_zygo_map.m
+++ b/src/mirror_maps/FT_read_zygo_map.m
@@ -84,10 +84,15 @@ function [map] = FT_read_zygo_map(filename,filetype)
   % O: obliquity factor
   S=M(2);
   lambda=M(3);
-  O=M(5);
+ O=M(5);
   
-  xstep = M(7);
-  ystep = M(7);
+  if M(7)~=0	
+	xstep = M(7);
+	ystep = M(7);
+  else
+	xstep = 1;
+	ystep = 1;
+  end
   
   [M,count]=fscanf(FID,'%g');
   tmp=fgets(FID);
diff --git a/src/mirror_maps/FT_remove_curvature_from_mirror_map.m b/src/mirror_maps/FT_remove_curvature_from_mirror_map.m
index 9ca5b8a..1ccba9d 100755
--- a/src/mirror_maps/FT_remove_curvature_from_mirror_map.m
+++ b/src/mirror_maps/FT_remove_curvature_from_mirror_map.m
@@ -26,8 +26,7 @@
 % 
 %
 % Rc_out:   radius of curvature of fitted and removed sphere [m]
-% delta_x0, delta_y0: difference between old map center and centre of [data points]
-%                     curvature of fitted sphere
+% zoffset:	offset of map surface heights [nm]
 % map_out:  the surface map with the curvature removed
 %
 % Part of the Simtools package, http://www.gwoptics.org/simtools
@@ -38,7 +37,7 @@
 % Description: fits a curvature to a mirror map and removes it
 % Keywords: mirror, map, curvature, fit, remove
 
-function [map_out,Rc_out,delta_x0,delta_y0]=FT_remove_curvature_from_mirror_map(map,Rc_in,w,display)
+function [map_out,Rc_out,zoffset]=FT_remove_curvature_from_mirror_map(map,Rc_in,w,display)
 
   baseid='remove_curvature_from_mirror_map';
 
diff --git a/src/mirror_maps/ligo_maps/FT_convert_ligo_map_for_finesse.m b/src/mirror_maps/ligo_maps/FT_convert_ligo_map_for_finesse.m
index 5831ffb..5e1e231 100644
--- a/src/mirror_maps/ligo_maps/FT_convert_ligo_map_for_finesse.m
+++ b/src/mirror_maps/ligo_maps/FT_convert_ligo_map_for_finesse.m
@@ -19,16 +19,17 @@
 %           curved enter Rc_in=0.
 %           Can enter strings to specify removal of astigmatism or residual
 %           curvature.  These use a convolution with Zernike polynomials.
-%           'all':  remove curvature and astigmatism
-%           'astigmatism':  just remove astigmatism
-%           'residual': just remove curvatue
+%           N.B. the convolution does not use a gaussian weighting.
+%           'all':  remove curvature and astigmatism (Z20 and Z22 terms)
+%           'astigmatism':  just remove astigmatism (Z22 terms)
+%           'constant': just remove curvatue (Z20 terms)
 %
 % w:        beam radius on mirror [m] for use in the weighting function used in 
 %           the tilt and curvature removal functions.  Value can be set
 %           manually or it can take the set values for a particular type of
 %           mirror.
-%           Type of mirror: End mirror    -> w='end' = 6.2 cm (AdLIGO)
-%                           Input mirror  -> w='input' = 5.3 cm (AdLIGO)
+%           Type of mirror: End mirror    -> w='end' = 6.2 cm (aLIGO)
+%                           Input mirror  -> w='input' = 5.3 cm (aLIGO)
 %
 % map:      map structure, the data holding the surface maps after removal of 
 %           curvature, piston and offset
@@ -76,10 +77,10 @@ function [map_out,x_tilt,y_tilt,Rc_out,offset] = FT_convert_ligo_map_for_finesse
   disp(' --- removing curvature ...');
   % remove curvature
   if (Rc_in~=0)
-      if (strcmp(Rc_in,'all') || strcmp(Rc_in,'residual') || strcmp(Rc_in,'astigmatism'))
-        [map2,Rc_out]=FT_remove_zernike_curvatures_from_map(map,Rc_in); 
+      if (strcmp(Rc_in,'all') || strcmp(Rc_in,'constant') || strcmp(Rc_in,'astigmatism'))
+        [map2,A2,Rc_out]=FT_remove_zernike_curvatures_from_map(map,Rc_in); 
       else
-        [map2,Rc_out, deltax, deltay]=FT_remove_curvature_from_mirror_map(map,Rc_in,w, display_style);
+        [map2,Rc_out]=FT_remove_curvature_from_mirror_map(map,Rc_in,w, display_style);
       end
   else
     map2=map;
diff --git a/src/mirror_maps/zygo_map/FTE_zygo_map_01.m b/src/mirror_maps/zygo_map/FTE_zygo_map_01.m
index 39e80ed..189e3e0 100644
--- a/src/mirror_maps/zygo_map/FTE_zygo_map_01.m
+++ b/src/mirror_maps/zygo_map/FTE_zygo_map_01.m
@@ -25,7 +25,7 @@ filetype=2;
 filename=FT_check_for_gzip(filename);
 
 % Read in zygo map file 
-map=FT_read_zygo_map(filename, filetype);
+map=FT_read_zygo_map(filename, filetype)
 
 % Plot the resulting mirror map
 FT_plot_mirror_map(map,0);
-- 
GitLab