1 | function varargout = optics_TL(varargin) |
---|
2 | %OPTICS_LT1_LT2 - M-file for optics_LT1_LT2.fig |
---|
3 | % OPTICS_LT1_LT2, by itself, creates a new OPTICS_LT1_LT2 or raises the existing |
---|
4 | % singleton*. |
---|
5 | % |
---|
6 | % H = OPTICS_LT1_LT2 returns the handle to a new OPTICS_LT1_LT2 or the handle to |
---|
7 | % the existing singleton*. |
---|
8 | % |
---|
9 | % OPTICS_LT1_LT2('CALLBACK',hObject,eventData,handles,...) calls the local |
---|
10 | % function named CALLBACK in OPTICS_LT1_LT2.M with the given input arguments. |
---|
11 | % |
---|
12 | % OPTICS_LT1_LT2('Property','Value',...) creates a new OPTICS_LT1_LT2 or raises the |
---|
13 | % existing singleton*. Starting from the left, property value pairs are |
---|
14 | % applied to the GUI before optics_LT1_LT2_OpeningFunction gets called. An |
---|
15 | % unrecognized property name or invalid value makes property application |
---|
16 | % stop. All inputs are passed to optics_LT1_LT2_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 optics_LT1_LT2 |
---|
24 | |
---|
25 | % Last Modified by GUIDE v2.5 25-Oct-2013 14:42:37 |
---|
26 | |
---|
27 | % Begin initialization code - DO NOT EDIT |
---|
28 | gui_Singleton = 1; |
---|
29 | gui_State = struct('gui_Name', mfilename, ... |
---|
30 | 'gui_Singleton', gui_Singleton, ... |
---|
31 | 'gui_OpeningFcn', @optics_TL_OpeningFcn, ... |
---|
32 | 'gui_OutputFcn', @optics_TL_OutputFcn, ... |
---|
33 | 'gui_LayoutFcn', [] , ... |
---|
34 | 'gui_Callback', []); |
---|
35 | if nargin && ischar(varargin{1}) |
---|
36 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
37 | end |
---|
38 | |
---|
39 | if nargout |
---|
40 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
41 | else |
---|
42 | gui_mainfcn(gui_State, varargin{:}); |
---|
43 | end |
---|
44 | % End initialization code - DO NOT EDIT |
---|
45 | |
---|
46 | % --- Executes just before optics_LT1_LT2 is made visible. |
---|
47 | function optics_TL_OpeningFcn(hObject, eventdata, handles, varargin) |
---|
48 | % This function has no output args, see OutputFcn. |
---|
49 | % hObject handle to figure |
---|
50 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
51 | % handles structure with handles and user data (see GUIDATA) |
---|
52 | % varargin command line arguments to optics_LT1_LT2 (see VARARGIN) |
---|
53 | |
---|
54 | % Choose default command line output for optics_LT1_LT2 |
---|
55 | handles.output = hObject; |
---|
56 | |
---|
57 | %mat: utilite ??? |
---|
58 | setappdata(handles.figure1, 'twissdatain',struct([])); |
---|
59 | |
---|
60 | % construct initial twiss parameters |
---|
61 | |
---|
62 | Machine = getfamilydata('SubMachine'); |
---|
63 | |
---|
64 | switch Machine |
---|
65 | case {'TL'} |
---|
66 | |
---|
67 | twissdatain.ElemIndex = 1; |
---|
68 | twissdatain.SPos = 0; |
---|
69 | twissdatain.ClosedOrbit= [1e-3 0 2e-3 0]'*0; |
---|
70 | twissdatain.M44 = eye(4); |
---|
71 | % theorique |
---|
72 | twissdatain.beta = [34.46 33.94]; |
---|
73 | twissdatain.alpha = [-4.24 -4.34]; |
---|
74 | % mesure 2006-02-06 |
---|
75 | %twissdatain.beta = [9.5 13.5]; |
---|
76 | %twissdatain.alpha = [-1.16 -2.43]; |
---|
77 | twissdatain.mu = [0 0]; |
---|
78 | twissdatain.Dispersion = [0 0 0 0]'; |
---|
79 | set(handles.figure1,'Name', 'TL Optical functions'); |
---|
80 | |
---|
81 | case {'EL'} |
---|
82 | |
---|
83 | twissdatain.ElemIndex = 1; |
---|
84 | twissdatain.SPos = 0; |
---|
85 | twissdatain.ClosedOrbit= [1e-3 0 2e-3 0]'*0; |
---|
86 | twissdatain.M44 = eye(4); |
---|
87 | twissdatain.beta = [6.0 6.0]; |
---|
88 | twissdatain.alpha = [-1.8 1.5]; |
---|
89 | twissdatain.mu = [0 0]; |
---|
90 | twissdatain.Dispersion = [0 0 0 0]'; |
---|
91 | set(handles.figure1,'Name', 'EL Optical functions'); |
---|
92 | |
---|
93 | otherwise |
---|
94 | error('No Machine loaded') |
---|
95 | end |
---|
96 | |
---|
97 | setappdata(handles.figure1, 'twissdatain0',twissdatain); |
---|
98 | handles.restart = 1; |
---|
99 | |
---|
100 | %% Initialize structure for handling TL and EL magnets |
---|
101 | handles = init_handles(handles); |
---|
102 | |
---|
103 | % Update handles structure |
---|
104 | guidata(hObject, handles); |
---|
105 | |
---|
106 | AO = getao; |
---|
107 | % setappdata(handles.figure1,'AOmagnet', AO); |
---|
108 | |
---|
109 | %set(handles.(name),'Max',9, 'Min', -9) |
---|
110 | |
---|
111 | % min et max des sliders (figé à l'ouverture puis modifiable par SETBAR) |
---|
112 | % the values are set in TLinit.m |
---|
113 | for i=1:7 |
---|
114 | val_max(i) = getmaxsp(['QP',num2str(i),'L']); |
---|
115 | val_min(i) = getminsp(['QP',num2str(i),'L']); |
---|
116 | end |
---|
117 | |
---|
118 | %% Number of sliders |
---|
119 | handles.sliderNumber = 7; |
---|
120 | |
---|
121 | for k = 1:handles.sliderNumber, |
---|
122 | name = strcat('sliderQP',num2str(k),'L'); |
---|
123 | %set(handles.(name),'Max',val_max(k),'Min',val_min(k)); |
---|
124 | set(handles.(name),'Max',max(val_max),'Min',min(val_min)); % set the change range of magnets |
---|
125 | end |
---|
126 | |
---|
127 | |
---|
128 | %% liste de aimants a controler (menu deroulant) |
---|
129 | list = [... |
---|
130 | AO.QP1L.CommonNames;... |
---|
131 | AO.QP2L.CommonNames;... |
---|
132 | AO.QP3L.CommonNames;... |
---|
133 | AO.QP4L.CommonNames;... |
---|
134 | AO.QP5L.CommonNames;... |
---|
135 | AO.QP6L.CommonNames;... |
---|
136 | AO.QP7L.CommonNames;... |
---|
137 | AO.BEND1.CommonNames;... |
---|
138 | AO.BEND2.CommonNames;... |
---|
139 | AO.HCOR.CommonNames; ... |
---|
140 | AO.VCOR.CommonNames |
---|
141 | ]; |
---|
142 | |
---|
143 | |
---|
144 | %% Automatic configuration for sliders |
---|
145 | for k = 1:handles.sliderNumber |
---|
146 | name = ['popupmenu_bar' num2str(k)]; |
---|
147 | set(handles.(name),'String',list); |
---|
148 | set(handles.(name),'Value',k); |
---|
149 | end |
---|
150 | |
---|
151 | %% graphe par defaut |
---|
152 | axes(handles.axes1); |
---|
153 | handles.xtype = 'spos'; |
---|
154 | handles.ytype = 'beta'; |
---|
155 | |
---|
156 | %% initialisation AT et IHM |
---|
157 | handles = restart(handles); |
---|
158 | |
---|
159 | %% Read Tango values |
---|
160 | %read_tango(handles); |
---|
161 | |
---|
162 | % UIWAIT makes optics_LT1_LT2 wait for user response (see UIRESUME) |
---|
163 | % uiwait(handles.figure1); |
---|
164 | set(0,'DefaultAxesXgrid','on','DefaultAxesYgrid','on'); |
---|
165 | |
---|
166 | %% graphe symboles |
---|
167 | axes(handles.axes2); |
---|
168 | drawlattice(0,0.8); |
---|
169 | set(handles.axes2,'Xlim',[handles.spos(1) handles.spos(end)], ... |
---|
170 | 'XTick',[],'YTick',[]); |
---|
171 | |
---|
172 | |
---|
173 | % Update handles structure |
---|
174 | guidata(hObject, handles); |
---|
175 | |
---|
176 | %% ------------------------------------- |
---|
177 | function handles = computeTwiss(handles) |
---|
178 | % update ATmodel |
---|
179 | % compute new twiss parameters |
---|
180 | % |
---|
181 | global THERING; |
---|
182 | |
---|
183 | %%% parameters at the entrance of the line |
---|
184 | % twissdatain.ElemIndex=1; |
---|
185 | % twissdatain.SPos=0; |
---|
186 | % twissdatain.ClosedOrbit=[1e-3 0 2e-3 0]'*0; |
---|
187 | % twissdatain.M44=eye(4); |
---|
188 | % |
---|
189 | % if isequal(isfield(twissdatain,'beta'),0) |
---|
190 | |
---|
191 | if handles.restart == 1 |
---|
192 | twissdatain = getappdata(handles.figure1,'twissdatain0'); |
---|
193 | handles.restart = 0; |
---|
194 | else |
---|
195 | twissdatain = getappdata(handles.figure1,'twissdatain'); |
---|
196 | end |
---|
197 | % twissdatain.beta= [8.1 8.1]; |
---|
198 | % twissdatain.alpha= [0 0]; |
---|
199 | % else |
---|
200 | % twissdatain = getappdata(handles.figure1,'twissdatain') |
---|
201 | % end |
---|
202 | |
---|
203 | % twissdatain.mu= [0 0]; |
---|
204 | % twissdatain.Dispersion= [0 0 0 0]'; |
---|
205 | |
---|
206 | %%% get twiss paramaters |
---|
207 | TD = twissline(THERING,0.0,twissdatain,1:length(THERING),'chroma'); |
---|
208 | |
---|
209 | handles.twissdatain = twissdatain; |
---|
210 | handles.beta = cat(1,TD.beta); |
---|
211 | handles.cod = cat(2,TD.ClosedOrbit)'; |
---|
212 | handles.eta = cat(2,TD.Dispersion)'; |
---|
213 | handles.spos = cat(1,TD.SPos); |
---|
214 | handles.phase = cat(1,TD.mu); |
---|
215 | |
---|
216 | setappdata(handles.figure1,'twissdatain',twissdatain); |
---|
217 | |
---|
218 | % --- Outputs from this function are returned to the command line. |
---|
219 | function varargout = optics_TL_OutputFcn(hObject, eventdata, handles) |
---|
220 | % varargout cell array for returning output args (see VARARGOUT); |
---|
221 | % hObject handle to figure |
---|
222 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
223 | % handles structure with handles and user data (see GUIDATA) |
---|
224 | |
---|
225 | % Get default command line output from handles structure |
---|
226 | varargout{1} = handles.output; |
---|
227 | |
---|
228 | % --- Executes during object creation, after setting all properties. |
---|
229 | function sliderQP1L_CreateFcn(hObject, eventdata, handles) |
---|
230 | % hObject handle to sliderQP1L (see GCBO) |
---|
231 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
232 | % handles empty - handles not created until after all CreateFcns called |
---|
233 | |
---|
234 | % Hint: slider controls usually have a light gray background, change |
---|
235 | % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. |
---|
236 | usewhitebg = 1; |
---|
237 | if usewhitebg |
---|
238 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
239 | else |
---|
240 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
241 | end |
---|
242 | |
---|
243 | % --- Executes on slider movement. |
---|
244 | function sliderQP1L_Callback(hObject, eventdata, handles) |
---|
245 | % hObject handle to sliderQP1L (see GCBO) |
---|
246 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
247 | % handles structure with handles and user data (see GUIDATA) |
---|
248 | |
---|
249 | % Hints: get(hObject,'Value') returns position of slider |
---|
250 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
251 | |
---|
252 | handles = setslider(hObject,handles); |
---|
253 | guidata(hObject, handles); |
---|
254 | |
---|
255 | % --- Executes during object creation, after setting all properties. |
---|
256 | function editQP1L_CreateFcn(hObject, eventdata, handles) |
---|
257 | % hObject handle to editQP1L (see GCBO) |
---|
258 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
259 | % handles empty - handles not created until after all CreateFcns called |
---|
260 | |
---|
261 | % Hint: edit controls usually have a white background on Windows. |
---|
262 | % See ISPC and COMPUTER. |
---|
263 | if ispc |
---|
264 | set(hObject,'BackgroundColor','green'); |
---|
265 | else |
---|
266 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
267 | end |
---|
268 | |
---|
269 | % --- Executes on slider movement. |
---|
270 | function editQP1L_Callback(hObject, eventdata, handles) |
---|
271 | % hObject handle to editQP1L (see GCBO) |
---|
272 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
273 | % handles structure with handles and user data (see GUIDATA) |
---|
274 | |
---|
275 | % Hints: get(hObject,'String') returns contents of editQP1L as text |
---|
276 | % str2double(get(hObject,'String')) returns contents of editQP1L as a double |
---|
277 | handles = setedit(handles); |
---|
278 | guidata(hObject, handles); |
---|
279 | |
---|
280 | % --- Executes during object creation, after setting all properties. |
---|
281 | function sliderQP2L_CreateFcn(hObject, eventdata, handles) |
---|
282 | % hObject handle to sliderQP2L (see GCBO) |
---|
283 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
284 | % handles empty - handles not created until after all CreateFcns called |
---|
285 | |
---|
286 | % Hint: slider controls usually have a light gray background, change |
---|
287 | % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. |
---|
288 | usewhitebg = 1; |
---|
289 | if usewhitebg |
---|
290 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
291 | else |
---|
292 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
293 | end |
---|
294 | |
---|
295 | % --- Executes on slider movement. |
---|
296 | function sliderQP2L_Callback(hObject, eventdata, handles) |
---|
297 | % hObject handle to sliderQP2L (see GCBO) |
---|
298 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
299 | % handles structure with handles and user data (see GUIDATA) |
---|
300 | |
---|
301 | % Hints: get(hObject,'Value') returns position of slider |
---|
302 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
303 | handles = setslider(hObject,handles); |
---|
304 | guidata(hObject, handles); |
---|
305 | |
---|
306 | % --- Executes during object creation, after setting all properties. |
---|
307 | function editQP2L_CreateFcn(hObject, eventdata, handles) |
---|
308 | % hObject handle to editQP2L (see GCBO) |
---|
309 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
310 | % handles empty - handles not created until after all CreateFcns called |
---|
311 | |
---|
312 | % Hint: edit controls usually have a white background on Windows. |
---|
313 | % See ISPC and COMPUTER. |
---|
314 | if ispc |
---|
315 | set(hObject,'BackgroundColor','white'); |
---|
316 | else |
---|
317 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
318 | end |
---|
319 | |
---|
320 | function editQP2L_Callback(hObject, eventdata, handles) |
---|
321 | % hObject handle to editQP2L (see GCBO) |
---|
322 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
323 | % handles structure with handles and user data (see GUIDATA) |
---|
324 | |
---|
325 | % Hints: get(hObject,'String') returns contents of editQP2L as text |
---|
326 | % str2double(get(hObject,'String')) returns contents of editQP2L as a double |
---|
327 | handles = setedit(handles); |
---|
328 | guidata(hObject, handles); |
---|
329 | |
---|
330 | % --- Executes during object creation, after setting all properties. |
---|
331 | function sliderQP3L_CreateFcn(hObject, eventdata, handles) |
---|
332 | % hObject handle to sliderQP3L (see GCBO) |
---|
333 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
334 | % handles empty - handles not created until after all CreateFcns called |
---|
335 | |
---|
336 | % Hint: slider controls usually have a light gray background, change |
---|
337 | % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. |
---|
338 | usewhitebg = 1; |
---|
339 | if usewhitebg |
---|
340 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
341 | else |
---|
342 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
343 | end |
---|
344 | |
---|
345 | % --- Executes on slider movement. |
---|
346 | function sliderQP3L_Callback(hObject, eventdata, handles) |
---|
347 | % hObject handle to sliderQP3L (see GCBO) |
---|
348 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
349 | % handles structure with handles and user data (see GUIDATA) |
---|
350 | |
---|
351 | % Hints: get(hObject,'Value') returns position of slider |
---|
352 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
353 | handles = setslider(hObject,handles); |
---|
354 | guidata(hObject, handles); |
---|
355 | |
---|
356 | |
---|
357 | % --- Executes during object creation, after setting all properties. |
---|
358 | function editQP3L_CreateFcn(hObject, eventdata, handles) |
---|
359 | % hObject handle to editQP3L (see GCBO) |
---|
360 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
361 | % handles empty - handles not created until after all CreateFcns called |
---|
362 | |
---|
363 | % Hint: edit controls usually have a white background on Windows. |
---|
364 | % See ISPC and COMPUTER. |
---|
365 | if ispc |
---|
366 | set(hObject,'BackgroundColor','white'); |
---|
367 | else |
---|
368 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
369 | end |
---|
370 | |
---|
371 | function editQP3L_Callback(hObject, eventdata, handles) |
---|
372 | % hObject handle to editQP3L (see GCBO) |
---|
373 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
374 | % handles structure with handles and user data (see GUIDATA) |
---|
375 | |
---|
376 | % Hints: get(hObject,'String') returns contents of editQP3L as text |
---|
377 | % str2double(get(hObject,'String')) returns contents of editQP3L as a double |
---|
378 | handles = setedit(handles); |
---|
379 | guidata(hObject, handles); |
---|
380 | |
---|
381 | % --- Executes during object creation, after setting all properties. |
---|
382 | function editQP4L_CreateFcn(hObject, eventdata, handles) |
---|
383 | % hObject handle to editQP4L (see GCBO) |
---|
384 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
385 | % handles empty - handles not created until after all CreateFcns called |
---|
386 | |
---|
387 | % Hint: edit controls usually have a white background on Windows. |
---|
388 | % See ISPC and COMPUTER. |
---|
389 | if ispc |
---|
390 | set(hObject,'BackgroundColor','white'); |
---|
391 | else |
---|
392 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
393 | end |
---|
394 | |
---|
395 | function editQP4L_Callback(hObject, eventdata, handles) |
---|
396 | % hObject handle to editQP4L (see GCBO) |
---|
397 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
398 | % handles structure with handles and user data (see GUIDATA) |
---|
399 | |
---|
400 | % Hints: get(hObject,'String') returns contents of editQP4L as text |
---|
401 | % str2double(get(hObject,'String')) returns contents of editQP4L as a double |
---|
402 | handles = setedit(handles); |
---|
403 | |
---|
404 | |
---|
405 | % --- Executes during object creation, after setting all properties. |
---|
406 | function sliderQP4L_CreateFcn(hObject, eventdata, handles) |
---|
407 | % hObject handle to sliderQP4L (see GCBO) |
---|
408 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
409 | % handles empty - handles not created until after all CreateFcns called |
---|
410 | |
---|
411 | % Hint: slider controls usually have a light gray background, change |
---|
412 | % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. |
---|
413 | usewhitebg = 1; |
---|
414 | if usewhitebg |
---|
415 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
416 | else |
---|
417 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
418 | end |
---|
419 | |
---|
420 | |
---|
421 | % --- Executes on slider movement. |
---|
422 | function sliderQP4L_Callback(hObject, eventdata, handles) |
---|
423 | % hObject handle to sliderQP4L (see GCBO) |
---|
424 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
425 | % handles structure with handles and user data (see GUIDATA) |
---|
426 | |
---|
427 | % Hints: get(hObject,'Value') returns position of slider |
---|
428 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
429 | handles = setslider(hObject,handles); |
---|
430 | guidata(hObject, handles); |
---|
431 | |
---|
432 | % --- Executes during object creation, after setting all properties. |
---|
433 | function editQP5L_CreateFcn(hObject, eventdata, handles) |
---|
434 | % hObject handle to editQP5L (see GCBO) |
---|
435 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
436 | % handles empty - handles not created until after all CreateFcns called |
---|
437 | |
---|
438 | % Hint: edit controls usually have a white background on Windows. |
---|
439 | % See ISPC and COMPUTER. |
---|
440 | if ispc |
---|
441 | set(hObject,'BackgroundColor','white'); |
---|
442 | else |
---|
443 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
444 | end |
---|
445 | |
---|
446 | |
---|
447 | function editQP5L_Callback(hObject, eventdata, handles) |
---|
448 | % hObject handle to editQP5L (see GCBO) |
---|
449 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
450 | % handles structure with handles and user data (see GUIDATA) |
---|
451 | |
---|
452 | % Hints: get(hObject,'String') returns contents of editQP5L as text |
---|
453 | % str2double(get(hObject,'String')) returns contents of editQP5L as a double |
---|
454 | handles = setedit(handles); |
---|
455 | guidata(hObject, handles); |
---|
456 | |
---|
457 | % --- Executes during object creation, after setting all properties. |
---|
458 | function sliderQP5L_CreateFcn(hObject, eventdata, handles) |
---|
459 | % hObject handle to sliderQP5L (see GCBO) |
---|
460 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
461 | % handles empty - handles not created until after all CreateFcns called |
---|
462 | |
---|
463 | % Hint: slider controls usually have a light gray background, change |
---|
464 | % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. |
---|
465 | usewhitebg = 1; |
---|
466 | if usewhitebg |
---|
467 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
468 | else |
---|
469 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
470 | end |
---|
471 | |
---|
472 | % --- Executes on slider movement. |
---|
473 | function sliderQP5L_Callback(hObject, eventdata, handles) |
---|
474 | % hObject handle to sliderQP5L (see GCBO) |
---|
475 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
476 | % handles structure with handles and user data (see GUIDATA) |
---|
477 | |
---|
478 | % Hints: get(hObject,'Value') returns position of slider |
---|
479 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
480 | handles = setslider(hObject,handles); |
---|
481 | guidata(hObject, handles); |
---|
482 | |
---|
483 | % --- Executes during object creation, after setting all properties. |
---|
484 | function sliderQP6L_CreateFcn(hObject, eventdata, handles) |
---|
485 | % hObject handle to sliderQP6L (see GCBO) |
---|
486 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
487 | % handles empty - handles not created until after all CreateFcns called |
---|
488 | |
---|
489 | % Hint: slider controls usually have a light gray background, change |
---|
490 | % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. |
---|
491 | usewhitebg = 1; |
---|
492 | if usewhitebg |
---|
493 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
494 | else |
---|
495 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
496 | end |
---|
497 | |
---|
498 | % --- Executes on slider movement. |
---|
499 | function sliderQP6L_Callback(hObject, eventdata, handles) |
---|
500 | % hObject handle to sliderQP6L (see GCBO) |
---|
501 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
502 | % handles structure with handles and user data (see GUIDATA) |
---|
503 | |
---|
504 | % Hints: get(hObject,'Value') returns position of slider |
---|
505 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
506 | handles = setslider(hObject,handles); |
---|
507 | guidata(hObject, handles); |
---|
508 | |
---|
509 | % --- Executes during object creation, after setting all properties. |
---|
510 | function editQP6L_CreateFcn(hObject, eventdata, handles) |
---|
511 | % hObject handle to editQP6L (see GCBO) |
---|
512 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
513 | % handles empty - handles not created until after all CreateFcns called |
---|
514 | |
---|
515 | % Hint: edit controls usually have a white background on Windows. |
---|
516 | % See ISPC and COMPUTER. |
---|
517 | if ispc |
---|
518 | set(hObject,'BackgroundColor','white'); |
---|
519 | else |
---|
520 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
521 | end |
---|
522 | |
---|
523 | function editQP6L_Callback(hObject, eventdata, handles) |
---|
524 | % hObject handle to editQP6L (see GCBO) |
---|
525 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
526 | % handles structure with handles and user data (see GUIDATA) |
---|
527 | |
---|
528 | % Hints: get(hObject,'String') returns contents of editQP6L as text |
---|
529 | % str2double(get(hObject,'String')) returns contents of editQP6L as a double |
---|
530 | handles = setedit(handles); |
---|
531 | guidata(hObject, handles); |
---|
532 | |
---|
533 | % --- Executes during object creation, after setting all properties. |
---|
534 | function editQP7L_CreateFcn(hObject, eventdata, handles) |
---|
535 | % hObject handle to editQP7L (see GCBO) |
---|
536 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
537 | % handles empty - handles not created until after all CreateFcns called |
---|
538 | |
---|
539 | % Hint: edit controls usually have a white background on Windows. |
---|
540 | % See ISPC and COMPUTER. |
---|
541 | if ispc |
---|
542 | set(hObject,'BackgroundColor','white'); |
---|
543 | else |
---|
544 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
545 | end |
---|
546 | |
---|
547 | function editQP7L_Callback(hObject, eventdata, handles) |
---|
548 | % hObject handle to editQP7L (see GCBO) |
---|
549 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
550 | % handles structure with handles and user data (see GUIDATA) |
---|
551 | |
---|
552 | % Hints: get(hObject,'String') returns contents of editQP7L as text |
---|
553 | % str2double(get(hObject,'String')) returns contents of editQP7L as a double |
---|
554 | handles = setedit(handles); |
---|
555 | |
---|
556 | |
---|
557 | % --- Executes during object creation, after setting all properties. |
---|
558 | function sliderQP7L_CreateFcn(hObject, eventdata, handles) |
---|
559 | % hObject handle to sliderQP7L (see GCBO) |
---|
560 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
561 | % handles empty - handles not created until after all CreateFcns called |
---|
562 | |
---|
563 | % Hint: slider controls usually have a light gray background, change |
---|
564 | % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. |
---|
565 | usewhitebg = 1; |
---|
566 | if usewhitebg |
---|
567 | set(hObject,'BackgroundColor',[.9 .9 .9]); |
---|
568 | else |
---|
569 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
570 | end |
---|
571 | |
---|
572 | % --- Executes on slider movement. |
---|
573 | function sliderQP7L_Callback(hObject, eventdata, handles) |
---|
574 | % hObject handle to sliderQP7L (see GCBO) |
---|
575 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
576 | % handles structure with handles and user data (see GUIDATA) |
---|
577 | |
---|
578 | % Hints: get(hObject,'Value') returns position of slider |
---|
579 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider |
---|
580 | handles = setslider(hObject,handles); |
---|
581 | guidata(hObject, handles); |
---|
582 | |
---|
583 | %----------------------------------------------------------------------- |
---|
584 | function plot_axes(handles,quoi) |
---|
585 | %%% fonction generique |
---|
586 | |
---|
587 | axes(handles.axes1); cla; hold on; |
---|
588 | |
---|
589 | switch handles.xtype |
---|
590 | case 'spos' |
---|
591 | x=handles.(handles.xtype); |
---|
592 | case 'phase' |
---|
593 | x=handles.(handles.xtype); x = x(:,1); |
---|
594 | end |
---|
595 | |
---|
596 | switch quoi |
---|
597 | case 'beta' |
---|
598 | plot(x,handles.beta(:,1),'r.-'); |
---|
599 | plot(x,handles.beta(:,2),'b.-'); |
---|
600 | ylabel('\beta (m)'); |
---|
601 | %mat |
---|
602 | %ylim([0 130]); |
---|
603 | |
---|
604 | case 'eta' |
---|
605 | plot(x,handles.eta(:,1),'r.-'); |
---|
606 | plot(x,handles.eta(:,3),'b.-'); |
---|
607 | ylabel('\eta (m)'); |
---|
608 | case 'cod' |
---|
609 | plot(x,handles.cod(:,1)*1e3,'r.-'); |
---|
610 | plot(x,handles.cod(:,3)*1e3,'b.-'); |
---|
611 | ylabel('cod (mm)'); |
---|
612 | case 'phase' |
---|
613 | plot(x,handles.phase(:,1),'r.-'); |
---|
614 | plot(x,handles.phase(:,2),'b.-'); |
---|
615 | ylabel('phase '); |
---|
616 | end |
---|
617 | axis([x(1) x(end) -inf inf]); |
---|
618 | datalabel on |
---|
619 | |
---|
620 | %-------------------------------------------------------------------------- |
---|
621 | function handles = setslider(hObject, handles) |
---|
622 | %%% fonction generique pour un slider de type aimant |
---|
623 | |
---|
624 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); %% get LT1 structure |
---|
625 | %% extrait le numero |
---|
626 | tagstring = get(hObject,'Tag'); |
---|
627 | num = tagstring(regexp(tagstring,'\d')); |
---|
628 | magnet0 = ['QP' num2str(num),'L']; |
---|
629 | val = get(hObject,'Value'); |
---|
630 | str = num2str(val); |
---|
631 | set(handles.(['edit' magnet0]),'string',str); |
---|
632 | |
---|
633 | %% Cherche le nom de l'aimant |
---|
634 | h = handles.(['popupmenu_bar' num]); |
---|
635 | contents = get(h,'String'); |
---|
636 | magnet = contents{get(h,'Value')}; |
---|
637 | handles = setATmagnet(handles,magnet,val); |
---|
638 | |
---|
639 | %AOmagnet.(magnet(1:2)).ModelVal(str2double(magnet(end))) = val; |
---|
640 | AOmagnet.(magnet).ModelVal = val; |
---|
641 | % save data |
---|
642 | setappdata(handles.figure1,'AOmagnet',AOmagnet) |
---|
643 | |
---|
644 | %-------------------------------------------------------------------------- |
---|
645 | function handles = setATmagnet(handles,magnet,val) |
---|
646 | % function handles = setATmagnet(handles,magnet,val) |
---|
647 | % set val as new setvalue of element 'magnet' |
---|
648 | % Replot current graph |
---|
649 | |
---|
650 | AOmagnet= getappdata(handles.figure1,'AOmagnet'); % get magnet AO |
---|
651 | |
---|
652 | % set value to AT model |
---|
653 | setsp(common2family(magnet), val, common2dev(magnet),'Model'); |
---|
654 | |
---|
655 | % Recompute twiss parameters |
---|
656 | handles = computeTwiss(handles); |
---|
657 | % Replot everything |
---|
658 | plot_axes(handles,handles.ytype); |
---|
659 | %mat |
---|
660 | %ylim([0 130]); |
---|
661 | |
---|
662 | %-------------------------------------------------------------------------- |
---|
663 | function handles = setedit(handles) |
---|
664 | % function setedit(handles) |
---|
665 | % generic callback for an edit box |
---|
666 | |
---|
667 | AOmagnet= getappdata(handles.figure1,'AOmagnet'); % get magnet AO |
---|
668 | |
---|
669 | %% construction automatique du nom du slider |
---|
670 | val = str2double(get(gcbo,'String')); |
---|
671 | tagstring = get(gcbo,'Tag'); |
---|
672 | num = tagstring(regexp(tagstring,'\d')); |
---|
673 | magnet0=['QP' num2str(num)]; |
---|
674 | name = handles.(['slider' magnet0]); |
---|
675 | %% Cherche le nom de l'aimant |
---|
676 | h = handles.(['popupmenu_bar' num]); |
---|
677 | contents = get(h,'String'); |
---|
678 | magnet = contents{get(h,'Value')}; |
---|
679 | |
---|
680 | %%% Test si dans les limites |
---|
681 | if val<get(name,'Max') && val> get(name,'Min') |
---|
682 | set(name,'Value',val); |
---|
683 | handles = setATmagnet(handles,magnet,val); |
---|
684 | AOmagnet.(magnet(1:2)).ModelVal(str2double(magnet(end))) = val; |
---|
685 | else % message d'erreur |
---|
686 | warndlg('Wrong value for K','Edit Box','Modal') |
---|
687 | set(hObject,'String',num2str(get(name,'Value'))); |
---|
688 | end |
---|
689 | |
---|
690 | % Save data |
---|
691 | setappdata(handles.figure1,'AOmagnet',AOmagnet); |
---|
692 | |
---|
693 | %--------------------------------- |
---|
694 | function mutual_exclude(off) |
---|
695 | % function mutual_exclude(off) |
---|
696 | % fonction pour faire des radioboutons |
---|
697 | set(off,'Value',0); |
---|
698 | |
---|
699 | % --- Executes during object creation, after setting all properties. |
---|
700 | function popupmenu_y_CreateFcn(hObject, eventdata, handles) |
---|
701 | % hObject handle to popupmenu_y (see GCBO) |
---|
702 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
703 | % handles empty - handles not created until after all CreateFcns called |
---|
704 | |
---|
705 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
706 | % See ISPC and COMPUTER. |
---|
707 | if ispc |
---|
708 | set(hObject,'BackgroundColor','white'); |
---|
709 | else |
---|
710 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
711 | end |
---|
712 | |
---|
713 | |
---|
714 | % --- Executes on selection change in popupmenu_y. |
---|
715 | function popupmenu_y_Callback(hObject, eventdata, handles) |
---|
716 | % hObject handle to popupmenu_y (see GCBO) |
---|
717 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
718 | % handles structure with handles and user data (see GUIDATA) |
---|
719 | |
---|
720 | % Hints: contents = get(hObject,'String') returns popupmenu_y contents as cell array |
---|
721 | % contents{get(hObject,'Value')} returns selected item from popupmenu_y |
---|
722 | contents = get(hObject,'String'); |
---|
723 | plot_axes(handles, contents{get(hObject,'Value')}); |
---|
724 | %mat |
---|
725 | %ylim([0 130]); |
---|
726 | handles.ytype = contents{get(hObject,'Value')}; |
---|
727 | guidata(hObject, handles); |
---|
728 | |
---|
729 | % --- Executes during object creation, after setting all properties. |
---|
730 | function popupmenu_x_CreateFcn(hObject, eventdata, handles) |
---|
731 | % hObject handle to popupmenu_x (see GCBO) |
---|
732 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
733 | % handles empty - handles not created until after all CreateFcns called |
---|
734 | |
---|
735 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
736 | % See ISPC and COMPUTER. |
---|
737 | if ispc |
---|
738 | set(hObject,'BackgroundColor','white'); |
---|
739 | else |
---|
740 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
741 | end |
---|
742 | |
---|
743 | % --- Executes on selection change in popupmenu_x. |
---|
744 | function popupmenu_x_Callback(hObject, eventdata, handles) |
---|
745 | % hObject handle to popupmenu_x (see GCBO) |
---|
746 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
747 | % handles structure with handles and user data (see GUIDATA) |
---|
748 | |
---|
749 | % Hints: contents = get(hObject,'String') returns popupmenu_x contents as cell array |
---|
750 | % contents{get(hObject,'Value')} returns selected item from popupmenu_x |
---|
751 | contents = get(hObject,'String'); |
---|
752 | handles.xtype = contents{get(hObject,'Value')}; |
---|
753 | guidata(hObject, handles); |
---|
754 | plot_axes(handles, handles.ytype); |
---|
755 | %mat |
---|
756 | %ylim([0 130]); |
---|
757 | |
---|
758 | % --- Executes during object creation, after setting all properties. |
---|
759 | function popupmenu_plane_CreateFcn(hObject, eventdata, handles) |
---|
760 | % hObject handle to popupmenu_plane (see GCBO) |
---|
761 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
762 | % handles empty - handles not created until after all CreateFcns called |
---|
763 | |
---|
764 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
765 | % See ISPC and COMPUTER. |
---|
766 | if ispc |
---|
767 | set(hObject,'BackgroundColor','white'); |
---|
768 | else |
---|
769 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
770 | end |
---|
771 | |
---|
772 | |
---|
773 | % --- Executes on selection change in popupmenu_plane. |
---|
774 | function popupmenu_plane_Callback(hObject, eventdata, handles) |
---|
775 | % hObject handle to popupmenu_plane (see GCBO) |
---|
776 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
777 | % handles structure with handles and user data (see GUIDATA) |
---|
778 | |
---|
779 | % Hints: contents = get(hObject,'String') returns popupmenu_plane contents as cell array |
---|
780 | % contents{get(hObject,'Value')} returns selected item from popupmenu_plane |
---|
781 | |
---|
782 | |
---|
783 | % --- Executes on button press in pushbutton_reload. |
---|
784 | function pushbutton_reload_Callback(hObject, eventdata, handles) |
---|
785 | % hObject handle to pushbutton_reload (see GCBO) |
---|
786 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
787 | % handles structure with handles and user data (see GUIDATA) |
---|
788 | |
---|
789 | handles = restart(handles); |
---|
790 | guidata(hObject,handles); |
---|
791 | |
---|
792 | %-------------------------------------------------------- |
---|
793 | function handles = restart(handles) |
---|
794 | % function handles = restart(handles) |
---|
795 | % Reinitialise la maille et l'IHM |
---|
796 | |
---|
797 | AD = getad; |
---|
798 | run(AD.ATModel); %% Load lattice |
---|
799 | global THERING |
---|
800 | % MAT ET LAURENT : TEMPORAIRE |
---|
801 | %warning('66 MeV'); |
---|
802 | %setenergymodel(0.066); |
---|
803 | |
---|
804 | % |
---|
805 | setappdata(handles.figure1, 'TL', THERING); |
---|
806 | |
---|
807 | handles.restart = 1; |
---|
808 | handles = computeTwiss(handles); |
---|
809 | |
---|
810 | plot_axes(handles,handles.ytype); |
---|
811 | %mat |
---|
812 | |
---|
813 | %ylim([0 130]); |
---|
814 | |
---|
815 | handles.modelMagnetVal = {'chModelVal', 'cvModelVal', ... |
---|
816 | 'quadrupoleModelVal', 'dipoleModelVal'}; |
---|
817 | |
---|
818 | store_model_values(handles); |
---|
819 | |
---|
820 | % Relaod Accelerator Object |
---|
821 | AO = getao; |
---|
822 | |
---|
823 | %% Initialise les sliders et editboxes |
---|
824 | for k = 1:handles.sliderNumber |
---|
825 | name = ['popupmenu_bar' num2str(k)]; |
---|
826 | contents = get(handles.(name),'String'); |
---|
827 | magnet = contents{get(handles.(name),'Value')}; |
---|
828 | |
---|
829 | Qname = ['QP' num2str(k),'L']; |
---|
830 | |
---|
831 | % Read AT values |
---|
832 | val = getam(common2family(magnet),common2dev(magnet),'Model'); |
---|
833 | |
---|
834 | set(handles.(['slider' Qname]),'Value', val); |
---|
835 | set(handles.(['edit' Qname]),'string', num2str(val)); |
---|
836 | end |
---|
837 | |
---|
838 | |
---|
839 | % --- Executes during object creation, after setting all properties. |
---|
840 | function popupmenu_bar1_CreateFcn(hObject, eventdata, handles) |
---|
841 | % hObject handle to popupmenu_bar1 (see GCBO) |
---|
842 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
843 | % handles empty - handles not created until after all CreateFcns called |
---|
844 | |
---|
845 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
846 | % See ISPC and COMPUTER. |
---|
847 | if ispc |
---|
848 | set(hObject,'BackgroundColor','white'); |
---|
849 | else |
---|
850 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
851 | end |
---|
852 | |
---|
853 | |
---|
854 | % --- Executes on selection change in popupmenu_bar1. |
---|
855 | function popupmenu_bar1_Callback(hObject, eventdata, handles) |
---|
856 | % hObject handle to popupmenu_bar1 (see GCBO) |
---|
857 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
858 | % handles structure with handles and user data (see GUIDATA) |
---|
859 | |
---|
860 | % Hints: contents = get(hObject,'String') returns popupmenu_bar1 contents as cell array |
---|
861 | % contents{get(hObject,'Value')} returns selected item from popupmenu_bar1 |
---|
862 | |
---|
863 | setbar(handles); |
---|
864 | |
---|
865 | %---------------------------------------------------------- |
---|
866 | function setbar(handles) |
---|
867 | %% aimant selectionne |
---|
868 | contents = get(gcbo,'String'); |
---|
869 | magnet = contents{get(gcbo,'Value')} |
---|
870 | |
---|
871 | %% mets a jour l'IHM pour cet aimant |
---|
872 | tagstring = get(gcbo,'Tag'); |
---|
873 | num = tagstring(regexp(tagstring,'\d')); |
---|
874 | slidername = ['sliderQP' num, 'L']; |
---|
875 | editboxname = ['editQP' num, 'L']; |
---|
876 | |
---|
877 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); |
---|
878 | |
---|
879 | switch magnet |
---|
880 | case AOmagnet.HCOR.CommonNames |
---|
881 | % val_max = getmaxsp('HCOR'); |
---|
882 | % for k = 1:7 |
---|
883 | % name = strcat('sliderQP',num2str(k),'L') |
---|
884 | % set(handles.(name),'Max',val_max(1)); |
---|
885 | % end |
---|
886 | val = AOmagnet.HCOR.ModelVal(str2double(magnet(end))); |
---|
887 | case AOmagnet.VCOR.CommonNames |
---|
888 | val = AOmagnet.VCOR.ModelVal(str2double(magnet(end))); |
---|
889 | case AOmagnet.QP1L.CommonNames |
---|
890 | val = AOmagnet.QP1L.ModelVal; |
---|
891 | case AOmagnet.QP2L.CommonNames |
---|
892 | val = AOmagnet.QP2L.ModelVal; |
---|
893 | case AOmagnet.QP3L.CommonNames |
---|
894 | val = AOmagnet.QP3L.ModelVal; |
---|
895 | case AOmagnet.QP4L.CommonNames |
---|
896 | val = AOmagnet.QP4L.ModelVal; |
---|
897 | case AOmagnet.QP5L.CommonNames |
---|
898 | val = AOmagnet.QP5L.ModelVal; |
---|
899 | case AOmagnet.QP6L.CommonNames |
---|
900 | val = AOmagnet.QP6L.ModelVal; |
---|
901 | case AOmagnet.QP7L.CommonNames |
---|
902 | val = AOmagnet.QP7L.ModelVal; |
---|
903 | case AOmagnet.BEND1.CommonNames |
---|
904 | val = AOmagnet.BEND1.ModelVal(str2double(magnet(end))); |
---|
905 | case AOmagnet.BEND2.CommonNames |
---|
906 | val = AOmagnet.BEND2.ModelVal(str2double(magnet(end))); |
---|
907 | end |
---|
908 | |
---|
909 | str = num2str(val); |
---|
910 | set(handles.(slidername),'Value',val); % writes slider |
---|
911 | set(handles.(editboxname),'String',str); % writes editbox |
---|
912 | |
---|
913 | % --- Executes during object creation, after setting all properties. |
---|
914 | function popupmenu_bar2_CreateFcn(hObject, eventdata, handles) |
---|
915 | % hObject handle to popupmenu_bar2 (see GCBO) |
---|
916 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
917 | % handles empty - handles not created until after all CreateFcns called |
---|
918 | |
---|
919 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
920 | % See ISPC and COMPUTER. |
---|
921 | if ispc |
---|
922 | set(hObject,'BackgroundColor','white'); |
---|
923 | else |
---|
924 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
925 | end |
---|
926 | |
---|
927 | % --- Executes on selection change in popupmenu_bar2. |
---|
928 | function popupmenu_bar2_Callback(hObject, eventdata, handles) |
---|
929 | % hObject handle to popupmenu_bar2 (see GCBO) |
---|
930 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
931 | % handles structure with handles and user data (see GUIDATA) |
---|
932 | |
---|
933 | % Hints: contents = get(hObject,'String') returns popupmenu_bar2 contents as cell array |
---|
934 | % contents{get(hObject,'Value')} returns selected item from popupmenu_bar2 |
---|
935 | setbar(handles); |
---|
936 | |
---|
937 | % --- Executes during object creation, after setting all properties. |
---|
938 | function popupmenu_bar3_CreateFcn(hObject, eventdata, handles) |
---|
939 | % hObject handle to popupmenu_bar3 (see GCBO) |
---|
940 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
941 | % handles empty - handles not created until after all CreateFcns called |
---|
942 | |
---|
943 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
944 | % See ISPC and COMPUTER. |
---|
945 | if ispc |
---|
946 | set(hObject,'BackgroundColor','white'); |
---|
947 | else |
---|
948 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
949 | end |
---|
950 | |
---|
951 | % --- Executes on selection change in popupmenu_bar3. |
---|
952 | function popupmenu_bar3_Callback(hObject, eventdata, handles) |
---|
953 | % hObject handle to popupmenu_bar3 (see GCBO) |
---|
954 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
955 | % handles structure with handles and user data (see GUIDATA) |
---|
956 | |
---|
957 | % Hints: contents = get(hObject,'String') returns popupmenu_bar3 contents as cell array |
---|
958 | % contents{get(hObject,'Value')} returns selected item from popupmenu_bar3 |
---|
959 | setbar(handles); |
---|
960 | |
---|
961 | % --- Executes during object creation, after setting all properties. |
---|
962 | function popupmenu_bar4_CreateFcn(hObject, eventdata, handles) |
---|
963 | % hObject handle to popupmenu_bar4 (see GCBO) |
---|
964 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
965 | % handles empty - handles not created until after all CreateFcns called |
---|
966 | |
---|
967 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
968 | % See ISPC and COMPUTER. |
---|
969 | if ispc |
---|
970 | set(hObject,'BackgroundColor','white'); |
---|
971 | else |
---|
972 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
973 | end |
---|
974 | |
---|
975 | % --- Executes on selection change in popupmenu_bar4. |
---|
976 | function popupmenu_bar4_Callback(hObject, eventdata, handles) |
---|
977 | % hObject handle to popupmenu_bar4 (see GCBO) |
---|
978 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
979 | % handles structure with handles and user data (see GUIDATA) |
---|
980 | |
---|
981 | % Hints: contents = get(hObject,'String') returns popupmenu_bar4 contents as cell array |
---|
982 | % contents{get(hObject,'Value')} returns selected item from popupmenu_bar4 |
---|
983 | setbar(handles); |
---|
984 | |
---|
985 | % --- Executes during object creation, after setting all properties. |
---|
986 | function popupmenu_bar5_CreateFcn(hObject, eventdata, handles) |
---|
987 | % hObject handle to popupmenu_bar5 (see GCBO) |
---|
988 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
989 | % handles empty - handles not created until after all CreateFcns called |
---|
990 | |
---|
991 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
992 | % See ISPC and COMPUTER. |
---|
993 | if ispc |
---|
994 | set(hObject,'BackgroundColor','white'); |
---|
995 | else |
---|
996 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
997 | end |
---|
998 | |
---|
999 | % --- Executes on selection change in popupmenu_bar5. |
---|
1000 | function popupmenu_bar5_Callback(hObject, eventdata, handles) |
---|
1001 | % hObject handle to popupmenu_bar5 (see GCBO) |
---|
1002 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1003 | % handles structure with handles and user data (see GUIDATA) |
---|
1004 | |
---|
1005 | % Hints: contents = get(hObject,'String') returns popupmenu_bar5 contents as cell array |
---|
1006 | % contents{get(hObject,'Value')} returns selected item from popupmenu_bar5 |
---|
1007 | setbar(handles); |
---|
1008 | |
---|
1009 | % --- Executes during object creation, after setting all properties. |
---|
1010 | function popupmenu_bar6_CreateFcn(hObject, eventdata, handles) |
---|
1011 | % hObject handle to popupmenu_bar6 (see GCBO) |
---|
1012 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1013 | % handles empty - handles not created until after all CreateFcns called |
---|
1014 | |
---|
1015 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
1016 | % See ISPC and COMPUTER. |
---|
1017 | if ispc |
---|
1018 | set(hObject,'BackgroundColor','white'); |
---|
1019 | else |
---|
1020 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
1021 | end |
---|
1022 | |
---|
1023 | |
---|
1024 | % --- Executes on selection change in popupmenu_bar6. |
---|
1025 | function popupmenu_bar6_Callback(hObject, eventdata, handles) |
---|
1026 | % hObject handle to popupmenu_bar6 (see GCBO) |
---|
1027 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1028 | % handles structure with handles and user data (see GUIDATA) |
---|
1029 | |
---|
1030 | % Hints: contents = get(hObject,'String') returns popupmenu_bar6 contents as cell array |
---|
1031 | % contents{get(hObject,'Value')} returns selected item from popupmenu_bar6 |
---|
1032 | setbar(handles); |
---|
1033 | |
---|
1034 | % --- Executes during object creation, after setting all properties. |
---|
1035 | function popupmenu_bar7_CreateFcn(hObject, eventdata, handles) |
---|
1036 | % hObject handle to popupmenu_bar7 (see GCBO) |
---|
1037 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1038 | % handles empty - handles not created until after all CreateFcns called |
---|
1039 | |
---|
1040 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
1041 | % See ISPC and COMPUTER. |
---|
1042 | if ispc |
---|
1043 | set(hObject,'BackgroundColor','white'); |
---|
1044 | else |
---|
1045 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
1046 | end |
---|
1047 | |
---|
1048 | % --- Executes on selection change in popupmenu_bar7. |
---|
1049 | function popupmenu_bar7_Callback(hObject, eventdata, handles) |
---|
1050 | % hObject handle to popupmenu_bar7 (see GCBO) |
---|
1051 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1052 | % handles structure with handles and user data (see GUIDATA) |
---|
1053 | |
---|
1054 | % Hints: contents = get(hObject,'String') returns popupmenu_bar7 contents as cell array |
---|
1055 | % contents{get(hObject,'Value')} returns selected item from popupmenu_bar7 |
---|
1056 | setbar(handles); |
---|
1057 | |
---|
1058 | |
---|
1059 | % --- Executes on button press in pushbutton_refresh. |
---|
1060 | function pushbutton_refresh_Callback(hObject, eventdata, handles) |
---|
1061 | % hObject handle to pushbutton_refresh (see GCBO) |
---|
1062 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1063 | % handles structure with handles and user data (see GUIDATA) |
---|
1064 | |
---|
1065 | %-------------------------------------------------------------------------- |
---|
1066 | function read_tango(handles) |
---|
1067 | % Reads Tango values for LT1. |
---|
1068 | |
---|
1069 | % Get magnet AO |
---|
1070 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); |
---|
1071 | FamilyName = fieldnames(AOmagnet); |
---|
1072 | |
---|
1073 | for k1 = 1:length(FamilyName) |
---|
1074 | % get attribute readback value |
---|
1075 | magnet = AOmagnet.(FamilyName{k1}); |
---|
1076 | AOmagnet.(FamilyName{k1}).TangoVal = ... |
---|
1077 | getam(FamilyName{k1},'Online'); |
---|
1078 | end |
---|
1079 | |
---|
1080 | % save data |
---|
1081 | setappdata(handles.figure1,'AOmagnet',AOmagnet) |
---|
1082 | |
---|
1083 | %-------------------------------------------------------------------------- |
---|
1084 | function write_tango(handles); |
---|
1085 | %-- Writes Tango values |
---|
1086 | %% Ecriture courant aimant sur les devices serveurs |
---|
1087 | |
---|
1088 | % Get magnet AO |
---|
1089 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); |
---|
1090 | |
---|
1091 | FamilyName = fieldnames(AOmagnet); |
---|
1092 | for k1 = 1:length(FamilyName) |
---|
1093 | magnet = AOmagnet.(FamilyName{k1}); |
---|
1094 | setsp(magnet, magnet.ModelVal,'Online'); |
---|
1095 | end |
---|
1096 | |
---|
1097 | %-------------------------------------------------------------------------- |
---|
1098 | function devicelist = get_device_name(machine,property,magnet) |
---|
1099 | % get device list from mapping read in tango database |
---|
1100 | |
---|
1101 | map = tango_get_db_property(machine,property); |
---|
1102 | sep = cell2mat(regexpi(map,'::','once'))-1; |
---|
1103 | devicelist = regexprep(map,[magnet '\d*::'],'')'; |
---|
1104 | |
---|
1105 | % --- Executes during object creation, after setting all properties. |
---|
1106 | function pushbutton_reload_CreateFcn(hObject, eventdata, handles) |
---|
1107 | % hObject handle to pushbutton_reload (see GCBO) |
---|
1108 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1109 | % handles empty - handles not created until after all CreateFcns called |
---|
1110 | |
---|
1111 | % --- Executes on button press in pushbutton_model2online. |
---|
1112 | function pushbutton_model2online_Callback(hObject, eventdata, handles) |
---|
1113 | % hObject handle to pushbutton_model2online (see GCBO) |
---|
1114 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1115 | % handles structure with handles and user data (see GUIDATA) |
---|
1116 | |
---|
1117 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); %% get LT1 structure |
---|
1118 | |
---|
1119 | user_response = questdlg('Do you want to write setvalues to LT1?'); |
---|
1120 | switch user_response |
---|
1121 | case{'No','Cancel'} |
---|
1122 | return; |
---|
1123 | case{'Yes'} |
---|
1124 | FamilyName = fieldnames(AOmagnet); |
---|
1125 | for k1 = 1:length(FamilyName) |
---|
1126 | AOmagnet.(FamilyName{k1}).TangoVal = ... |
---|
1127 | AOmagnet.(FamilyName{k1}).ModelVal; |
---|
1128 | end |
---|
1129 | write_tango(handles); |
---|
1130 | end |
---|
1131 | |
---|
1132 | % save data |
---|
1133 | setappdata(handles.figure1,'AOmagnet',AOmagnet) |
---|
1134 | |
---|
1135 | % --- Executes on button press in pushbutton_online2model. |
---|
1136 | function pushbutton_online2model_Callback(hObject, eventdata, handles) |
---|
1137 | % hObject handle to pushbutton_online2model (see GCBO) |
---|
1138 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1139 | % handles structure with handles and user data (see GUIDATA) |
---|
1140 | |
---|
1141 | % Online values stored in model values except dipoles |
---|
1142 | user_response = questdlg('Do you want to read TANGO setvalues from LT1?'); |
---|
1143 | switch user_response |
---|
1144 | case{'No','Cancel'} |
---|
1145 | return; |
---|
1146 | case{'Yes'} |
---|
1147 | read_tango(handles); |
---|
1148 | end |
---|
1149 | |
---|
1150 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); %% get LT1 structure |
---|
1151 | |
---|
1152 | FamilyName = fieldnames(AOmagnet); |
---|
1153 | for k1 = 1:length(FamilyName) |
---|
1154 | AOmagnet.(FamilyName{k1}).ModelVal = AOmagnet.(FamilyName{k1}).TangoVal; |
---|
1155 | end |
---|
1156 | |
---|
1157 | %% Initialise les sliders et editboxes |
---|
1158 | for k = 1:handles.sliderNumber |
---|
1159 | name = ['popupmenu_bar' num2str(k)]; |
---|
1160 | contents = get(handles.(name),'String'); |
---|
1161 | magnet = contents{get(handles.(name),'Value')}; |
---|
1162 | |
---|
1163 | Qname = ['QP' num2str(k)]; |
---|
1164 | |
---|
1165 | switch magnet |
---|
1166 | case AOmagnet.QP.CommonNames |
---|
1167 | val = AOmagnet.QP.TangoVal(str2double(magnet(end))); |
---|
1168 | case AOmagnet.CH.CommonNames |
---|
1169 | val = AOmagnet.CH.TangoVal(str2double(magnet(end))); |
---|
1170 | case AOmagnet.CV.CommonNames |
---|
1171 | val = AOmagnet.CV.TangoVal(str2double(magnet(end))); |
---|
1172 | end |
---|
1173 | |
---|
1174 | set(handles.(['slider' Qname]),'Value', val); |
---|
1175 | set(handles.(['edit' Qname]),'string', num2str(val)); |
---|
1176 | end |
---|
1177 | |
---|
1178 | set_model_values(handles); |
---|
1179 | |
---|
1180 | handles = computeTwiss(handles); |
---|
1181 | plot_axes(handles,handles.ytype); |
---|
1182 | %mat |
---|
1183 | %ylim([0 130]); |
---|
1184 | % Update handles structure |
---|
1185 | guidata(hObject, handles); |
---|
1186 | |
---|
1187 | %% Update date |
---|
1188 | set(handles.text_date,'String',datestr(now,0)); |
---|
1189 | |
---|
1190 | %save data |
---|
1191 | setappdata(handles.figure1,'AOmagnet',AOmagnet); |
---|
1192 | |
---|
1193 | %-------------------------------------------------------------------------- |
---|
1194 | function handles = init_handles(handles) |
---|
1195 | %% Inits structure storing all the magnet data |
---|
1196 | |
---|
1197 | %% AT model used |
---|
1198 | % global THERING; |
---|
1199 | |
---|
1200 | A1 = getao; % Load AO for the first time |
---|
1201 | AOmagnet = []; |
---|
1202 | list = findmemberof('Magnet'); |
---|
1203 | for k = 1:length(list) |
---|
1204 | AOmagnet.(list{k}) = A1.(list{k}); |
---|
1205 | end |
---|
1206 | clear A1; |
---|
1207 | |
---|
1208 | %save data |
---|
1209 | setappdata(handles.figure1,'AOmagnet',AOmagnet); |
---|
1210 | |
---|
1211 | store_model_values(handles); |
---|
1212 | |
---|
1213 | %% Update time |
---|
1214 | set(handles.text_date,'String',datestr(now,0)); |
---|
1215 | |
---|
1216 | %-------------------------------------------------------------------------- |
---|
1217 | function store_model_values(handles) |
---|
1218 | %% Stores model values in AOmagnet |
---|
1219 | |
---|
1220 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); % get AOmagnet structure |
---|
1221 | |
---|
1222 | % Loop over magnet types |
---|
1223 | FamilyName = fieldnames(AOmagnet); |
---|
1224 | |
---|
1225 | for k1 = 1:length(FamilyName) |
---|
1226 | AOmagnet.(FamilyName{k1}).ModelVal = getam(FamilyName{k1},'Model'); |
---|
1227 | end |
---|
1228 | |
---|
1229 | setappdata(handles.figure1,'AOmagnet',AOmagnet); |
---|
1230 | |
---|
1231 | %-------------------------------------------------------------------------- |
---|
1232 | function set_model_values(handles) |
---|
1233 | % Set Modelvalue into LT1 AT model |
---|
1234 | |
---|
1235 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); % get AOmagnet structure |
---|
1236 | |
---|
1237 | %% Set model values to AT |
---|
1238 | FamilyName = fieldnames(AOmagnet); |
---|
1239 | |
---|
1240 | for k1 = 1:length(FamilyName) |
---|
1241 | magnet = AOmagnet.(FamilyName{k1}); |
---|
1242 | setsp(FamilyName{k1}, magnet.ModelVal,'Model'); |
---|
1243 | end |
---|
1244 | |
---|
1245 | |
---|
1246 | %-------------------------------------------------------------------------- |
---|
1247 | function submenu_print_setpoint_Callback(hObject, eventdata, handles) |
---|
1248 | % hObject handle to submenu_print_setpoint (see GCBO) |
---|
1249 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1250 | % handles structure with handles and user data (see GUIDATA) |
---|
1251 | |
---|
1252 | |
---|
1253 | %-------------------------------------------------------------------------- |
---|
1254 | function submenu_print_model_Callback(hObject, eventdata, handles) |
---|
1255 | % hObject handle to submenu_print_model (see GCBO) |
---|
1256 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1257 | % handles structure with handles and user data (see GUIDATA) |
---|
1258 | |
---|
1259 | |
---|
1260 | % ------------------------------------------------------------------------- |
---|
1261 | function submenu_save_setpoint_Callback(hObject, eventdata, handles) |
---|
1262 | % hObject handle to submenu_save_setpoint (see GCBO) |
---|
1263 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1264 | % handles structure with handles and user data (see GUIDATA) |
---|
1265 | |
---|
1266 | |
---|
1267 | % ------------------------------------------------------------------------- |
---|
1268 | function submenu_save_model_Callback(hObject, eventdata, handles) |
---|
1269 | % hObject handle to submenu_save_model (see GCBO) |
---|
1270 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1271 | % handles structure with handles and user data (see GUIDATA) |
---|
1272 | |
---|
1273 | |
---|
1274 | % ------------------------------------------------------------------------- |
---|
1275 | function submenu_load_setpoint_Callback(hObject, eventdata, handles) |
---|
1276 | % hObject handle to submenu_load_setpoint (see GCBO) |
---|
1277 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1278 | % handles structure with handles and user data (see GUIDATA) |
---|
1279 | |
---|
1280 | |
---|
1281 | %-------------------------------------------------------------------------- |
---|
1282 | function submenu_load_model_Callback(hObject, eventdata, handles) |
---|
1283 | % hObject handle to submenu_load_model (see GCBO) |
---|
1284 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1285 | % handles structure with handles and user data (see GUIDATA) |
---|
1286 | |
---|
1287 | |
---|
1288 | %-------------------------------------------------------------------------- |
---|
1289 | function Untitled_1_Callback(hObject, eventdata, handles) |
---|
1290 | % hObject handle to Untitled_1 (see GCBO) |
---|
1291 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1292 | % handles structure with handles and user data (see GUIDATA) |
---|
1293 | |
---|
1294 | |
---|
1295 | %-------------------------------------------------------------------------- |
---|
1296 | function Untitled_4_Callback(hObject, eventdata, handles) |
---|
1297 | % hObject handle to Untitled_4 (see GCBO) |
---|
1298 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1299 | % handles structure with handles and user data (see GUIDATA) |
---|
1300 | |
---|
1301 | |
---|
1302 | %-------------------------------------------------------------------------- |
---|
1303 | function Untitled_7_Callback(hObject, eventdata, handles) |
---|
1304 | % hObject handle to Untitled_7 (see GCBO) |
---|
1305 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1306 | % handles structure with handles and user data (see GUIDATA) |
---|
1307 | |
---|
1308 | |
---|
1309 | % -------------------------------------------------------------------- |
---|
1310 | function submenu_dump_model_Callback(hObject, eventdata, handles) |
---|
1311 | % hObject handle to submenu_dump_model (see GCBO) |
---|
1312 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1313 | % handles structure with handles and user data (see GUIDATA) |
---|
1314 | |
---|
1315 | % Get magnet AO |
---|
1316 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); |
---|
1317 | |
---|
1318 | fprintf(' DeviceName Model s(m) phasex betax(m) etax(m) xcod(mm) phasez betaz(m) etaz(m) zcod(mm)\n') |
---|
1319 | |
---|
1320 | FamilyName = fieldnames(AOmagnet); |
---|
1321 | for k1 = 1:length(FamilyName) |
---|
1322 | alias = AOmagnet.(FamilyName{k1}); |
---|
1323 | for k2 = 1 : length(AOmagnet.(FamilyName{k1}).CommonNames) |
---|
1324 | fprintf('%15s %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f \n', ... |
---|
1325 | alias.DeviceName{k2}, alias.ModelVal(k2), ... |
---|
1326 | handles.spos(alias.AT.ATIndex(k2),1), handles.phase(alias.AT.ATIndex(k2),1), ... |
---|
1327 | handles.beta(alias.AT.ATIndex(k2),1), handles.eta(alias.AT.ATIndex(k2),1), ... |
---|
1328 | handles.cod(alias.AT.ATIndex(k2),1), ... |
---|
1329 | handles.phase(alias.AT.ATIndex(k2),2), ... |
---|
1330 | handles.beta(alias.AT.ATIndex(k2),2), handles.eta(alias.AT.ATIndex(k2),2), ... |
---|
1331 | handles.cod(alias.AT.ATIndex(k2),2)); |
---|
1332 | end |
---|
1333 | end |
---|
1334 | |
---|
1335 | |
---|
1336 | %-------------------------------------------------------------------------- |
---|
1337 | function submenu_dump_setpoint_Callback(hObject, eventdata, handles) |
---|
1338 | % hObject handle to submenu_dump_setpoint (see GCBO) |
---|
1339 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1340 | % handles structure with handles and user data (see GUIDATA) |
---|
1341 | |
---|
1342 | % Get magnet AO |
---|
1343 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); |
---|
1344 | |
---|
1345 | fprintf('\n\n DeviceName TANGO\n') |
---|
1346 | |
---|
1347 | FamilyName = fieldnames(AOmagnet); |
---|
1348 | for k1 = 1:length(FamilyName) |
---|
1349 | for k2 = 1 : length(AOmagnet.(FamilyName{k1}).CommonNames) |
---|
1350 | alias = AOmagnet.(FamilyName{k1}); |
---|
1351 | fprintf('%15s %6.2f \n', alias.DeviceName{k2}, ... |
---|
1352 | alias.TangoVal(k2)); |
---|
1353 | end |
---|
1354 | end |
---|
1355 | |
---|
1356 | |
---|
1357 | %-------------------------------------------------------------------------- |
---|
1358 | function submenu_dump_soleil_setpoint_Callback(hObject, eventdata, handles) |
---|
1359 | % hObject handle to submenu_dump_soleil_setpoint (see GCBO) |
---|
1360 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1361 | % handles structure with handles and user data (see GUIDATA) |
---|
1362 | |
---|
1363 | fprintf('\n\n DeviceName Model TANGO\n') |
---|
1364 | |
---|
1365 | % Get magnet AO |
---|
1366 | AOmagnet = getappdata(handles.figure1,'AOmagnet'); |
---|
1367 | |
---|
1368 | FamilyName = fieldnames(AOmagnet); |
---|
1369 | for k1 = 1:length(FamilyName) |
---|
1370 | for k2 = 1 : length(AOmagnet.(FamilyName{k1}).CommonNames) |
---|
1371 | alias = AOmagnet.(FamilyName{k1}); |
---|
1372 | fprintf('%15s %6.2f %6.2f\n', alias.DeviceName{k2}, ... |
---|
1373 | alias.ModelVal(k2), alias.TangoVal(k2)); |
---|
1374 | end |
---|
1375 | end |
---|
1376 | |
---|
1377 | |
---|
1378 | % -------------------------------------------------------------------- |
---|
1379 | function twiss_parameters_Callback(hObject, eventdata, handles) |
---|
1380 | % hObject handle to twiss_parameters (see GCBO) |
---|
1381 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1382 | % handles structure with handles and user data (see GUIDATA) |
---|
1383 | |
---|
1384 | |
---|
1385 | % -------------------------------------------------------------------- |
---|
1386 | function submenu_twissparameters_entry_Callback(hObject, eventdata, handles) |
---|
1387 | % hObject handle to submenu_twissparameters_entry (see GCBO) |
---|
1388 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1389 | % handles structure with handles and user data (see GUIDATA) |
---|
1390 | |
---|
1391 | twiss_parameters_entry(handles) |
---|
1392 | |
---|
1393 | |
---|
1394 | % --- Executes during object creation, after setting all properties. |
---|
1395 | function figure1_CreateFcn(hObject, eventdata, handles) |
---|
1396 | % hObject handle to figure1 (see GCBO) |
---|
1397 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1398 | % handles empty - handles not created until after all CreateFcns called |
---|
1399 | |
---|
1400 | |
---|
1401 | % --- Executes during object deletion, before destroying properties. |
---|
1402 | function figure1_DeleteFcn(hObject, eventdata, handles) |
---|
1403 | % hObject handle to figure1 (see GCBO) |
---|
1404 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1405 | % handles structure with handles and user data (see GUIDATA) |
---|
1406 | |
---|
1407 | % --- Executes during object deletion, before destroying properties. |
---|
1408 | function sliderQP1L_DeleteFcn(hObject, eventdata, handles) |
---|
1409 | % hObject handle to sliderQP1L (see GCBO) |
---|
1410 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1411 | % handles structure with handles and user data (see GUIDATA) |
---|
1412 | |
---|
1413 | |
---|
1414 | % --- If Enable == 'on', executes on mouse press in 5 pixel border. |
---|
1415 | % --- Otherwise, executes on mouse press in 5 pixel border or over sliderQP1L. |
---|
1416 | function sliderQP1L_ButtonDownFcn(hObject, eventdata, handles) |
---|
1417 | % hObject handle to sliderQP1L (see GCBO) |
---|
1418 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1419 | % handles structure with handles and user data (see GUIDATA) |
---|
1420 | |
---|
1421 | |
---|
1422 | % --- Executes on key press with focus on sliderQP1L and none of its controls. |
---|
1423 | function sliderQP1L_KeyPressFcn(hObject, eventdata, handles) |
---|
1424 | % hObject handle to sliderQP1L (see GCBO) |
---|
1425 | % eventdata structure with the following fields (see UICONTROL) |
---|
1426 | % Key: name of the key that was pressed, in lower case |
---|
1427 | % Character: character interpretation of the key(s) that was pressed |
---|
1428 | % Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed |
---|
1429 | % handles structure with handles and user data (see GUIDATA) |
---|
1430 | |
---|
1431 | |
---|
1432 | % --- Executes during object deletion, before destroying properties. |
---|
1433 | function sliderQP2L_DeleteFcn(hObject, eventdata, handles) |
---|
1434 | % hObject handle to sliderQP2L (see GCBO) |
---|
1435 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1436 | % handles structure with handles and user data (see GUIDATA) |
---|
1437 | |
---|
1438 | |
---|
1439 | % --- If Enable == 'on', executes on mouse press in 5 pixel border. |
---|
1440 | % --- Otherwise, executes on mouse press in 5 pixel border or over sliderQP2L. |
---|
1441 | function sliderQP2L_ButtonDownFcn(hObject, eventdata, handles) |
---|
1442 | % hObject handle to sliderQP2L (see GCBO) |
---|
1443 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1444 | % handles structure with handles and user data (see GUIDATA) |
---|
1445 | |
---|
1446 | |
---|
1447 | % --- Executes on key press with focus on sliderQP2L and none of its controls. |
---|
1448 | function sliderQP2L_KeyPressFcn(hObject, eventdata, handles) |
---|
1449 | % hObject handle to sliderQP2L (see GCBO) |
---|
1450 | % eventdata structure with the following fields (see UICONTROL) |
---|
1451 | % Key: name of the key that was pressed, in lower case |
---|
1452 | % Character: character interpretation of the key(s) that was pressed |
---|
1453 | % Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed |
---|
1454 | % handles structure with handles and user data (see GUIDATA) |
---|
1455 | |
---|
1456 | |
---|
1457 | % --- Executes during object deletion, before destroying properties. |
---|
1458 | function sliderQP3L_DeleteFcn(hObject, eventdata, handles) |
---|
1459 | % hObject handle to sliderQP3L (see GCBO) |
---|
1460 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1461 | % handles structure with handles and user data (see GUIDATA) |
---|
1462 | |
---|
1463 | |
---|
1464 | % --- If Enable == 'on', executes on mouse press in 5 pixel border. |
---|
1465 | % --- Otherwise, executes on mouse press in 5 pixel border or over sliderQP3L. |
---|
1466 | function sliderQP3L_ButtonDownFcn(hObject, eventdata, handles) |
---|
1467 | % hObject handle to sliderQP3L (see GCBO) |
---|
1468 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1469 | % handles structure with handles and user data (see GUIDATA) |
---|
1470 | |
---|
1471 | |
---|
1472 | % --- Executes on key press with focus on sliderQP3L and none of its controls. |
---|
1473 | function sliderQP3L_KeyPressFcn(hObject, eventdata, handles) |
---|
1474 | % hObject handle to sliderQP3L (see GCBO) |
---|
1475 | % eventdata structure with the following fields (see UICONTROL) |
---|
1476 | % Key: name of the key that was pressed, in lower case |
---|
1477 | % Character: character interpretation of the key(s) that was pressed |
---|
1478 | % Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed |
---|
1479 | % handles structure with handles and user data (see GUIDATA) |
---|
1480 | |
---|
1481 | |
---|
1482 | % --- Executes during object deletion, before destroying properties. |
---|
1483 | function sliderQP4L_DeleteFcn(hObject, eventdata, handles) |
---|
1484 | % hObject handle to sliderQP4L (see GCBO) |
---|
1485 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1486 | % handles structure with handles and user data (see GUIDATA) |
---|
1487 | |
---|
1488 | |
---|
1489 | % --- If Enable == 'on', executes on mouse press in 5 pixel border. |
---|
1490 | % --- Otherwise, executes on mouse press in 5 pixel border or over sliderQP4L. |
---|
1491 | function sliderQP4L_ButtonDownFcn(hObject, eventdata, handles) |
---|
1492 | % hObject handle to sliderQP4L (see GCBO) |
---|
1493 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1494 | % handles structure with handles and user data (see GUIDATA) |
---|
1495 | |
---|
1496 | |
---|
1497 | % --- Executes on key press with focus on sliderQP4L and none of its controls. |
---|
1498 | function sliderQP4L_KeyPressFcn(hObject, eventdata, handles) |
---|
1499 | % hObject handle to sliderQP4L (see GCBO) |
---|
1500 | % eventdata structure with the following fields (see UICONTROL) |
---|
1501 | % Key: name of the key that was pressed, in lower case |
---|
1502 | % Character: character interpretation of the key(s) that was pressed |
---|
1503 | % Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed |
---|
1504 | % handles structure with handles and user data (see GUIDATA) |
---|
1505 | |
---|
1506 | |
---|
1507 | % --- Executes during object deletion, before destroying properties. |
---|
1508 | function sliderQP5L_DeleteFcn(hObject, eventdata, handles) |
---|
1509 | % hObject handle to sliderQP5L (see GCBO) |
---|
1510 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1511 | % handles structure with handles and user data (see GUIDATA) |
---|
1512 | |
---|
1513 | |
---|
1514 | % --- If Enable == 'on', executes on mouse press in 5 pixel border. |
---|
1515 | % --- Otherwise, executes on mouse press in 5 pixel border or over sliderQP5L. |
---|
1516 | function sliderQP5L_ButtonDownFcn(hObject, eventdata, handles) |
---|
1517 | % hObject handle to sliderQP5L (see GCBO) |
---|
1518 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1519 | % handles structure with handles and user data (see GUIDATA) |
---|
1520 | |
---|
1521 | |
---|
1522 | % --- Executes on key press with focus on sliderQP5L and none of its controls. |
---|
1523 | function sliderQP5L_KeyPressFcn(hObject, eventdata, handles) |
---|
1524 | % hObject handle to sliderQP5L (see GCBO) |
---|
1525 | % eventdata structure with the following fields (see UICONTROL) |
---|
1526 | % Key: name of the key that was pressed, in lower case |
---|
1527 | % Character: character interpretation of the key(s) that was pressed |
---|
1528 | % Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed |
---|
1529 | % handles structure with handles and user data (see GUIDATA) |
---|
1530 | |
---|
1531 | |
---|
1532 | % --- Executes during object deletion, before destroying properties. |
---|
1533 | function sliderQP6L_DeleteFcn(hObject, eventdata, handles) |
---|
1534 | % hObject handle to sliderQP6L (see GCBO) |
---|
1535 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1536 | % handles structure with handles and user data (see GUIDATA) |
---|
1537 | |
---|
1538 | |
---|
1539 | % --- If Enable == 'on', executes on mouse press in 5 pixel border. |
---|
1540 | % --- Otherwise, executes on mouse press in 5 pixel border or over sliderQP6L. |
---|
1541 | function sliderQP6L_ButtonDownFcn(hObject, eventdata, handles) |
---|
1542 | % hObject handle to sliderQP6L (see GCBO) |
---|
1543 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1544 | % handles structure with handles and user data (see GUIDATA) |
---|
1545 | |
---|
1546 | |
---|
1547 | % --- Executes on key press with focus on sliderQP6L and none of its controls. |
---|
1548 | function sliderQP6L_KeyPressFcn(hObject, eventdata, handles) |
---|
1549 | % hObject handle to sliderQP6L (see GCBO) |
---|
1550 | % eventdata structure with the following fields (see UICONTROL) |
---|
1551 | % Key: name of the key that was pressed, in lower case |
---|
1552 | % Character: character interpretation of the key(s) that was pressed |
---|
1553 | % Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed |
---|
1554 | % handles structure with handles and user data (see GUIDATA) |
---|
1555 | |
---|
1556 | |
---|
1557 | % --- Executes during object deletion, before destroying properties. |
---|
1558 | function sliderQP7L_DeleteFcn(hObject, eventdata, handles) |
---|
1559 | % hObject handle to sliderQP7L (see GCBO) |
---|
1560 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1561 | % handles structure with handles and user data (see GUIDATA) |
---|
1562 | |
---|
1563 | |
---|
1564 | % --- If Enable == 'on', executes on mouse press in 5 pixel border. |
---|
1565 | % --- Otherwise, executes on mouse press in 5 pixel border or over sliderQP7L. |
---|
1566 | function sliderQP7L_ButtonDownFcn(hObject, eventdata, handles) |
---|
1567 | % hObject handle to sliderQP7L (see GCBO) |
---|
1568 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1569 | % handles structure with handles and user data (see GUIDATA) |
---|
1570 | |
---|
1571 | |
---|
1572 | % --- Executes on key press with focus on sliderQP7L and none of its controls. |
---|
1573 | function sliderQP7L_KeyPressFcn(hObject, eventdata, handles) |
---|
1574 | % hObject handle to sliderQP7L (see GCBO) |
---|
1575 | % eventdata structure with the following fields (see UICONTROL) |
---|
1576 | % Key: name of the key that was pressed, in lower case |
---|
1577 | % Character: character interpretation of the key(s) that was pressed |
---|
1578 | % Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed |
---|
1579 | % handles structure with handles and user data (see GUIDATA) |
---|
1580 | |
---|
1581 | |
---|
1582 | % --- Executes during object deletion, before destroying properties. |
---|
1583 | function editQP1L_DeleteFcn(hObject, eventdata, handles) |
---|
1584 | % hObject handle to editQP1L (see GCBO) |
---|
1585 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1586 | % handles structure with handles and user data (see GUIDATA) |
---|
1587 | |
---|
1588 | |
---|
1589 | % --- If Enable == 'on', executes on mouse press in 5 pixel border. |
---|
1590 | % --- Otherwise, executes on mouse press in 5 pixel border or over editQP1L. |
---|
1591 | function editQP1L_ButtonDownFcn(hObject, eventdata, handles) |
---|
1592 | % hObject handle to editQP1L (see GCBO) |
---|
1593 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1594 | % handles structure with handles and user data (see GUIDATA) |
---|
1595 | |
---|
1596 | |
---|
1597 | % --- Executes on key press with focus on editQP1L and none of its controls. |
---|
1598 | function editQP1L_KeyPressFcn(hObject, eventdata, handles) |
---|
1599 | % hObject handle to editQP1L (see GCBO) |
---|
1600 | % eventdata structure with the following fields (see UICONTROL) |
---|
1601 | % Key: name of the key that was pressed, in lower case |
---|
1602 | % Character: character interpretation of the key(s) that was pressed |
---|
1603 | % Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed |
---|
1604 | % handles structure with handles and user data (see GUIDATA) |
---|
1605 | |
---|
1606 | |
---|
1607 | % --- Executes during object deletion, before destroying properties. |
---|
1608 | function editQP2L_DeleteFcn(hObject, eventdata, handles) |
---|
1609 | % hObject handle to editQP2L (see GCBO) |
---|
1610 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1611 | % handles structure with handles and user data (see GUIDATA) |
---|
1612 | |
---|
1613 | |
---|
1614 | % --- If Enable == 'on', executes on mouse press in 5 pixel border. |
---|
1615 | % --- Otherwise, executes on mouse press in 5 pixel border or over editQP2L. |
---|
1616 | function editQP2L_ButtonDownFcn(hObject, eventdata, handles) |
---|
1617 | % hObject handle to editQP2L (see GCBO) |
---|
1618 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1619 | % handles structure with handles and user data (see GUIDATA) |
---|
1620 | |
---|
1621 | |
---|
1622 | % --- Executes on key press with focus on editQP2L and none of its controls. |
---|
1623 | function editQP2L_KeyPressFcn(hObject, eventdata, handles) |
---|
1624 | % hObject handle to editQP2L (see GCBO) |
---|
1625 | % eventdata structure with the following fields (see UICONTROL) |
---|
1626 | % Key: name of the key that was pressed, in lower case |
---|
1627 | % Character: character interpretation of the key(s) that was pressed |
---|
1628 | % Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed |
---|
1629 | % handles structure with handles and user data (see GUIDATA) |
---|
1630 | |
---|
1631 | |
---|
1632 | % --- Executes during object deletion, before destroying properties. |
---|
1633 | function editQP3L_DeleteFcn(hObject, eventdata, handles) |
---|
1634 | % hObject handle to editQP3L (see GCBO) |
---|
1635 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1636 | % handles structure with handles and user data (see GUIDATA) |
---|
1637 | |
---|
1638 | |
---|
1639 | % --- If Enable == 'on', executes on mouse press in 5 pixel border. |
---|
1640 | % --- Otherwise, executes on mouse press in 5 pixel border or over editQP3L. |
---|
1641 | function editQP3L_ButtonDownFcn(hObject, eventdata, handles) |
---|
1642 | % hObject handle to editQP3L (see GCBO) |
---|
1643 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
1644 | % handles structure with handles and user data (see GUIDATA) |
---|
1645 | |
---|
1646 | |
---|
1647 | % --- Executes on key press with focus on editQP3L and none of its controls. |
---|
1648 | function editQP3L_KeyPressFcn(hObject, eventdata, handles) |
---|
1649 | % hObject handle to editQP3L (see GCBO) |
---|
1650 | % eventdata structure with the following fields (see UICONTROL) |
---|
1651 | % Key: name of the key that was pressed, in lower case |
---|
1652 | % Character: character interpretation of the key(s) that was pressed |
---|
1653 | % Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed |
---|
1654 | % handles structure with handles and user data (see GUIDATA) |
---|