Commit 3a0c67a7 authored by Simone Liuzzo's avatar Simone Liuzzo

potentially different ha dn v steerers arrays

parent b35b5967
......@@ -17,6 +17,11 @@ nq=length(fitlist);
nbpm=length(blist);
nhst=length(hslist);
nvst=length(vslist);
hsidxlat=hslist;
vsidxlat=vslist;
allsidxlat = sort(unique([hsidxlat vsidxlat]));
% [v,j,kdx]=unique([fitlist blist hslist vslist]); %#ok<ASGLU>
% qidx=kdx(1:nq);
% bidx=kdx(nq+(1:nbpm));
......@@ -50,11 +55,21 @@ bndidx=sort(bndidx([1:4:end,4:4:end]));% only long part
]=AnalyticResponseMatrixDerivative(...
mach',dpp,...
blist',... % bpm
hslist,... % correctors
allsidxlat,... % correctors
fitlist,... % quadrupoles
bndidx',... % any index, unused.
fitlist);
% select vertical and horizontal steerers from global vector
hst=find(ismember(allsidxlat,hsidxlat)); % h steerers
dX_dq= dX_dq(:,hst,:);
dXY_ds= dXY_ds(:,hst,:);
vst=find(ismember(allsidxlat,vsidxlat)); % v steerers
dY_dq= dY_dq(:,vst,:);
dYX_ds= dYX_ds(:,vst,:);
resp=zeros(nbpm*(nhst+nvst),nq);
respa=resp;
LQ=atgetfieldvalues(mach,fitlist,'Length');
......
......@@ -31,8 +31,18 @@ if mode.dispweight>0, inisel(orbitrange+(1:nbpm))=true; end % Keep dispersion
bok=repmat(okbpm,nhst+nvst+1,1) & isfinite(resp);
v=ones(size(mode.vnorm));
w=[ones(orbitrange,1);mode.dispweight*ones(nbpm,1)];
hsets=reshape(1:nhst,mode.nsets,[]);
vsets=reshape(1:nvst,[],mode.nsets)';
try
hsets=reshape(1:nhst,mode.nsets,[]);
vsets=reshape(1:nvst,[],mode.nsets)';
catch
warning('Error dividing in subsets')
disp([ 'NHst/Nsets = ' num2str(nhst) ' / ' num2str(mode.nsets) ' = ' num2str(nhst/mode.nsets) '<-should be integer'])
disp([ 'NVst/Nsets = ' num2str(nvst) ' / ' num2str(mode.nsets) ' = ' num2str(nvst/mode.nsets) '<-should be integer'])
disp('setting nsets = 1');
mode.nsets = 1;
hsets=reshape(1:nhst,mode.nsets,[]);
vsets=reshape(1:nvst,mode.nsets,[]);
end
% hsets=reshape(1:nhst,[],mode.nsets)';
% vsets=reshape(1:nvst,mode.nsets,[]);
sk=semsolvex(dresp(:,okfit).*(w*v(okfit)'),resp.*w,bok,hsets,vsets,mode.neigs);
......
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