sempanelplot.m 1.5 KB
Newer Older
Simone Liuzzo's avatar
Simone Liuzzo committed
1 2 3 4 5 6 7 8
function sempanelplot(fig,plotcode,qemb0,qemb,qemres)
%SEMPANELPLOT Plot various lattice parameters
%   Detailed explanation goes here

sbpm=cat(1,qemb.lindata.SPos);
sskew=findspos(qemb.at(:),qemres.skewidx);
figure(fig);
switch plotcode
Simone Liuzzo's avatar
Simone Liuzzo committed
9 10 11 12 13 14
   case 1       % D01 spot
	  semplotemit(1.0e12*qemb.d01data.beam66([1 3],[1 3]))
	  xlabel('x [\mum]');
	  ylabel('z [\mum]');
   case 2       % ID07 spot
	  semplotemit(1.0e12*qemb.id07data.beam66([1 3],[1 3]))
Simone Liuzzo's avatar
Simone Liuzzo committed
15 16
	  xlabel('x [\mum]');
	  ylabel('z [\mum]');
Simone Liuzzo's avatar
Simone Liuzzo committed
17 18 19 20 21 22
   case 3       % D17 spot
	  semplotemit(1.0e12*qemb.d17data.beam66([1 3],[1 3]))
	  xlabel('x [\mum]');
	  ylabel('z [\mum]');
   case 4      % ID25 spot
	  semplotemit(1.0e12*qemb.id25data.beam66([1 3],[1 3]))
Simone Liuzzo's avatar
Simone Liuzzo committed
23 24
	  xlabel('x [\mum]');
	  ylabel('z [\mum]');
Simone Liuzzo's avatar
Simone Liuzzo committed
25 26
   case 5       % D27 spot
	  semplotemit(1.0e12*qemb.d27data.beam66([1 3],[1 3]))
Simone Liuzzo's avatar
Simone Liuzzo committed
27 28
	  xlabel('x [\mum]');
	  ylabel('z [\mum]');
Simone Liuzzo's avatar
Simone Liuzzo committed
29
   case 6       % RDT
Simone Liuzzo's avatar
Simone Liuzzo committed
30 31 32 33 34 35 36 37
	  [f1,f2]=semrdt(qemb0.at,qemres,qemb.ks,qemb.skewcor(:,end));
	  plot(sbpm,[abs(f1) abs(f2)]);
	  ax=axis;
	  axis([0 844.39 0 ax(4)]);
	  plotskew(sskew);
	  xlabel('s [m]');
	  ylabel('RDT');
	  grid on
Simone Liuzzo's avatar
Simone Liuzzo committed
38
   case 7       % Gamma-1
Simone Liuzzo's avatar
Simone Liuzzo committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
	  gamma=cat(1,qemb.lindata.gamma);
	  plot(sbpm,gamma-1);
	  ax=axis;
	  ym=max(abs(ax([3 4])));
	  axis([0 844.39 -ym ym]);
	  plotskew(sskew);
	  xlabel('s [m]');
	  ylabel('Coupling factor \gamma-1');
	  grid on
   otherwise
end
end

function plotskew(sskew)
ns=size(sskew,2);
ylim=get(gca,'Ylim');
hold('on');
plot([sskew;sskew],repmat([0 0;-.1 .1]*ylim',1,ns),'k');
hold('off');
end