Top  Previous  Next

lsfptosw is the key element in the computation of a waffle-constrained reconstructor.  We can set up the WFS geometry with aogeom, and then we proceed to lsfptosw and aorecon.  (As mentioned in the background discussion, explicit attempts to eliminate waffle using lsfptosw may be redundant because of the removal of singular modes using the SVD capability of aorecon:  users must experiment with their particular geometries).

From the Matlab command line, the calling syntax for lsfptosw is:

>>  [ptosw, c] = lsfptosw(xsub, ysub, 1, xactmas, yactmas);  % NOTE:  the first letter of "lsfptosw" is lower case "ell"


xsub   =  vector (dim nsub x 1) containing the x-coordinates (in m) of the centers of the WFS subapertures.  The subaperture numbering convention has been described previously.

ysub   =  vector (dim nsub x 1) containing the y-coordinates (in m) of the centers of the WFS subapertures.

1  =  specifies a hardwired code option.

xactmas   =  vector (dim nact x 1) containing the x-coordinates (in m) of the master actuator locations. The actuator numbering convention has been described previously.

yactmas   =  vector (dim nact x 1) containing the y-coordinates (in m) of the master actuator locations.

ptosw   = slope influence matrix similar to type S'c , defined previously.  

CAUTION:  the lsfptosw routine neglects to divide by the actuator separations dxact and dyact when computing the matrix ptos.  To compensate manually, see the Matlab example listed next.  

UNITS:  after the compensating divisor is applied, the corrected matrix ptosw will map an OPD vector in units of meters into a slope vector in units of radians of tilt angle.

c  = diagnostic quantity not needed for subsequent processing.

Starting with an existing .mat data file included with the AO tools, the following Matlab example illustrates the use of lsfptosw:

% Load a file with an existing geometry and reconstructor:

>> load nop241f.mat


% Find the indices of the master actuators:

>> imas=find(actype>0);


% Create the slope influence function which includes the

% unsensed waffle terms.  Rescale to physical units

>> [ptosw, c] = lsfptosw(xsub, ysub, 1, xact(imas), yact(imas));

» ptosws=ptosw*(2/(ysub(2)-ysub(1)));


% Do the SVD and plot:

>> rsv=aorecon(ptosws);

>> figure;

>> semilogy(rsv,'o-')


% Remove one singular value.  Create the

% tilt-removed and the tilt-included reconstructors:

>> [reconw,rsv]=aorecon(ptosws, 1, 1); %tilt-removed

>> [reconwti,rsv]=aorecon(ptosws, 1, 0); %tilt-included


% Create the usual (NO waffle removal) tilt-removed reconstructor;

% it was not included in the original file.  Do the SVD:

>> rsv=aorecon(mvtos);

>> figure;

>> semilogy(rsv, 'ro-')


% Remove two singular values:

>> [reconti,rsv] = aorecon(mvtos, 2, 0);


% Plot and compare to the original reconstructor:

>> figure

>> slopes=[xsub; ysub];

>> plot(recon*slopes);

>> hold on;

>> hold on;plot(reconw(:,1:416)*slopes, 'r');

>> hold on;plot(reconwti(:,1:416)*slopes, 'g');

>> figure

>> slopestilt=ones(416, 1);

>> plot(recon*slopestilt);

>> hold on;plot(reconti(:,1:416)*slopestilt, 'g');

>> hold on;plot(reconw(:,1:416)*slopestilt, 'r');

>> hold on;plot(reconwti(:,1:416)*slopestilt, 'm');

>> hold off;


% The following trims the WCR matrices to the right sizes:

>> reconw=reconw(:,1:416);

>> reconwti=reconwti(:,1:416);


% Create a combined .mat file that contains the old and the new reconstructors:

>> save nop241temp reconw reconwti reconti

>> clear

>> load nop241f

>> load nop241temp

>> save nop241fwcr