Commit aeb356d6 authored by Simone Liuzzo's avatar Simone Liuzzo

added tune correction, not tested

parent e9a7da7f
......@@ -37,6 +37,17 @@ end
elem.PolynomB(2)=k;
end
if isfield(qemres,'quadtuneresponse')
resptune=qemres.quadtuneresponse;
else
[resptune]=qemtunederiv(mach,qemres.dpp,@setk,1.e-3,...
[qemres.qcoridx]);
qemres.quadtuneresponse = resptune;
end
% dispersion
disp('h dispersion derivative');
frh = qemres.frespx;
......@@ -44,11 +55,19 @@ frh = qemres.frespx;
dfrh = (qemres.bhscale*frh-frh0); %alpha_c *
[~,Q0,~]=atlinopt(mach,qemres.dpp,1);
dtunes = (qemres.tunes-Q0)';
a1 = qemres.hdispRDTcorWeight;
if a1 > 1 | a1<0
error('hor. dispersion weigth should be between 0 and 1');
end
a2 = qemres.tuneRDTcorWeight;
if a2 > 1-a1 | a2<0
error(['tune weigth should be between 0 and ' num2str(1-a1)]);
end
disp('start correction');
if isfield(qemres,'qcorkeep')
......@@ -59,13 +78,15 @@ else
end
sk=[false(size(qemres.qpidx)) qpmask];
rsp=[...
(1-a1)*real(respx(:,sk));imag(respx(:,sk));...
(1-a1)*real(respz(:,sk));imag(respz(:,sk));...
a1*rx(:,qpmask)]; % dispersion
(1-a1-a2)*real(respx(:,sk));imag(respx(:,sk));...
(1-a1-a2)*real(respz(:,sk));imag(respz(:,sk));...
a1*rx(:,qpmask);...dispersion
a2*resptune]; % tune
b=[...
(1-a1)*real(fx);imag(fx);...
(1-a1)*real(fz);imag(fz);...
a1*dfrh];
(1-a1-a2)*real(fx);imag(fx);...
(1-a1-a2)*real(fz);imag(fz);...
a1*dfrh;... % dispersion
a2*dtunes]; % tune
cor=cor0;
% cor(qpmask)=cor(qpmask)-rsp\b;
......
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