source: MML/trunk/machine/SOLEIL/StorageRing/couplage/BeamSizeTunette.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: 10.0 KB
Line 
1function varargout = BeamSizeTunette(varargin)
2% BEAMSIZETUNETTE M-file for BeamSizeTunette.fig
3%      BEAMSIZETUNETTE, by itself, creates a new BEAMSIZETUNETTE or raises the existing
4%      singleton*.
5%
6%      H = BEAMSIZETUNETTE returns the handle to a new BEAMSIZETUNETTE or the handle to
7%      the existing singleton*.
8%
9%      BEAMSIZETUNETTE('CALLBACK',hObject,eventData,handles,...) calls the local
10%      function named CALLBACK in BEAMSIZETUNETTE.M with the given input arguments.
11%
12%      BEAMSIZETUNETTE('Property','Value',...) creates a new BEAMSIZETUNETTE or raises the
13%      existing singleton*.  Starting from the left, property value pairs are
14%      applied to the GUI before BeamSizeTunette_OpeningFcn gets called.  An
15%      unrecognized property name or invalid value makes property application
16%      stop.  All inputs are passed to BeamSizeTunette_OpeningFcn via varargin.
17%
18%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
19%      instance to run (singleton)".
20%
21% See also: GUIDE, GUIDATA, GUIHANDLES
22
23% Edit the above text to modify the response to help BeamSizeTunette
24
25% Last Modified by GUIDE v2.5 02-Jun-2012 09:04:15
26
27% Begin initialization code - DO NOT EDIT
28gui_Singleton = 1;
29gui_State = struct('gui_Name',       mfilename, ...
30                   'gui_Singleton',  gui_Singleton, ...
31                   'gui_OpeningFcn', @BeamSizeTunette_OpeningFcn, ...
32                   'gui_OutputFcn',  @BeamSizeTunette_OutputFcn, ...
33                   'gui_LayoutFcn',  [] , ...
34                   'gui_Callback',   []);
35if nargin && ischar(varargin{1})
36    gui_State.gui_Callback = str2func(varargin{1});
37end
38
39if nargout
40    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
41else
42    gui_mainfcn(gui_State, varargin{:});
43end
44% End initialization code - DO NOT EDIT
45
46
47% --- Executes just before BeamSizeTunette is made visible.
48function BeamSizeTunette_OpeningFcn(hObject, eventdata, handles, varargin)
49% This function has no output args, see OutputFcn.
50% hObject    handle to figure
51% eventdata  reserved - to be defined in a future version of MATLAB
52% handles    structure with handles and user data (see GUIDATA)
53% varargin   command line arguments to BeamSizeTunette (see VARARGIN)
54
55% Choose default command line output for BeamSizeTunette
56handles.output = hObject;
57
58%%%%%%%%%%%%%%%%%%%%%%%%%
59
60k0 = uibuttongroup('visible','on','Position',[0.05 0.05 .90 .50],...
61    'Title','','TitlePosition','lefttop','FontSize',14,...
62    'BackgroundColor',[.651 0.855 0.924]);
63
64v1 = uicontrol('Style','Radio','String','  Non expert','Tag','radiobutton1',...
65    'pos',[70 160 200 20],'parent',k0,'HandleVisibility','off','FontSize',14,...
66    'BackgroundColor',[.651 0.855 0.924]);
67v2 = uicontrol('Style','Radio','String','  Expert','Tag','radiobutton2','FontSize',14,...
68    'pos',[250. 160 150 20],'parent',k0,'HandleVisibility','off',...
69    'BackgroundColor',[.651 0.855 0.924]);
70set(k0,'SelectedObject',v1);  % Non expert par défaut
71set(handles.pourcentage,'Enable','Off')
72set(handles.dispersion_verticale,'Enable','Off')
73set(handles.fichier,'Enable','Off')
74set(k0,'Visible','on');
75set(k0,'SelectionChangeFcn',...
76    {@uibuttongroup_SelectionChangeFcn_expert,handles});
77pourcentage = 5;
78FileName = '/home/matlabML/measdata/SOLEIL/StorageRingdata/SkewQuad/solution_QT/Nanoscopium/QT_Dipersion_verticale_pure_Nanoscopium';
79setappdata(handles.figure1,'pourcentage','pourcentage');
80setappdata(handles.figure1,'fichier','FileName');
81ModeFlag = 'Online'; % DANGER !!
82setappdata(handles.figure1,'ModeFlag',ModeFlag);
83
84% Update handles structure
85guidata(hObject, handles);
86
87% UIWAIT makes BeamSizeTunette wait for user response (see UIRESUME)
88% uiwait(handles.figure1);
89
90
91% --- Outputs from this function are returned to the command line.
92function varargout = BeamSizeTunette_OutputFcn(hObject, eventdata, handles)
93% varargout  cell array for returning output args (see VARARGOUT);
94% hObject    handle to figure
95% eventdata  reserved - to be defined in a future version of MATLAB
96% handles    structure with handles and user data (see GUIDATA)
97
98% Get default command line output from handles structure
99varargout{1} = handles.output;
100
101
102% --- Executes on button press in Augmenter.
103function Augmenter_Callback(hObject, eventdata, handles)
104% hObject    handle to Augmenter (see GCBO)
105% eventdata  reserved - to be defined in a future version of MATLAB
106% handles    structure with handles and user data (see GUIDATA)
107
108pourcentage = str2double(get(handles.pourcentage,'String'));
109FileName = get(handles.fichier,'String');  % fichier de dispersion verticale
110ModeFlag = getappdata(handles.figure1,'ModeFlag');
111S = load(FileName);
112stepsp('QT',pourcentage*1e-2*S.Deltaskewquad,ModeFlag); % SUPERPOSITION du jeu de QT
113
114
115
116% --- Executes on button press in Diminuer.
117function Diminuer_Callback(hObject, eventdata, handles)
118% hObject    handle to Diminuer (see GCBO)
119% eventdata  reserved - to be defined in a future version of MATLAB
120% handles    structure with handles and user data (see GUIDATA)
121
122pourcentage = str2double(get(handles.pourcentage,'String'));
123FileName = get(handles.fichier,'String');  % fichier de dispersion verticale
124ModeFlag = getappdata(handles.figure1,'ModeFlag');
125S = load(FileName);
126stepsp('QT',-pourcentage*1e-2*S.Deltaskewquad,ModeFlag); % SUPERPOSITION du jeu de QT
127
128
129function Titre_Callback(hObject, eventdata, handles)
130% hObject    handle to Titre (see GCBO)
131% eventdata  reserved - to be defined in a future version of MATLAB
132% handles    structure with handles and user data (see GUIDATA)
133
134% Hints: get(hObject,'String') returns contents of Titre as text
135%        str2double(get(hObject,'String')) returns contents of Titre as a double
136
137
138% --- Executes during object creation, after setting all properties.
139function Titre_CreateFcn(hObject, eventdata, handles)
140% hObject    handle to Titre (see GCBO)
141% eventdata  reserved - to be defined in a future version of MATLAB
142% handles    empty - handles not created until after all CreateFcns called
143
144% Hint: edit controls usually have a white background on Windows.
145%       See ISPC and COMPUTER.
146if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
147    set(hObject,'BackgroundColor','white');
148end
149
150
151
152function pourcentage_Callback(hObject, eventdata, handles)
153% hObject    handle to pourcentage (see GCBO)
154% eventdata  reserved - to be defined in a future version of MATLAB
155% handles    structure with handles and user data (see GUIDATA)
156
157% Hints: get(hObject,'String') returns contents of pourcentage as text
158%        str2double(get(hObject,'String')) returns contents of pourcentage as a double
159pourcentage = str2double(get(hObject,'String'));
160setappdata(handles.figure1,'pourcentage','pourcentage');
161
162
163% --- Executes during object creation, after setting all properties.
164function pourcentage_CreateFcn(hObject, eventdata, handles)
165% hObject    handle to pourcentage (see GCBO)
166% eventdata  reserved - to be defined in a future version of MATLAB
167% handles    empty - handles not created until after all CreateFcns called
168
169% Hint: edit controls usually have a white background on Windows.
170%       See ISPC and COMPUTER.
171if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
172    set(hObject,'BackgroundColor','white');
173end
174
175% --- Executes on button press in dispersion_verticale.
176function dispersion_verticale_Callback(hObject, eventdata, handles)
177% hObject    handle to dispersion_verticale (see GCBO)
178% eventdata  reserved - to be defined in a future version of MATLAB
179% handles    structure with handles and user data (see GUIDATA)
180
181DirectoryName = getfamilydata('Directory', 'Coupling');
182if isempty(DirectoryName)
183    %             DirectoryName = [getfamilydata('Directory','DataRoot'), 'Response', filesep, 'BPM', filesep];
184else
185    % Make sure default directory exists
186    DirStart = pwd;
187    [DirectoryName, ErrorFlag] = gotodirectory(DirectoryName);
188    cd(DirStart);
189end
190%[FileName, DirectoryName] = uigetfile('*.mat', 'Select a Skew corrector list ("Save" starts measurement)', [DirectoryName FileName]);
191
192[FileName, DirectoryName] = uigetfile('*.mat', 'Select a new Dispersion Wave ("Save" starts measurement)',DirectoryName);
193if FileName == 0
194    ArchiveFlag = 0;
195    disp('   Skew correction canceled.');
196    return
197end
198FileName = [DirectoryName, FileName];
199set(handles.fichier,'String',FileName)
200
201
202
203function uibuttongroup_SelectionChangeFcn_expert(hObject,eventdata,handles)
204% hObject    handle to uipanel1 (see GCBO)
205% eventdata  reserved - to be defined in a future version of MATLAB
206% handles    structure with handles and user data (see GUIDATA)
207
208switch get(get(hObject,'SelectedObject'),'Tag')  % Get Tag of selected object
209
210    case 'radiobutton2'
211        % code piece when radiobutton2 is selected goes here
212        %setappdata(handles.figure1,'Correction','fichier'); %
213        set(handles.pourcentage,'Enable','On')
214        set(handles.dispersion_verticale,'Enable','On')
215        set(handles.fichier,'Enable','Off')
216
217    case 'radiobutton1'
218        % code piece when radiobutton1 is selected goes here
219        set(handles.pourcentage,'Enable','Off')
220        set(handles.dispersion_verticale,'Enable','Off')
221        set(handles.fichier,'Enable','Off')
222       
223end
224
225
226
227function fichier_Callback(hObject, eventdata, handles)
228% hObject    handle to fichier (see GCBO)
229% eventdata  reserved - to be defined in a future version of MATLAB
230% handles    structure with handles and user data (see GUIDATA)
231
232% Hints: get(hObject,'String') returns contents of fichier as text
233%        str2double(get(hObject,'String')) returns contents of fichier as a double
234
235
236% --- Executes during object creation, after setting all properties.
237function fichier_CreateFcn(hObject, eventdata, handles)
238% hObject    handle to fichier (see GCBO)
239% eventdata  reserved - to be defined in a future version of MATLAB
240% handles    empty - handles not created until after all CreateFcns called
241
242% Hint: edit controls usually have a white background on Windows.
243%       See ISPC and COMPUTER.
244if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
245    set(hObject,'BackgroundColor','white');
246end
Note: See TracBrowser for help on using the repository browser.