source: MML/trunk/machine/SOLEIL/StorageRing/bpm/test_threshold.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 11 years ago

Initial import--MML version from SOLEIL@2013

File size: 1.2 KB
Line 
1%%
2
3Threshold = 1.5e7;
4
5[ir ic] = find(AM.Data.Sum > Threshold);
6
7irfirst = [];
8icfirst = [];
9for k=1:120,
10  val = min(find(ir==k));
11  if isempty(val)
12      fprintf('BPM number %d with no data\n', k);
13  else
14      irfirst(k) = ir(val) ;
15      icfirst(k) = ic(val) ;
16  end
17end
18
19figure
20plot(ir,ic,'.'); hold on;
21plot(irfirst,icfirst,'xr'); hold off
22grid on
23xlabel('BPM number')
24ylabel('Turn number above Threshold');
25title(sprintf('Threshold is %e',Threshold));
26
27%%
28figure
29h1 = subplot(7,1,[1 3]);
30plot(spos, AM.Data.X(sub2ind(size(AM.Data.X),irfirst,icfirst)),'Color',nxtcolor)
31hold on
32
33nturn = 10;
34for k=2:nturn,
35    plot(spos, AM.Data.X(sub2ind(size(AM.Data.X),irfirst,icfirst+k)),'Color',nxtcolor)
36end
37ylabel('X (mm)')
38
39h2 = subplot(7,1,[5 7]);
40plot(spos, AM.Data.Z(sub2ind(size(AM.Data.Z),irfirst,icfirst)),'Color',nxtcolor)
41hold on
42
43for k=2:nturn,
44    plot(spos, AM.Data.Z(sub2ind(size(AM.Data.Z),irfirst,icfirst+k)),'Color',nxtcolor)
45end
46
47str = eval(['{', sprintf('''Turn # %d'',',(1:nturn)), '}']);
48
49legend(str,'Position',[0.915 0.4514 0.08195 0.1244])
50xlabel('s (m)')
51ylabel('Z (mm)')
52
53h3 = subplot(7,1,4);
54drawlattice;
55
56linkaxes([h1,h2,h3],'x');
57set([h1,h2,h3],'Xgrid','On', 'Ygrid','On');
58addlabel(1,0,datestr(AM.TimeStamp,21));
Note: See TracBrowser for help on using the repository browser.