Commit 441f606a authored by Simone Liuzzo's avatar Simone Liuzzo

added neig as input from application

parent fa74d8fa
......@@ -529,7 +529,7 @@ termTS=repmat(S,[1 1 nfq]).*(termS2-termS1+termS3);
% the dipoles term
Amplitude_ik=sqrt(bxb*(bxd))/2/sx;
if nbd>0
if nbd>0 & nfq>nbd
warning('CalcRespXXRespMat_thick_V2: problem if more dipoles than quadrupoles!')
dipoleterm=[zeros(nb,nfq-nbd) (ones(nb,1)*h_j).*Amplitude_ik.*((ones(nb,1)*dI_js1).*S_ij1+(ones(nb,1)*dI_jc1).*C_ij1)];
else
......
......@@ -15,9 +15,9 @@ if coupling
% qemb.dipdelta,qemb.ks,qemb.skewcor(:,end),qemb.diptilt);
[k,tilts]=semtilt(qemb.kn,qemb.ks);
mach=atsetshift(qemres.at(:),qemres.sextidx,qemb.dxs,qemb.dzs);
mach=atsettilt(mach,qemres.dipidx,qemb.diptilt);
mach=atsettilt(mach,qemres.dipidx,qemb.diptilt); % dipole rotations
mach=setcellstruct(mach,'PolynomA',qemres.skewidx,qemb.skewcor(:,end)./qemres.skewl,2);
mach=atsettilt(mach,qemres.qpidx,tilts);
mach=atsettilt(mach,qemres.qpidx,tilts); % quadrupole tilts
bend=getcellstruct(mach,'BendingAngle',qemres.dipidx);
mach=setcellstruct(mach,'BendingAngle',qemres.dipidx,(1+qemb.dipdelta).*bend);
mach=setcellstruct(mach,'PolynomB',qemres.qcoridx,qemb.cor(:,end)./qemres.qcorl,2);
......
......@@ -28,5 +28,7 @@ b=[...
real(fz);imag(fz)];
cor=cor0;
cor(qpmask)=cor(qpmask)-rsp\b;
% cor(qpmask)=cor(qpmask)-rsp\b;
cor(qpmask)=cor(qpmask)-qemsvd(rsp,b,qemres.neigQuadRDTcor);
end
......@@ -45,41 +45,41 @@ dval(1:nq)=dv;
dresp=zeros((nhst+nvst)*nbpm+nbpm+2,nq);
drespskew=zeros((nhst+nvst)*nbpm+nbpm,nq);
bndidx=find(atgetcells(mach,'BendingAngle'));
bndidx=find(atgetcells(mach,'BendingAngle')); % all dipoles
bndidx(1) =[]; % remove septum with zero angle giving NAN!
bndidx=sort(bndidx([1:4:end,4:4:end]));% only long part
% disp('ANALYTIC QEMPANEL Response')
% bndidx = find(atgetcells(mach,'FamName','[JD]L\w*'));
dispfunc(1,3);
disp('ANALYTIC QEMPANEL Response AT2.0/errors_corrections')
% % get anlytical RM response
% [...
% dX_dq, dY_dq, ...
% dDx_dq, dDx_db, Dx, ...
% dXY_ds, dYX_ds, ...
% XY, YX, ...
% dDx_ds, dDy_ds...
% ]=CalcRespXXRespMat_thick_mod(...
% ]=CalcRespXXRespMat_thick_V2(...
% mach',dpp,...
% bpmidx',... % bpm
% hsidxlat,... % correctors
% varidx,... % quadrupoles
% bndidx',...
% varidx);
dispfunc(1,3);
disp('ANALYTIC QEMPANEL Response V2')
% get anlytical RM response
% bndidx',...% dipoles
% varidx); % quadrupoles
[...
dX_dq, dY_dq, ...
dDx_dq, dDx_db, Dx, ...
dDx_dq, ~, ~, ...
dXY_ds, dYX_ds, ...
dDx_ds, dDy_ds...
]=CalcRespXXRespMat_thick_V2(...
~, dDy_ds, ...
~...
]=AnalyticResponseMatrixDerivative(...
mach',dpp,...
bpmidx',... % bpm
hsidxlat,... % correctors
varidx,... % quadrupoles
bndidx',...
bndidx',... % no dipoles, later
varidx);
qind=find(atgetcells(mach,'Class','Quadrupole'))'; % response matrix computed always at all quadrupoles
quadforresponse=find(ismember(qind,varidx)); % quadrupoles to use for fit amoung all
......
......@@ -17,7 +17,8 @@ dfrh=qemres.bhscale*frh-frh0;
[dipresponse,~]=qemdispderiv(mach,qemres.ct,@setbendangle,1.e-3,...
qemres.dipidx,qemres.bpmidx);
bok=isfinite(dfrh)&okbpm;
dipdelta=dipresponse(bok,okfit)\dfrh(bok);
dipdelta = qemsvd(dipresponse(bok,okfit),dfrh(bok),qemres.neigDipFit);
function elt=setbendangle(elt,dval)
ba=elt.BendingAngle;
......
......@@ -16,7 +16,9 @@ if isempty(okfit), okfit=true(size(qemres.dipidx)); end
dfrh=qemres.bhscale*frh-frh0;
[dipresponse,~]=qemdispderivAnalytic(mach,qemres.dipidx,qemres.bpmidx);
bok=isfinite(dfrh)&okbpm;
dipdelta=dipresponse(bok,okfit)\dfrh(bok);
dipdelta = qemsvd(dipresponse(bok,okfit),dfrh(bok),qemres.neigDipFit);
function elt=setbendangle(elt,dval)
ba=elt.BendingAngle;
......
No preview for this file type
......@@ -22,7 +22,7 @@ function varargout = qempanel2(varargin)
% Edit the above text to modify the response to help qempanel2
% Last Modified by GUIDE v2.5 24-Aug-2018 14:19:48
% Last Modified by GUIDE v2.5 30-Jan-2019 15:19:12
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
......@@ -85,6 +85,7 @@ dirname=qemseldir();
qemres.datadir=dirname;
[qemres,semres,qemb]=qempanelset(dirname,get(handles.PartialRMcheckbox,'Value'));
handles.qemdata=qempaneldata(dirname,handles);
set(handles.edit1,'String',dirname);
set(handles.ExcludeBPMList,'String','');
......@@ -127,6 +128,11 @@ set(handles.DCRMcheckbox,'Enable','off')
set(handles.FullRMcheckbox,'Enable','off')
set(handles.PartialRMcheckbox,'Enable','off')
% get value of
qemres.neigDipFit=str2double(handles.neigDipFit.String);
qemres.neigQuadFit=str2double(handles.neigQuadFit.String);
qemres.neigQuadRDTcor=str2double(handles.neigQuadRDTcor.String);
wrongbpms=qemres.wrongbpms; % find(bpmm.All_Status.read~=0)
[semres.resph,semres.respv]=semloadresp(qemres,semres,wrongbpms);
[qemres.resph,qemres.respv,qemres.frespx,semres.frespz]=qemcheckresp(qemres,semres,wrongbpms);
......@@ -201,7 +207,7 @@ function pushbutton7_Callback(hObject, eventdata, handles)
% handles structure with handles and user data (see GUIDATA)
global qemb qemres semres MACHFS
tnow=now();
measpath=fullfile(MACHFS,'MDT',datestr(tnow,'yyyy'),datestr(tnow,'yyyy_mm_dd'));
measpath=fullfile(MACHFS,'MDT',datestr(tnow,'yyyy'),datestr(tnow,'mm_dd'));
list=dir(fullfile(measpath,'resp*'));
namelist={list.name};
......@@ -452,7 +458,7 @@ if ~ok
end
if ok
% qemwritecor(corfile,-qemb(2).cor(:,end));
save_correction(corfile,qemres.qpcode,qemb(2).cor(:,end),qemres.opticsdir);
% save_correction(corfile,qemres.qpcode,qemb(2).cor(:,end),qemres.opticsdir);
set(handles.pushbutton18,'Enable','On');
end
set(handles.statustext,'String','correction saved');
......@@ -695,3 +701,85 @@ function ExcludeBPMList_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function neigQuadRDTcor_Callback(hObject, eventdata, handles)
% hObject handle to neigQuadRDTcor (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of neigQuadRDTcor as text
% str2double(get(hObject,'String')) returns contents of neigQuadRDTcor as a double
global qemres
qemres.neigQuadRDTcor = str2double(get(hObject,'String'));
if ~isempty(handles)
set(handles.statustext,'String',[ num2str(qemres.neigQuadFit) ' correction eigenvectors ']);
end
% --- Executes during object creation, after setting all properties.
function neigQuadRDTcor_CreateFcn(hObject, eventdata, handles)
% hObject handle to neigQuadRDTcor (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function neigQuadFit_Callback(hObject, eventdata, handles)
% hObject handle to neigQuadFit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of neigQuadFit as text
% str2double(get(hObject,'String')) returns contents of neigQuadFit as a double
global qemres
qemres.neigQuadFit = str2double(get(hObject,'String'));
if ~isempty(handles)
set(handles.statustext,'String',[ num2str(qemres.neigQuadFit) ' quad. fit eigenvectors ']);
end
% --- Executes during object creation, after setting all properties.
function neigQuadFit_CreateFcn(hObject, eventdata, handles)
% hObject handle to neigQuadFit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function neigDipFit_Callback(hObject, eventdata, handles)
% hObject handle to neigDipFit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of neigDipFit as text
% returns contents of neigDipFit as a double
global qemres
qemres.neigDipFit = str2double(get(hObject,'String'));
if ~isempty(handles)
set(handles.statustext,'String',[ num2str(qemres.neigDipFit) ' dipole fit eigenvectors ']);
end
% --- Executes during object creation, after setting all properties.
function neigDipFit_CreateFcn(hObject, eventdata, handles)
% hObject handle to neigDipFit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
......@@ -64,6 +64,8 @@ if ~isfield(mode,'vnorm')
% vv=sr.unfold(repmat(vv,1,32));
% mode.vnorm=vv(okfit)';
end
mode.neigs=qemres.negiQuadFit;
newkn=qemb.kn;
newkn(okfit)=qemb.kn(okfit)+qemerrfit(nhst,nvst,resp-resp0,dresp,mode,okbpm);
end
......@@ -60,7 +60,6 @@ dresp=qemderivAnalytic(qemb.at,dpp,@setk,0.0001,qemres.qpidx(okfit),qemres.bpmid
%drespN= qemderiv(qemb.at,dpp,@setk,0.0001,qemres.qpidx(okfit),qemres.bpmidx,shidx,svidx,disparg{:});
%save('dispderivativecompare','drespA','drespN');
%figure; plot(drespA(:));hold on; plot(drespN(:)); plot(drespA(:)-drespN(:)); xlabel('RM derivative element'); ylabel('RM derivative [m/rad/K_{quad}]'); legend('analytic','qempanel','difference')
%
[rh,rh2v,rv2h,rv,frh,frv]=qemdecode(qemb.at,qemres.ct,qemres,...
qemres.resph,semres.respv,semres.resph,qemres.respv,...
......@@ -80,6 +79,8 @@ if ~isfield(mode,'vnorm')
% vv=sr.unfold(repmat(vv,1,32));
% mode.vnorm=vv(okfit)';
end
mode.neigs=qemres.neigQuadFit;
newkn=qemb.kn;
newkn(okfit)=qemb.kn(okfit)+qemerrfit(nhst,nvst,resp-resp0,dresp,mode,okbpm);
end
......@@ -50,23 +50,23 @@ semres.skewkeep=true(1,288);
mach=atmod.ring;
try
warning('HARD CODED NUMBERS! NOT GOOD!')
warning('missing skew quadrupoles and normal quadrupole correctors!')
warning('missing skew quadrupoles and normal quadrupole correctors! ebs.read_mag returns correction strengths! not full strengths!')
% set sextupole correction strengths from accelerator to AT lattice
indsext=atmod.get(0,'sx')'; %get sextupole indexes
Ksext=ebs.read_mag(ebs.sxname([1:192]));%,'Tango://ebs-simu:10000/srmag/m-s')');
Ksext=ebs.read_mag(ebs.sxname([1:length(indsext)]));%,'Tango://ebs-simu:10000/srmag/m-s')');
disp(['' num2str(length(isnan(Ksext))) ...
' sextupoles corrections std: ' num2str(std(Ksext))]);
mach=atsetfieldvalues(mach,indsext(~isnan(Ksext)),'PolynomB',{1,3},Ksext(~isnan(Ksext))');
% mach=atsetfieldvalues(mach,indsext(~isnan(Ksext)),'PolynomB',{1,3},Ksext(~isnan(Ksext))');
% set octupole correction strengths from accelerator to AT lattice
indoct=atmod.get(0,'oc')'; %get sextupole indexes
Koct=ebs.read_mag(ebs.ocname([1:64]));%,'Tango://ebs-simu:10000/srmag/m-s')');
Koct=ebs.read_mag(ebs.ocname([1:length(indoct)]));%,'Tango://ebs-simu:10000/srmag/m-s')');
disp(['' num2str(length(isnan(Koct))) ...
' octupole corrections std: ' num2str(std(Koct))]);
mach=atsetfieldvalues(mach,indoct(~isnan(Koct)),'PolynomB',{1,3},Koct(~isnan(Koct))');
% mach=atsetfieldvalues(mach,indoct(~isnan(Koct)),'PolynomB',{1,4},Koct(~isnan(Koct))');
catch
......@@ -200,7 +200,7 @@ if nargout >= 3
end
A=textscan(fopen(fullfile(qemres.datadir,'quadcor.dat'),'r'),'%s %f','HeaderLines',7);
qemb(2).cor=A{2};
qemb(2).cor=A{2};
qemb(2).skewcor=zeros(length(qemres.skewidx),1);
qemb(2).dzs=zeros(length(qemres.sextidx),1);
qemb(2).diptilt=zeros(length(qemres.dipidx),1);
......
......@@ -13,7 +13,7 @@ dfrv=semres.bvscale*frv-frv0;
[~,dipresponse]=qemdispderiv(mach,qemres.ct,@tiltelem,1.e-4,qemres.dipidx,qemres.bpmidx);
bok=isfinite(dfrv)&okbpm;
%diprot=dipresponse(bok,okfit)\dfrv(bok);
diprot = qemsvd(dipresponse(bok,okfit),dfrv(bok),5);%floor(length(find(okfit))/2));
diprot = qemsvd(dipresponse(bok,okfit),dfrv(bok),semres.neigDipFit);%floor(length(find(okfit))/2));
function elt=tiltelem(elt,dval)
vini=atan2(elt.R1(1,3),elt.R1(1,1));
......
......@@ -14,7 +14,7 @@ dfrv=semres.bvscale*frv-frv0;
bok=isfinite(dfrv)&okbpm;
% diprot=dipresponse(bok,okfit)\dfrv(bok);
diprot = qemsvd(dipresponse(bok,okfit),dfrv(bok),5);%floor(length(find(okfit))/6));
diprot = qemsvd(dipresponse(bok,okfit),dfrv(bok),semres.neigDipFit);%floor(length(find(okfit))/6));
function elt=tiltelem(elt,dval)
vini=atan2(elt.R1(1,3),elt.R1(1,1));
......
No preview for this file type
......@@ -22,7 +22,7 @@ function varargout = sempanel2(varargin)
% Edit the above text to modify the response to help sempanel2
% Last Modified by GUIDE v2.5 22-Mar-2018 16:54:55
% Last Modified by GUIDE v2.5 30-Jan-2019 16:22:25
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
......@@ -89,7 +89,12 @@ semres.iaxemz=semloadiax(qemres.datadir);
handles.semdata=sempanelset(qemres.datadir,handles);
A=textscan(fopen(fullfile(qemres.datadir,'skewcor.dat'),'r'),'%s %f','HeaderLines',7); %read from setting manager saved file
qemb(2).skewcor=A{2}*0; warning('zero initial skew quadrupoles')
qemb(2).skewcor=A{2}; %warning('zero initial skew quadrupoles')
% get value of
semres.neigDipFit=str2double(handles.neigDipFit.String);
semres.neigQuadFit=str2double(handles.neigQuadFit.String);
semres.neigQuadRDTcor=str2double(handles.neigQuadRDTcor.String);
set(handles.pushbutton3,'Enable','On');
set(handles.pushbutton9,'Enable','On');
......@@ -299,8 +304,9 @@ if ~ok
if ischar(fname), corfile=fullfile(fpath,fname); ok=true; end
end
if ok
save_correction(corfile,qemres.skcode,qemb(2).skewcor(:,end),...
qemres.opticsdir);
% save_correction(corfile,qemres.skcode,,...
% qemres.opticsdir);
ebs.save_correction( ebs.skewname(1:length(qemres.skewidx)),qemb(2).skewcor(:,end));
set(handles.pushbutton18,'Enable','On');
end
set(handles.statustext,'String','correction saved');
......@@ -330,11 +336,13 @@ function pushbutton18_Callback(hObject, eventdata, handles)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global qemres
bindir=[getenv('MACH_HOME') '/bin/' getenv('MACHARCH') '/'];
corfile=fullfile(qemres.datadir, 'skewnew.dat');
sr.setcorbase(corfile,'sr/qp-s/all','sr/reson-skew/m1_n1_p50','base_skew2'); % Set resonance device
[s,w]=unix([bindir 'dvset <' corfile]); %#ok<ASGLU> % Set values
disp(w);
% bindir=[getenv('MACH_HOME') '/bin/' getenv('MACHARCH') '/'];
% corfile=fullfile(qemres.datadir, 'skewnew.dat');
% sr.setcorbase(corfile,'sr/qp-s/all','sr/reson-skew/m1_n1_p50','base_skew2'); % Set resonance device
% [s,w]=unix([bindir 'dvset <' corfile]); %#ok<ASGLU> % Set values
% disp(w);
set(handles.statustext,'String','correction applied');
......@@ -522,3 +530,89 @@ function checkbox2_Callback(hObject, eventdata, handles)
% Hint: get(hObject,'Value') returns toggle state of checkbox2
set(handles.checkbox2,'Value',1.0)
set(handles.AnalyticFitCheck,'Value',0.0)
function neigQuadRDTcor_Callback(hObject, eventdata, handles)
% hObject handle to neigQuadRDTcor (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of neigQuadRDTcor as text
% str2double(get(hObject,'String')) returns contents of neigQuadRDTcor as a double
global semres
semres.neigQuadRDTcor = str2double(get(hObject,'String'));
if ~isempty(handles)
set(handles.statustext,'String',[ num2str(semres.neigQuadRDTcor) ' correction eigenvectors ']);
end
% --- Executes during object creation, after setting all properties.
function neigQuadRDTcor_CreateFcn(hObject, eventdata, handles)
% hObject handle to neigQuadRDTcor (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function neigQuadFit_Callback(hObject, eventdata, handles)
% hObject handle to neigQuadFit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of neigQuadFit as text
% str2double(get(hObject,'String')) returns contents of neigQuadFit as a double
global semres
semres.neigQuadFit = str2double(get(hObject,'String'));
if ~isempty(handles)
set(handles.statustext,'String',[ num2str(semres.neigQuadFit) ' quad. fit eigenvectors ']);
end
% --- Executes during object creation, after setting all properties.
function neigQuadFit_CreateFcn(hObject, eventdata, handles)
% hObject handle to neigQuadFit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function neigDipFit_Callback(hObject, eventdata, handles)
% hObject handle to neigDipFit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of neigDipFit as text
% str2double(get(hObject,'String')) returns contents of neigDipFit as a double
global semres
semres.neigDipFit = str2double(get(hObject,'String'));
if ~isempty(handles)
set(handles.statustext,'String',[ num2str(semres.neigDipFit) ' dip. fit eigenvectors ']);
end
% --- Executes during object creation, after setting all properties.
function neigDipFit_CreateFcn(hObject, eventdata, handles)
% hObject handle to neigDipFit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
......@@ -19,11 +19,11 @@ function [newks,quadresponse]=sempanelfitq(qemb,qemres,semres,varargin)
% narg=narg-1;
% end
if isfield(semres,'quadresponse')
quadresponse=semres.quadresponse;
else
% if isfield(semres,'quadresponse')
% quadresponse=semres.quadresponse;
% else
quadresponse=semquadresp(qemb,qemres,semres,varargin{:});
end
%end
orbit0=findsyncorbit(qemb.at,qemres.ct,qemres.bpmidx);
[rh,rh2v,rv2h,rv,frh,frv]=qemdecode(qemb.at,qemres.ct,qemres,...
......@@ -40,6 +40,7 @@ resp=[rh2v(:);rv2h(:);semres.bvscale*frv];
% mode=struct('vnorm',sqrt([0.77;2;0.9;1.15;1.15;0.9;2;1]));
mode=struct();
mode=struct('dispweight',semres.wdisp); % struct();%
mode.neigs=semres.neigQuadFit; % struct();%
% newks=qemb.ks+semerrfit(length(semres.hlist),length(semres.vlist),resp-resp0,...
% quadresponse,mode,varargin{:});
......
......@@ -38,6 +38,9 @@ orbit0=findsyncorbit(qemb.at,qemres.ct,qemres.bpmidx);
resp0=[rh2v0(:);rv2h0(:);frv0];
resp=[rh2v(:);rv2h(:);semres.bvscale*frv];
mode=struct('dispweight',semres.wdisp); % struct();%
mode.neigs=semres.neigQuadFit; % struct();%
% newks=qemb.ks+semerrfit(length(semres.hlist),length(semres.vlist),resp-resp0,...
% quadresponse,mode,varargin{:});
newks=qemb.ks + semerrfit(length(semres.hlist),length(semres.vlist),resp-resp0,...
......
......@@ -35,5 +35,6 @@ b=[...
a2*qemb.frespz];
cor=cor0;
cor(skmask)=cor(skmask)-rsp\b;
% cor(skmask)=cor(skmask)-rsp\b;
cor(skmask)=cor(skmask)-qemsvd(rsp,b,semres.neigQuadRDTcor);
end
\ No newline at end of file
......@@ -17,8 +17,8 @@ meanf=NaN*ones(nq,nm);
for i=1:nm
[k(:,i),tilts(:,i)]=semtilt(kn,ks(:,i));
tiltf=tilts(:,i);
stdf(:,i)=std(tiltf,1,2);
meanf(:,i)=mean(tiltf,2);
stdf(:,i)=std(tiltf);
meanf(:,i)=mean(tiltf);
end
stda=std(tilts,1,1);
stdf(nq+1,:)=std(diptilt);
......@@ -29,9 +29,11 @@ for i=1:nq+1
end
if nargin >= 4 % displays quad rotations
bar(ax,stdf(1:nq));
title(ax,'Magnet rotation errors');
plot(ax,[tilts;diptilt]);
title(ax,['Magnet rotation errors: quad (' num2str(length(tilts)) ...
') ,dip (' num2str(length(diptilt)) ') ']);
ylabel(ax,'\Theta');
ax.XLim=[0 length([tilts;diptilt])];
grid(ax,'on');
% set(ax,'Xlim',[0 nq+1],'XTickLabel',labels,'XTickLabelRotation',30);
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment