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

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

Initial import--MML version from SOLEIL@2013

File size: 1.9 KB
Line 
1function plotoffsetorbit(varargin)
2%PLOTOFFSETORBIT - Plots the offset orbit
3%  plotoffsetorbit(XAxisFlag)
4%
5%  INPUTS
6%  1. XAxisFlag - 'Position' in meters {Default} or 'Phase'
7%
8%  See also plotgoldenorbit
9%
10% See also plotgoldenorbit, setoffset, getoffset, saveoffsetorbit
11
12%
13% Written by Gregory J. Portmann
14% Modifed by Laurent S. Nadolski
15
16XAxisFlag = 'Position';
17
18% Input parsing
19for i = length(varargin):-1:1
20    if isstruct(varargin{i})
21        % Ignor structures
22    elseif iscell(varargin{i})
23        % Ignor cells
24    elseif strcmpi(varargin{i},'struct')
25        % Just remove
26        varargin(i) = [];
27    elseif strcmpi(varargin{i},'numeric')
28        % Just remove
29        varargin(i) = [];
30    elseif strcmpi(varargin{i},'Position')
31        XAxisFlag = 'Position';
32        varargin(i) = [];
33    elseif strcmpi(varargin{i},'Phase')
34        XAxisFlag = 'Phase';
35        varargin(i) = [];
36    end
37end
38
39BPMxFamily = gethbpmfamily;
40BPMyFamily = getvbpmfamily;
41
42if strcmpi(XAxisFlag, 'Phase')
43    [BPMxspos, BPMyspos, Sx, Sy, Tune] = modeltwiss('Phase', BPMxFamily, [], BPMyFamily, []);
44    BPMxspos = BPMxspos/2/pi;
45    BPMyspos = BPMyspos/2/pi;
46    XLabel = 'BPM Phase';
47else
48    BPMxspos = getspos(BPMxFamily,family2dev(BPMxFamily));
49    BPMyspos = getspos(BPMyFamily,family2dev(BPMyFamily));
50    XLabel = 'BPM Position [meters]';
51end
52
53
54% Get data
55Xoffset = getoffset(BPMxFamily);
56Yoffset = getoffset(BPMyFamily);
57
58
59% Change to physics units
60if any(strcmpi('Physics',varargin))
61    Xoffset = hw2physics(BPMxFamily, 'Monitor', Xoffset, family2dev(BPMxFamily));
62    Yoffset = hw2physics(BPMyFamily, 'Monitor', Yoffset, family2dev(BPMyFamily));
63end
64
65UnitsString = getfamilydata('BPMx','Monitor','HWUnits');
66
67figure
68clf reset
69subplot(2,1,1);
70plot(BPMxspos, Xoffset, '.-');
71ylabel(sprintf('Horizontal [%s]',UnitsString));
72title('Offset Orbit');
73grid on
74
75subplot(2,1,2);
76plot(BPMyspos, Yoffset, '.-');
77xlabel(XLabel);
78ylabel(sprintf('Vertical [%s]',UnitsString));
79grid on
80
81orient tall
82
Note: See TracBrowser for help on using the repository browser.