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

setBpmOffsetOnDipoleRef

PURPOSE ^

% set bpm on curve defined by dipole misalignments

SYNOPSIS ^

function rerr=setBpmOffsetOnDipoleRef(rerr)

DESCRIPTION ^

 % set bpm on curve defined by dipole misalignments

see also: ApplyErrorsRand

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function rerr=setBpmOffsetOnDipoleRef(rerr)
0002 % % set bpm on curve defined by dipole misalignments
0003 %
0004 %see also: ApplyErrorsRand
0005 
0006 inddip=findcells(rerr,'BendingAngle');
0007 indbpm=findcells(rerr,'Class','Monitor');
0008 
0009 [X,Y,~,T,~,~,bpmerr]=GetExistingErrors(rerr,inddip);
0010     
0011 indbpm=[indbpm(end) indbpm indbpm(1)]; % last and first bpm
0012     
0013 sposBPM=findspos(rerr,indbpm);
0014 sposDip=findspos(rerr,inddip);
0015 
0016 offx=interp1(sposDip,X,sposBPM);offx(isnan(offx))=0;
0017 offy=interp1(sposDip,Y,sposBPM);offy(isnan(offy))=0;
0018 offr=interp1(sposDip,T,sposBPM);offr(isnan(offr))=0;
0019 
0020 rerr=setcellstruct(rerr,'Offset',indbpm(2:end-1),bpmerr.offsetx-offx(2:end-1),1,1);
0021 rerr=setcellstruct(rerr,'Offset',indbpm(2:end-1),bpmerr.offsetx-offy(2:end-1),1,2);
0022 rerr=setcellstruct(rerr,'Rotation',indbpm(2:end-1),bpmerr.rotation-offr(2:end-1)*0,1,1);% NO ROTATION!! *0
0023 
0024 disp('BPMs on dipole positions curve');
0025 
0026 return
0027

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