Home > pubtools > LatticeTuningFunctions > errors > errorsmanipulation > SetExistingError.m

SetExistingError

PURPOSE ^

function SetExistingError(rerr,magindex,X0,Y0,S0,T0,R0,P0,bpm0)

SYNOPSIS ^

function rerr=SetExistingError(rerr,magindex,indBPM,X0,Y0,S0,T0,R0,P0,bpm0)

DESCRIPTION ^

 function SetExistingError(rerr,magindex,X0,Y0,S0,T0,R0,P0,bpm0)
 function SetExistingError(rerr,magindex,rerrset)
 rerrset is then a lattice with errors and the errors are taken from it
 sets a given set of errors.

 errors are overwriting the existing ones.

see also: GetExistingErrors

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function rerr=SetExistingError(rerr,magindex,indBPM,X0,Y0,S0,T0,R0,P0,bpm0)
0002 % function SetExistingError(rerr,magindex,X0,Y0,S0,T0,R0,P0,bpm0)
0003 % function SetExistingError(rerr,magindex,rerrset)
0004 % rerrset is then a lattice with errors and the errors are taken from it
0005 % sets a given set of errors.
0006 %
0007 % errors are overwriting the existing ones.
0008 %
0009 %see also: GetExistingErrors
0010 
0011 nsig=2;
0012 
0013 if iscell(X0)
0014     [X,Y,S,T,R,P,bpm]=GetExistingErrors(X0,magindex);
0015     rerr=SetExistingError(rerr,magindex,indBPM,X,Y,S,T,R,P,bpm);
0016 else
0017     if ~isempty(magindex)
0018         % alignment
0019         if nargin>3
0020             errfun=@(r,po,er)setANYshift(r,po,1,er); % sets x errors
0021             rerr=seterrorrand(rerr,magindex,errfun,0,0,nsig,X0);
0022         end
0023         
0024         if nargin>4
0025             errfun=@(r,po,er)setANYshift(r,po,3,er); % sets Y errors
0026             rerr=seterrorrand(rerr,magindex,errfun,0,0,nsig,Y0);
0027         end
0028         
0029         if nargin>5
0030             errfun=@(r,po,er)atset_s_shift(r,po,er); % sets S errors
0031             rerr=seterrorrand(rerr,magindex,errfun,0,0,nsig,S0);
0032         end
0033         
0034         % rotation
0035         if nargin>6
0036             errfun=@(r,po,er)atsettiltdipole(r,po,er); % sets rotation about s
0037             rerr=seterrorrand(rerr,magindex,errfun,0,0,nsig,T0);
0038         end
0039         
0040         % represented by x and y displacements, already implemented
0041         if nargin>7
0042             %    errfun=@(r,po,er)setTiltAbout(r,po,'y',er); % sets rotation about Y
0043             %    rerr=seterrorrand(rerr,magindex,errfun,0,0,nsig,R0);
0044         end
0045         
0046         if nargin>8
0047             %    errfun=@(r,po,er)setTiltAbout(r,po,'x',er); % sets rotation about X
0048             %    rerr=seterrorrand(rerr,magindex,errfun,0,0,nsig,P0);
0049         end
0050     end
0051     
0052     % bpm
0053     if nargin>9
0054         errfun=@(r,po,er)setcellstruct(r,'Offset',po,er,1,1); % sets x bpm errors
0055         rerr=seterrorrand(rerr,indBPM,errfun,0,0,nsig,bpm0.offsetx);
0056         errfun=@(r,po,er)setcellstruct(r,'Offset',po,er,1,2); % sets Y bpm errors
0057         rerr=seterrorrand(rerr,indBPM,errfun,0,0,nsig,bpm0.offsety);
0058         errfun=@(r,po,er)setcellstruct(r,'Rotation',po,er,1,1); % sets rot bpm errors
0059         rerr=seterrorrand(rerr,indBPM,errfun,0,0,nsig,bpm0.rotation);
0060     end
0061 end
0062 
0063 return

Generated on Thu 24-Aug-2017 18:47:33 by m2html © 2005