|
36 | 36 | indx=indx(sok);
|
37 | 37 | [dipoles,qpoles,spoles,mpoles,bpms]=cellfun(@eltype,rok);
|
38 | 38 |
|
39 |
| -ampl=0.05*tlim; % Dipoles |
40 |
| -[xplot,yplot]=setxpl(sl(dipoles),ll(dipoles),[0;0;1;1;0],ampl*[0;1;1;0;0]); |
41 |
| -%[xplot,yplot]=setxpl(sl(dipoles),ll(dipoles),[0;0;1;1;0],ampl*[-1;1;1;-1;-1]); |
42 |
| -if (~isempty(xplot) && ~isempty(yplot)) |
43 |
| - p1=patch(xplot,yplot,[0.5 0.5 1],'DisplayName','Dipoles'); |
44 |
| - %p1=patch(ax,xplot,yplot,[0.5 0.5 1],'DisplayName','Dipoles'); |
| 39 | +sld=sl(dipoles); |
| 40 | +if isempty(sld) |
| 41 | + p1={}; |
45 | 42 | else
|
46 |
| - p1={}; |
| 43 | + ampl=0.05*tlim; % Dipoles |
| 44 | + [xplot,yplot]=setxpl(sld,ll(dipoles),[0;0;1;1;0],ampl*[0;1;1;0;0]); |
| 45 | + p1=patch(xplot,yplot,[0.5 0.5 1],'DisplayName','Dipoles'); |
47 | 46 | end
|
48 | 47 |
|
49 |
| -ampl=0.05*tlim; % Quadrupoles |
50 |
| -foc=reshape(0.4*ampl*sign(atgetfieldvalues(rok(qpoles),'PolynomB',{2})),1,[]); |
51 |
| -[xplot,yplot]=setxpl(sl(qpoles),ll(qpoles),[0;0;0.5;1;1;0],ampl*[0;1;1;1;0;0]); |
52 |
| -yplot(3,:)=yplot(3,:)+foc; |
53 |
| -%[xplot,yplot]=setxpl(sl(qpoles),ll(qpoles),[0;0;0.5;1;1;0.5;0],ampl*[-1;1;1;1;-1;-1;-1]); |
54 |
| -%yplot(6,:)=yplot(6,:)-foc; |
55 |
| -if (~isempty(xplot) && ~isempty(yplot)) |
56 |
| - p2=patch(xplot,yplot,[1 0.5 0.5],'DisplayName','Quadrupoles'); |
57 |
| - %p2=patch(ax,xplot,yplot,[1 0.5 0.5],'DisplayName','Quadrupoles'); |
| 48 | +slq=sl(qpoles); |
| 49 | +if isempty(slq) |
| 50 | + p2={}; |
58 | 51 | else
|
59 |
| - p2={}; |
| 52 | + ampl=0.05*tlim; % Quadrupoles |
| 53 | + foc=reshape(0.4*ampl*sign(atgetfieldvalues(rok(qpoles),'PolynomB',{2})),1,[]); |
| 54 | + [xplot,yplot]=setxpl(slq,ll(qpoles),[0;0;0.5;1;1;0],ampl*[0;1;1;1;0;0]); |
| 55 | + yplot(3,:)=yplot(3,:)+foc; |
| 56 | + p2=patch(xplot,yplot,[1 0.5 0.5],'DisplayName','Quadrupoles'); |
60 | 57 | end
|
61 | 58 |
|
62 |
| -ampl=0.04*tlim; % Sextupoles |
63 |
| -foc=reshape(0.25*ampl*sign(atgetfieldvalues(rok(spoles),'PolynomB',{3})),1,[]); |
64 |
| -[xplot,yplot]=setxpl(sl(spoles),ll(spoles),[0;0;0.33;0.66;1;1;0],ampl*[0;1;1;1;1;0;0]); |
65 |
| -yplot(3:4,:)=yplot(3:4,:)+foc([1;1],:); |
66 |
| -%[xplot,yplot]=setxpl(sl(spoles),ll(spoles),[0;0;0.33;0.66;1;1;0.66;0.33;0],ampl*[-1;1;1;1;1;-1;-1;-1;-1]); |
67 |
| -%yplot(7:8,:)=yplot(7:8,:)-foc([1;1],:); |
68 |
| -if (~isempty(xplot) && ~isempty(yplot)) |
69 |
| - p3=patch(xplot,yplot,[0.5 1 0.5],'DisplayName','Sextupoles'); |
70 |
| - %p3=patch(ax,xplot,yplot,[0.5 1 0.5],'DisplayName','Sextupoles'); |
| 59 | +sls=sl(spoles); |
| 60 | +if isempty(sls) |
| 61 | + p3={}; |
71 | 62 | else
|
72 |
| - p3={}; |
| 63 | + ampl=0.04*tlim; % Sextupoles |
| 64 | + foc=reshape(0.25*ampl*sign(atgetfieldvalues(rok(spoles),'PolynomB',{3})),1,[]); |
| 65 | + [xplot,yplot]=setxpl(sls,ll(spoles),[0;0;0.33;0.66;1;1;0],ampl*[0;1;1;1;1;0;0]); |
| 66 | + yplot(3:4,:)=yplot(3:4,:)+foc([1;1],:); |
| 67 | + p3=patch(xplot,yplot,[0.5 1 0.5],'DisplayName','Sextupoles'); |
73 | 68 | end
|
74 | 69 |
|
75 |
| -ampl=0.03*tlim; % Other multipoles |
76 |
| -[xplot,yplot]=setxpl(sl(mpoles),ll(mpoles),[0;0;1;1;0],ampl*[0;1;1;0;0]); |
77 |
| - %[xplot,yplot]=setxpl(sl(mpoles),ll(mpoles),[0;0;1;1;0],ampl*[-1;1;1;-1;-1]); |
78 |
| -if (~isempty(xplot) && ~isempty(yplot)) |
79 |
| - p4=patch(xplot,yplot,[0 0.5 0]); |
80 |
| - %p4=patch(ax,xplot,yplot,[0 0.5 0]); |
| 70 | +slm=sl(mpoles); |
| 71 | +if isempty(slm) |
| 72 | + p4={}; |
81 | 73 | else
|
82 |
| - p4={}; |
| 74 | + ampl=0.03*tlim; % Other multipoles |
| 75 | + [xplot,yplot]=setxpl(slm,ll(mpoles),[0;0;1;1;0],ampl*[0;1;1;0;0]); |
| 76 | + p4=patch(xplot,yplot,[0 0.5 0]); |
83 | 77 | end
|
84 | 78 |
|
85 |
| -ampl=0.015*tlim; % BPMs |
86 |
| -amplx=0.005*slim; |
87 |
| -[xplot,yplot]=setxpl(sl(bpms),ones(1,sum(bpms)),[-amplx;0;amplx;0;-amplx],[0;-ampl;0;ampl;0]); |
88 |
| -if (~isempty(xplot) && ~isempty(yplot)) |
89 |
| - p5=patch(xplot,yplot,[0 0.5 0],'DisplayName','BPM'); |
90 |
| - %p5=patch(ax,xplot,yplot,[0 0 0],'clipping','off'); |
| 79 | +slb=sl(bpms); |
| 80 | +if isempty(slb) |
| 81 | + p5={}; |
91 | 82 | else
|
92 |
| - p5={}; |
| 83 | + ampl=0.015*tlim; % BPMs |
| 84 | + amplx=0.005*slim; |
| 85 | + [xplot,yplot]=setxpl(slb,ones(1,sum(bpms)),[-amplx;0;amplx;0;-amplx],[0;-ampl;0;ampl;0]); |
| 86 | + p5=patch(xplot,yplot,[0 0.5 0],'DisplayName','BPM'); |
93 | 87 | end
|
94 | 88 |
|
95 | 89 | if any(labs)
|
|
98 | 92 | args={'Label',text(slabs,-0.03*tlim*ones(size(slabs)),vlabs,'Rotation',90,...
|
99 | 93 | 'Interpreter','none','FontUnits','normalized','FontSize',0.025,...
|
100 | 94 | 'HorizontalAlignment','right')};
|
101 |
| -else |
102 |
| - args={}; |
103 |
| -end |
104 |
| -if any(indx) |
| 95 | +elseif any(indx) |
105 | 96 | sindex=sl(indx)+0.5*ll(indx);
|
106 | 97 | iiok=1:length(rok);
|
107 | 98 | vlabs=cellfun(@(el) el,num2cell(iiok(indx)),'UniformOutput',false);
|
|
0 commit comments