source: MML/trunk/mml/plotgoldenorbit.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 plotgoldenorbit(varargin)
2%PLOTGOLDENORBIT - Plots the golden orbit
3%  plotgoldenorbit(XAxisFlag)
4%
5%  INPUTS
6%  1. XAxisFlag - 'Position' in meters {Default} or 'Phase'
7%
8%  See Also plotoffsetorbit, getgolden, setgolden, savegoldenorbit
9
10%
11%  Written by Gregory J. Portmann
12%  Modify by Laurent S. Nadolski
13
14XAxisFlag = 'Position';
15
16% Input parsing
17for i = length(varargin):-1:1
18    if isstruct(varargin{i})
19        % Ignor structures
20    elseif iscell(varargin{i})
21        % Ignor cells
22    elseif strcmpi(varargin{i},'struct')
23        % Just remove
24        varargin(i) = [];
25    elseif strcmpi(varargin{i},'numeric')
26        % Just remove
27        varargin(i) = [];
28    elseif strcmpi(varargin{i},'Position')
29        XAxisFlag = 'Position';
30        varargin(i) = [];
31    elseif strcmpi(varargin{i},'Phase')
32        XAxisFlag = 'Phase';
33        varargin(i) = [];
34    end
35end
36
37
38% Default orbit families
39BPMxFamily = gethbpmfamily;
40BPMyFamily = getvbpmfamily;
41
42
43if strcmpi(XAxisFlag, 'Phase')
44    [BPMxspos, BPMyspos, Sx, Sy, Tune] = modeltwiss('Phase', BPMxFamily, [], BPMyFamily, []);
45    BPMxspos = BPMxspos/2/pi;
46    BPMyspos = BPMyspos/2/pi;
47    XLabel = 'BPM Phase';
48else
49    BPMxspos = getspos(BPMxFamily,family2dev(BPMxFamily));
50    BPMyspos = getspos(BPMyFamily,family2dev(BPMyFamily));
51    XLabel = 'BPM Position [meters]';
52end
53
54
55% Get data
56Xoffset = getgolden(BPMxFamily);
57Yoffset = getgolden(BPMyFamily);
58
59
60% Change to physics units
61if any(strcmpi('Physics',varargin))
62    Xoffset = hw2physics(BPMxFamily, 'Monitor', Xoffset, family2dev(BPMxFamily));
63    Yoffset = hw2physics(BPMyFamily, 'Monitor', Yoffset, family2dev(BPMyFamily));
64end
65
66UnitsString = getfamilydata(BPMxFamily, 'Monitor', 'HWUnits');
67
68clf reset
69subplot(2,1,1);
70plot(BPMxspos, Xoffset, '.-');
71ylabel(sprintf('Horizontal [%s]',UnitsString));
72title('Golden 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.