Commit cb4dfbb5 authored by Simone Liuzzo's avatar Simone Liuzzo

sempanel updated

parent 76c80845
......@@ -18,7 +18,7 @@ orbitrange=nbpm*(nhst+nvst);
if nargin<7, okbpm=true(nbpm,1); end
if nargin<6, okfit=true(nq,1); end
if nargin<5 || isempty(mode), mode=struct; end
if ~isfield(mode,'nsets'), mode.nsets=16; end
if ~isfield(mode,'nsets'), mode.nsets=4; end
if ~isfield(mode,'neigs'), mode.neigs=100; end
if ~isfield(mode,'dispweight'), mode.dispweight=0; end
if ~isfield(mode,'vnorm')
......
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 30-Jan-2019 16:22:25
% Last Modified by GUIDE v2.5 31-Jan-2019 07:54:26
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
......@@ -306,10 +306,13 @@ end
if ok
% save_correction(corfile,qemres.skcode,,...
% qemres.opticsdir);
ebs.save_correction( ebs.skewname(1:length(qemres.skewidx)),qemb(2).skewcor(:,end));
ebs.save_correction( corfile, ... filename
ebs.skewname(1:length(qemres.skewidx)),... device names
qemb(2).skewcor(:,end)); % correction values
set(handles.pushbutton18,'Enable','On');
end
set(handles.statustext,'String','correction saved');
set(handles.statustext,'String',['correction saved in: ' corfile]);
% --- Executes on button press in pushbutton17: Corrections->Load
function pushbutton17_Callback(hObject, eventdata, handles)
......@@ -335,16 +338,29 @@ function pushbutton18_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton18 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global qemres
global qemres qemb
% 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);
all_skew_ind = find(atgetcells(qemres(1).at,'FamName','S[FDIJH]\w*'))';
skewind = ismember(all_skew_ind,qemres.skewidx);
skewcor = zeros(size(all_skew_ind));
skewcor(skewind) = qemb(2).skewcor(:,end);
sqpdev = tango.Device('srmag/sqp/all');
set(handles.statustext,'String','correction applied');
try
sqpdev.Strengths = skewcor;
set(handles.statustext,'String','correction applied');
catch err
disp(err);
set(handles.statustext,'String','correction NOT applied, probably too strong correctors.');
end
% --- Executes on selection change in popupmenu2.
function popupmenu2_Callback(hObject, eventdata, handles)
......@@ -614,5 +630,3 @@ function neigDipFit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
......@@ -80,80 +80,80 @@ end
% %% compare to simulator
a=load('/operation/appdata/ebs/optics/settings/theory/errcormodel.mat','errcormodel'); warning('replace by ring simulator lattice or remove');
rs=a.errcormodel;
inds=1:length(rs);
indbs=find(atgetcells(rs,'Class','Monitor'))';
modulh=bmodul(qemb.beta(:,1),qemb0.beta(:,1));
modulv=bmodul(qemb.beta(:,2),qemb0.beta(:,2));
[ls,ts,cs]=atlinopt(rs,0,inds);
ss=arrayfun(@(a)a.SPos(1),ls);
bxs=arrayfun(@(a)a.beta(1),ls);
bys=arrayfun(@(a)a.beta(2),ls);
dxs=arrayfun(@(a)a.Dispersion(1),ls);
dzs=arrayfun(@(a)a.Dispersion(3),ls);
modulhS=bmodul(bxs(indbs)',qemb0.beta(:,1));
modulvS=bmodul(bys(indbs)',qemb0.beta(:,2));
%%
figure;
subplot(2,2,1)
qemmodulplot(gca, sbpm, modulh, '');hold on;
qemmodulplot(gca, ss(indbs),modulhS, '');hold off;
legend('\beta_x FIT','\beta_x SIMULATOR','Location','NorthWest')
subplot(2,2,2)
qemmodulplot(gca, sbpm, modulv, '');hold on;
qemmodulplot(gca, ss(indbs),modulvS, '');hold off;
legend('\beta_z FIT','\beta_z SIMULATOR','Location','NorthWest')
subplot(2,2,3)
if isfield(qemres,'frespx')
plot(gca,sbpm,-qemb.pm.alpha*[qemb.frespx-qemb0.frespx...
qemres.bhscale*qemres.frespx-qemb0.frespx...
(qemb.frespx-qemb0.frespx)-(qemres.bhscale*qemres.frespx-qemb0.frespx)]);
else
plot(gca,sbpm,-qemb.pm.alpha*(qemb.frespx-qemb0.frespx));
end
hold on;
plot(gca,sbpm,(dxs(indbs)'-(-qemb.pm.alpha*qemb0.frespx)));
ax=axis(gca);
ym=max(abs(ax([3 4])));
axis(gca,[0 844.39 -ym ym]);
ylabel(gca,'\eta_x [m]');
grid(gca,'on');
legend(gca,'\Delta\eta_x measured','\Delta\eta_x fit','\Delta\eta_x difference','\Delta\eta_x simulator','Location','NorthWest')
subplot(2,2,4)
if isfield(qemres,'frespz')
plot(gca,sbpm,-qemb.pm.alpha*[qemb.frespz-qemb0.frespz...
qemres.bzscale*qemres.frespz-qemb0.frespz...
(qemb.frespz-qemb0.frespz)-(qemres.bhscale*qemres.frespz-qemb0.frespz)]);
else
plot(gca,sbpm,-qemb.pm.alpha*(qemb.frespz-qemb0.frespz));
end
hold on;
plot(gca,sbpm,(dzs(indbs)'-(-qemb.pm.alpha*qemb0.frespz)));
ax=axis(gca);
ym=max(abs(ax([3 4])));
axis(gca,[0 844.39 -ym ym]);
ylabel(gca,'\eta_z [m]');
grid(gca,'on');
legend(gca,'\Delta\eta_z measured',....
'\Delta\eta_z fit','\Delta\eta_z difference',...
'\Delta\eta_z simulator','Location','NorthWest')
disp('simulator (will be removed)');toc;
%
% % %% compare to simulator
% a=load('/operation/appdata/ebs/optics/settings/theory/errcormodel.mat','errcormodel'); warning('replace by ring simulator lattice or remove');
% rs=a.errcormodel;
% inds=1:length(rs);
% indbs=find(atgetcells(rs,'Class','Monitor'))';
%
% modulh=bmodul(qemb.beta(:,1),qemb0.beta(:,1));
% modulv=bmodul(qemb.beta(:,2),qemb0.beta(:,2));
%
% [ls,ts,cs]=atlinopt(rs,0,inds);
% ss=arrayfun(@(a)a.SPos(1),ls);
% bxs=arrayfun(@(a)a.beta(1),ls);
% bys=arrayfun(@(a)a.beta(2),ls);
% dxs=arrayfun(@(a)a.Dispersion(1),ls);
% dzs=arrayfun(@(a)a.Dispersion(3),ls);
% modulhS=bmodul(bxs(indbs)',qemb0.beta(:,1));
% modulvS=bmodul(bys(indbs)',qemb0.beta(:,2));
%
% %%
% figure;
% subplot(2,2,1)
% qemmodulplot(gca, sbpm, modulh, '');hold on;
% qemmodulplot(gca, ss(indbs),modulhS, '');hold off;
% legend('\beta_x FIT','\beta_x SIMULATOR','Location','NorthWest')
% subplot(2,2,2)
% qemmodulplot(gca, sbpm, modulv, '');hold on;
% qemmodulplot(gca, ss(indbs),modulvS, '');hold off;
% legend('\beta_z FIT','\beta_z SIMULATOR','Location','NorthWest')
%
% subplot(2,2,3)
%
% if isfield(qemres,'frespx')
% plot(gca,sbpm,-qemb.pm.alpha*[qemb.frespx-qemb0.frespx...
% qemres.bhscale*qemres.frespx-qemb0.frespx...
% (qemb.frespx-qemb0.frespx)-(qemres.bhscale*qemres.frespx-qemb0.frespx)]);
% else
% plot(gca,sbpm,-qemb.pm.alpha*(qemb.frespx-qemb0.frespx));
%
% end
% hold on;
% plot(gca,sbpm,(dxs(indbs)'-(-qemb.pm.alpha*qemb0.frespx)));
% ax=axis(gca);
% ym=max(abs(ax([3 4])));
% axis(gca,[0 844.39 -ym ym]);
% ylabel(gca,'\eta_x [m]');
% grid(gca,'on');
% legend(gca,'\Delta\eta_x measured','\Delta\eta_x fit','\Delta\eta_x difference','\Delta\eta_x simulator','Location','NorthWest')
%
% subplot(2,2,4)
%
% if isfield(qemres,'frespz')
% plot(gca,sbpm,-qemb.pm.alpha*[qemb.frespz-qemb0.frespz...
% qemres.bzscale*qemres.frespz-qemb0.frespz...
% (qemb.frespz-qemb0.frespz)-(qemres.bhscale*qemres.frespz-qemb0.frespz)]);
% else
% plot(gca,sbpm,-qemb.pm.alpha*(qemb.frespz-qemb0.frespz));
%
% end
% hold on;
% plot(gca,sbpm,(dzs(indbs)'-(-qemb.pm.alpha*qemb0.frespz)));
% ax=axis(gca);
% ym=max(abs(ax([3 4])));
% axis(gca,[0 844.39 -ym ym]);
% ylabel(gca,'\eta_z [m]');
% grid(gca,'on');
% legend(gca,'\Delta\eta_z measured',....
% '\Delta\eta_z fit','\Delta\eta_z difference',...
% '\Delta\eta_z simulator','Location','NorthWest')
%
% disp('simulator (will be removed)');toc;
%
%
%
if isfield(handles,'selplot') % additional plot
sempanelplot(5,handles.selplot,qemb0,qemb,qemres);
......
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