Commit f9b2cd6f authored by beamdyn's avatar beamdyn
Browse files

corrected bug in fitted quadrupole selection

parent 7b0d6db1
......@@ -80,17 +80,21 @@ disp('ANALYTIC QEMPANEL Response V2')
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
dispfunc(2,3);
for ib=1:nq
for iq=1:nq
ib = quadforresponse(iq); % use only selected quadrupoles
rha=dX_dq(:,:,ib);
rva=dY_dq(:,:,ib);
dxdqa=[-dDx_dq(:,ib);0;0]/dval(ib);% analytic, no tune dispersion derivative very different from
dresp(:,ib)=[rha(:);rva(:);dxdqa];
dxdqa=[-dDx_dq(:,ib);0;0]/dval(iq);% analytic, no tune dispersion derivative very different from
dresp(:,iq)=[rha(:);rva(:);dxdqa];
rhsa=dXY_ds(:,:,ib);
rvsa=dYX_ds(:,:,ib);
dxdqsa=[-dDy_ds(:,ib)]/dval(ib);% analytic, no tune dispersion derivative very different from
drespskew(:,ib)=[rhsa(:);rvsa(:);dxdqsa];
dxdqsa=[-dDy_ds(:,ib)]/dval(iq);% analytic, no tune dispersion derivative very different from
drespskew(:,iq)=[rhsa(:);rvsa(:);dxdqsa];
end
......
......@@ -57,15 +57,19 @@ resp=zeros(nbpm*(nhst+nvst),nq);
respa=resp;
LQ=atgetfieldvalues(mach,fitlist,'Length');
for ib=1:nq
qind=find(atgetcells(mach,'Class','Quadrupole'))'; % response matrix computed always at all quadrupoles
quadforresponse=find(ismember(qind,fitlist)); % quadrupoles to use for fit amoung all
for iq=1:nq
% rv=vqb(:,ib)*hkq(ib,:); % ATTENTION
% rh=hqb(:,ib)*vkq(ib,:);
% resp(:,ib)=[rv(:);rh(:)];
ib = quadforresponse(iq); % use only selected quadrupoles
rva=dYX_ds(:,:,ib); % ANALYTIC
rha=dXY_ds(:,:,ib);
respa(:,ib)=[rva(:);rha(:)]./LQ(ib); %FACTOR LQ length of quadrupoles to make the 2 response identical.
dispfunc(ib,nq);
respa(:,iq)=[rva(:);rha(:)]./LQ(iq); %FACTOR LQ length of quadrupoles to make the 2 response identical.
dispfunc(iq,nq);
end
% % to test several times, run in command line >> global semres; semres=rmfield(semres,'quadresponse');
......
Supports Markdown
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