diff --git a/src/new/mirror_maps/FT_remove_zernike_curvatures_from_map.m b/src/new/mirror_maps/FT_remove_zernike_curvatures_from_map.m index e92e6a5fc3b5b4e1c9d960419a8ff0a269a2aca1..3ba960d26443b1b2e8f781e212adcc6d37ca211a 100644 --- a/src/new/mirror_maps/FT_remove_zernike_curvatures_from_map.m +++ b/src/new/mirror_maps/FT_remove_zernike_curvatures_from_map.m @@ -1,5 +1,5 @@ %-------------------------------------------------------------------------- -% function [map_out,Rc_out] = FT_remove_zernike_curvatures_from_map(map,curvature) +% function [map_out,A,Rc] = FT_remove_zernike_curvatures_from_map(map,curvature) % % A Matlab function that preforms an inner product between a map surface % and particular Zernike polynomials, removing the resulting polynomials @@ -13,16 +13,20 @@ % 'astigmatism': Just remove astigmatism % % map_out: Returned map with curvatures removed -% Rc_out: Equivalent curvature removed. Set to 0 if just astigmatism -% is being removed. -% A: Amplitudes of removed polynomials +% A: Amplitudes of removed polynomials. +% If removing 'all', A = [A2-2 A20 A2+2], if 'constant', +% A = A20, if 'astigmatism' A = [A2-2 A2+2]. +% Rc: Equivalent curvature removed. Rc = [Rcx Rcy] (really +% maximum and minimum Rcs). N.B. if 'constant' or +% 'astigmatism' remember that the missing curvature terms +% will contribute to the Rc). % % Part of the Simtools package, http://www.gwoptics.org/simtools % Charlotte Bond 09.02.11 %-------------------------------------------------------------------------- % -function [map_out,zc]=FT_remove_zernike_curvatures_from_map(map,curvature) +function [map_out,A,Rc]=FT_remove_zernike_curvatures_from_map(map,curvature) % Error messages if (~strcmp(curvature,'astigmatism') && ~strcmp(curvature,'constant')... @@ -54,11 +58,24 @@ function [map_out,zc]=FT_remove_zernike_curvatures_from_map(map,curvature) m=mc(i); - A = FT_get_zernike_coefficient(zc,n,m); + A(i) = FT_get_zernike_coefficient(zc,n,m); % Remove polynomial map_out=FT_remove_zernike_polynomial_from_map(map_out,n,m,A); end -end \ No newline at end of file + % Calculate equivalent radius of curvature + R = map.xstep*FT_find_map_radius(map); + if length(mc)==1 + Rc = FT_Znm_to_Rc(A,R); + elseif length(mc)==2 + A22 = sqrt(A(1)^2+A(2)^2); + Rc = FT_Znm_to_Rc([0 A22],R); + else + A22 = sqrt(A(1)^2+A(3)^2); + Rc = FT_Znm_to_Rc([A(2) A22],R); + end + +end + diff --git a/src/new/mirror_maps/FT_remove_zernike_offset_from_map.m b/src/new/mirror_maps/FT_remove_zernike_offset_from_map.m index 5b315cc01b864edc05c47893bffe9f21a0913684..7a62a6609400e19a1b8da9abc8a69d1884761b50 100644 --- a/src/new/mirror_maps/FT_remove_zernike_offset_from_map.m +++ b/src/new/mirror_maps/FT_remove_zernike_offset_from_map.m @@ -1,5 +1,5 @@ %-------------------------------------------------------------------------- -% function [map_out,zc] = FT_remove_zernike_offset_from_map(map) +% function [map_out,A] = FT_remove_zernike_offset_from_map(map) % % A function for Matlab which takes a map in the usual format (see % FT_new_surface_map.m) and removes an offset by performing an overlap with @@ -8,13 +8,13 @@ % map: Input map % % map_out: Output map with offset removed -% zc: Structure storing Zernike coefficents from overlap +% A: Amplitude of remove Zernike polynomial % % Charlotte Bond 30.01.2013 %-------------------------------------------------------------------------- % -function [map_out,zc] = FT_remove_zernike_offset_from_map(map) +function [map_out,A] = FT_remove_zernike_offset_from_map(map) % Zernike map convolution up to order 0 (don't save the data) zc = FT_zernike_map_convolution(map,0,0); diff --git a/src/new/mirror_maps/FT_remove_zernike_tilt_from_map.m b/src/new/mirror_maps/FT_remove_zernike_tilt_from_map.m index 1eedac246df32b964e257bef34f25b234db14646..da0c320f84abc9d3fa82feb99199ff3f35c6ad6b 100644 --- a/src/new/mirror_maps/FT_remove_zernike_tilt_from_map.m +++ b/src/new/mirror_maps/FT_remove_zernike_tilt_from_map.m @@ -8,27 +8,31 @@ % map: Input map % % map_out: Output map with tilt removed -% zc: Structure containing zernike coefficients from overlap with +% A: Structure containing zernike coefficients from overlap with % map. +% xbeta: % % Charlotte Bond 30.01.2013 %-------------------------------------------------------------------------- % -function [map_out,zc] = FT_remove_zernike_tilt_from_map(map) +function [map_out,A,ybeta,xbeta] = FT_remove_zernike_tilt_from_map(map) % Zernike map convolution up to order 1 (don't save the data) zc = FT_zernike_map_convolution(map,1,0); map_out = map; + R = map.xstep*FT_find_map_radius(map); % Remove Z1-1 term - Ao = FT_get_zernike_coefficient(zc,1,-1); - map_out = FT_remove_zernike_polynomial_from_map(map_out,1,-1,Ao); + A(1) = FT_get_zernike_coefficient(zc,1,-1); + map_out = FT_remove_zernike_polynomial_from_map(map_out,1,-1,A(1)); + ybeta = atan(A(1)*map.scaling/R); - % Remove Z11 term - Ae = FT_get_zernike_coefficient(zc,1,1); - map_out = FT_remove_zernike_polynomial_from_map(map_out,1,1,Ae); + % Remove Z1+1 term + A(2) = FT_get_zernike_coefficient(zc,1,1); + map_out = FT_remove_zernike_polynomial_from_map(map_out,1,1,A(2)); + xbeta = atan(A(2)*map.scaling/R); end