Skip to content
Snippets Groups Projects
Commit d673cfab authored by Charlotte Bond's avatar Charlotte Bond
Browse files

updating and conforming FT_remove_zernike functions

parent c04a3f8c
No related branches found
No related tags found
No related merge requests found
%--------------------------------------------------------------------------
% 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
% 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
%--------------------------------------------------------------------------
% 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);
......
......@@ -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);
% Remove Z11 term
Ae = FT_get_zernike_coefficient(zc,1,1);
map_out = FT_remove_zernike_polynomial_from_map(map_out,1,1,Ae);
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 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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment