1 | function varargout = naffgui(varargin) |
---|
2 | % NAFFGUI M-file for naffgui.fig |
---|
3 | % NAFFGUI, by itself, creates a new NAFFGUI or raises the existing |
---|
4 | % singleton*. |
---|
5 | % |
---|
6 | % H = NAFFGUI returns the handle to a new NAFFGUI or the handle to |
---|
7 | % the existing singleton*. |
---|
8 | % |
---|
9 | % NAFFGUI('CALLBACK',hObject,eventData,handles,...) calls the local |
---|
10 | % function named CALLBACK in NAFFGUI.M with the given input arguments. |
---|
11 | % |
---|
12 | % NAFFGUI('Property','Value',...) creates a new NAFFGUI or raises the |
---|
13 | % existing singleton*. Starting from the left, property value pairs are |
---|
14 | % applied to the GUI before naffgui_OpeningFunction gets called. An |
---|
15 | % unrecognized property name or invalid value makes property application |
---|
16 | % stop. All inputs are passed to naffgui_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 naffgui |
---|
24 | |
---|
25 | % Last Modified by GUIDE v2.5 28-Jan-2012 11:09:40 |
---|
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', @naffgui_OpeningFcn, ... |
---|
32 | 'gui_OutputFcn', @naffgui_OutputFcn, ... |
---|
33 | 'gui_LayoutFcn', [] , ... |
---|
34 | 'gui_Callback', []); |
---|
35 | if nargin & isstr(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 | |
---|
47 | % --- Executes just before naffgui is made visible. |
---|
48 | function naffgui_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 naffgui (see VARARGIN) |
---|
54 | |
---|
55 | % Choose default command line output for naffgui |
---|
56 | handles.output = hObject; |
---|
57 | handles.a = 3; |
---|
58 | handles.b = 1; |
---|
59 | handles.c = 65; |
---|
60 | handles.periodicity = 4; |
---|
61 | handles.order = 4; |
---|
62 | handles.fen=[18 19 10 11]; |
---|
63 | |
---|
64 | reson(handles.order,handles.periodicity,handles.fen); |
---|
65 | set(handles.periodicityvalue,'String',num2str(handles.periodicity)); |
---|
66 | set(handles.ordervalue,'String',num2str(handles.order)); |
---|
67 | set(handles.avalue,'String',num2str(handles.a)); |
---|
68 | set(handles.bvalue,'String',num2str(handles.b)); |
---|
69 | set(handles.cvalue,'String',num2str(handles.c)); |
---|
70 | set(handles.eq1,'String',[num2str(handles.a) ' nux + ' num2str(handles.b) ... |
---|
71 | ' nuz = ' num2str(handles.c)]); |
---|
72 | |
---|
73 | reson(handles.order,handles.periodicity,handles.fen); |
---|
74 | hold on |
---|
75 | reson(3,handles.periodicity,handles.fen); |
---|
76 | reson(5,handles.periodicity,handles.fen); |
---|
77 | reson(7,handles.periodicity,handles.fen); |
---|
78 | axis(handles.fen); |
---|
79 | |
---|
80 | % Update handles structure |
---|
81 | guidata(hObject, handles); |
---|
82 | |
---|
83 | % UIWAIT makes naffgui wait for user response (see UIRESUME) |
---|
84 | % uiwait(handles.main); |
---|
85 | |
---|
86 | |
---|
87 | % --- Outputs from this function are returned to the command line. |
---|
88 | function varargout = naffgui_OutputFcn(hObject, eventdata, handles) |
---|
89 | % varargout cell array for returning output args (see VARARGOUT); |
---|
90 | % hObject handle to figure |
---|
91 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
92 | % handles structure with handles and user data (see GUIDATA) |
---|
93 | |
---|
94 | % Get default command line output from handles structure |
---|
95 | varargout{1} = handles.output; |
---|
96 | |
---|
97 | |
---|
98 | % --- Executes on button press in pushbutton1. |
---|
99 | function pushbutton1_Callback(hObject, eventdata, handles) |
---|
100 | % hObject handle to pushbutton1 (see GCBO) |
---|
101 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
102 | % handles structure with handles and user data (see GUIDATA) |
---|
103 | %% Ferme toutes les fenetres sauf le gui ! |
---|
104 | figs=findobj('Type','Figure'); |
---|
105 | close(figs(figs~=gcbf)); |
---|
106 | |
---|
107 | % --- Executes on button press in pushbutton2. |
---|
108 | function pushbutton2_Callback(hObject, eventdata, handles) |
---|
109 | % hObject handle to pushbutton2 (see GCBO) |
---|
110 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
111 | % handles structure with handles and user data (see GUIDATA) |
---|
112 | plot_fmap('fmap.out') |
---|
113 | % ces 2 autres versions permettent de superposer des résultats TRACY en |
---|
114 | % couleurs et les mesures on-momentum en noir sur la figure(1000) |
---|
115 | % prérequis : fmap.out de TRACY -> fmap_simulation.out |
---|
116 | % fmap.out des mesures -> fmap_mesure.out |
---|
117 | %plot_fmap_version_mat_simulation('fmap_simulation.out') |
---|
118 | %plot_fmap_version_mat_mesure('fmap_mesure.out') |
---|
119 | |
---|
120 | % --- Executes on button press in pushbutton3. |
---|
121 | function pushbutton3_Callback(hObject, eventdata, handles) |
---|
122 | % hObject handle to pushbutton3 (see GCBO) |
---|
123 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
124 | % handles structure with handles and user data (see GUIDATA) |
---|
125 | tracy_plotnudx |
---|
126 | |
---|
127 | % --- Executes on button press in pushbutton_nudp. |
---|
128 | function pushbutton_nudp_Callback(hObject, eventdata, handles) |
---|
129 | % hObject handle to pushbutton_nudp (see GCBO) |
---|
130 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
131 | % handles structure with handles and user data (see GUIDATA) |
---|
132 | plotnudpT |
---|
133 | |
---|
134 | % --- Executes on button press in pushbutton5. |
---|
135 | function pushbutton5_Callback(hObject, eventdata, handles) |
---|
136 | % hObject handle to pushbutton5 (see GCBO) |
---|
137 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
138 | % handles structure with handles and user data (see GUIDATA) |
---|
139 | |
---|
140 | if get(handles.checkbox_tracy3,'Value') == 1 |
---|
141 | plotchamberT('tracy3') |
---|
142 | else |
---|
143 | plotchamberT |
---|
144 | end |
---|
145 | |
---|
146 | |
---|
147 | % --- Executes on button press in pushbutton6. |
---|
148 | function pushbutton6_Callback(hObject, eventdata, handles) |
---|
149 | % hObject handle to pushbutton6 (see GCBO) |
---|
150 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
151 | % handles structure with handles and user data (see GUIDATA) |
---|
152 | plot_fmapdp('fmapdp.out') |
---|
153 | |
---|
154 | % --- Executes during object creation, after setting all properties. |
---|
155 | function cvalue_CreateFcn(hObject, eventdata, handles) |
---|
156 | % hObject handle to cvalue (see GCBO) |
---|
157 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
158 | % handles empty - handles not created until after all CreateFcns called |
---|
159 | |
---|
160 | % Hint: edit controls usually have a white background on Windows. |
---|
161 | % See ISPC and COMPUTER. |
---|
162 | if ispc |
---|
163 | set(hObject,'BackgroundColor','white'); |
---|
164 | else |
---|
165 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
166 | end |
---|
167 | |
---|
168 | |
---|
169 | |
---|
170 | function cvalue_Callback(hObject, eventdata, handles) |
---|
171 | % hObject handle to cvalue (see GCBO) |
---|
172 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
173 | % handles structure with handles and user data (see GUIDATA) |
---|
174 | |
---|
175 | % Hints: get(hObject,'String') returns contents of cvalue as text |
---|
176 | % str2double(get(hObject,'String')) returns contents of cvalue as a double |
---|
177 | |
---|
178 | val = str2double(get(hObject,'String')); |
---|
179 | handles.c = val; |
---|
180 | guidata(hObject, handles); |
---|
181 | set(handles.eq1,'String',[num2str(handles.a) ' nux + ' num2str(handles.b) ... |
---|
182 | ' nuz = ' num2str(handles.c)]); |
---|
183 | plot_reson(handles.a,handles.b,handles.c,handles.fen) |
---|
184 | |
---|
185 | % --- Executes during object creation, after setting all properties. |
---|
186 | function avalue_CreateFcn(hObject, eventdata, handles) |
---|
187 | % hObject handle to avalue (see GCBO) |
---|
188 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
189 | % handles empty - handles not created until after all CreateFcns called |
---|
190 | |
---|
191 | % Hint: edit controls usually have a white background on Windows. |
---|
192 | % See ISPC and COMPUTER. |
---|
193 | if ispc |
---|
194 | set(hObject,'BackgroundColor','white'); |
---|
195 | else |
---|
196 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
197 | end |
---|
198 | |
---|
199 | |
---|
200 | |
---|
201 | function avalue_Callback(hObject, eventdata, handles) |
---|
202 | % hObject handle to avalue (see GCBO) |
---|
203 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
204 | % handles structure with handles and user data (see GUIDATA) |
---|
205 | |
---|
206 | % Hints: get(hObject,'String') returns contents of avalue as text |
---|
207 | % str2double(get(hObject,'String')) returns contents of avalue as a double |
---|
208 | val = str2double(get(hObject,'String')); |
---|
209 | handles.a = val; |
---|
210 | guidata(hObject, handles); |
---|
211 | set(handles.eq1,'String',[num2str(handles.a) ' nux + ' num2str(handles.b) ... |
---|
212 | ' nuz = ' num2str(handles.c)]); |
---|
213 | plot_reson(handles.a,handles.b,handles.c,handles.fen) |
---|
214 | |
---|
215 | |
---|
216 | % --- Executes during object creation, after setting all properties. |
---|
217 | function bvalue_CreateFcn(hObject, eventdata, handles) |
---|
218 | % hObject handle to bvalue (see GCBO) |
---|
219 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
220 | % handles empty - handles not created until after all CreateFcns called |
---|
221 | |
---|
222 | % Hint: edit controls usually have a white background on Windows. |
---|
223 | % See ISPC and COMPUTER. |
---|
224 | if ispc |
---|
225 | set(hObject,'BackgroundColor','white'); |
---|
226 | else |
---|
227 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
228 | end |
---|
229 | |
---|
230 | |
---|
231 | |
---|
232 | function bvalue_Callback(hObject, eventdata, handles) |
---|
233 | % hObject handle to bvalue (see GCBO) |
---|
234 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
235 | % handles structure with handles and user data (see GUIDATA) |
---|
236 | |
---|
237 | % Hints: get(hObject,'String') returns contents of bvalue as text |
---|
238 | % str2double(get(hObject,'String')) returns contents of bvalue as a double |
---|
239 | val = str2double(get(hObject,'String')); |
---|
240 | handles.b = val; |
---|
241 | guidata(hObject, handles); |
---|
242 | set(handles.eq1,'String',[num2str(handles.a) ' nux + ' num2str(handles.b) ... |
---|
243 | ' nuz = ' num2str(handles.c)]); |
---|
244 | plot_reson(handles.a,handles.b,handles.c,handles.fen) |
---|
245 | |
---|
246 | |
---|
247 | % --- Executes during object creation, after setting all properties. |
---|
248 | function periodicityvalue_CreateFcn(hObject, eventdata, handles) |
---|
249 | % hObject handle to periodicityvalue (see GCBO) |
---|
250 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
251 | % handles empty - handles not created until after all CreateFcns called |
---|
252 | |
---|
253 | % Hint: edit controls usually have a white background on Windows. |
---|
254 | % See ISPC and COMPUTER. |
---|
255 | if ispc |
---|
256 | set(hObject,'BackgroundColor','white'); |
---|
257 | else |
---|
258 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
259 | end |
---|
260 | |
---|
261 | |
---|
262 | |
---|
263 | function periodicityvalue_Callback(hObject, eventdata, handles) |
---|
264 | % hObject handle to periodicityvalue (see GCBO) |
---|
265 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
266 | % handles structure with handles and user data (see GUIDATA) |
---|
267 | |
---|
268 | % Hints: get(hObject,'String') returns contents of periodicityvalue as text |
---|
269 | % str2double(get(hObject,'String')) returns contents of periodicityvalue as a double |
---|
270 | val = str2double(get(hObject,'String')); |
---|
271 | handles.periodicity = val; |
---|
272 | guidata(hObject, handles); |
---|
273 | reson(handles.order,handles.periodicity,handles.fen); |
---|
274 | |
---|
275 | |
---|
276 | % --- Executes during object creation, after setting all properties. |
---|
277 | function ordervalue_CreateFcn(hObject, eventdata, handles) |
---|
278 | % hObject handle to ordervalue (see GCBO) |
---|
279 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
280 | % handles empty - handles not created until after all CreateFcns called |
---|
281 | |
---|
282 | % Hint: edit controls usually have a white background on Windows. |
---|
283 | % See ISPC and COMPUTER. |
---|
284 | if ispc |
---|
285 | set(hObject,'BackgroundColor','white'); |
---|
286 | else |
---|
287 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
288 | end |
---|
289 | |
---|
290 | |
---|
291 | |
---|
292 | function ordervalue_Callback(hObject, eventdata, handles) |
---|
293 | % hObject handle to ordervalue (see GCBO) |
---|
294 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
295 | % handles structure with handles and user data (see GUIDATA) |
---|
296 | |
---|
297 | % Hints: get(hObject,'String') returns contents of ordervalue as text |
---|
298 | % str2double(get(hObject,'String')) returns contents of ordervalue as a double |
---|
299 | val = str2double(get(hObject,'String')); |
---|
300 | handles.order = val; |
---|
301 | guidata(hObject, handles); |
---|
302 | reson(handles.order,handles.periodicity,handles.fen); |
---|
303 | |
---|
304 | |
---|
305 | % --- Executes on button press in pushbutton7. |
---|
306 | function pushbutton7_Callback(hObject, eventdata, handles) |
---|
307 | % hObject handle to pushbutton7 (see GCBO) |
---|
308 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
309 | % handles structure with handles and user data (see GUIDATA) |
---|
310 | reson(handles.order,handles.periodicity,handles.fen); |
---|
311 | |
---|
312 | |
---|
313 | % --- Executes on button press in pushbutton8. |
---|
314 | function pushbutton8_Callback(hObject, eventdata, handles) |
---|
315 | % hObject handle to pushbutton8 (see GCBO) |
---|
316 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
317 | % handles structure with handles and user data (see GUIDATA) |
---|
318 | cla |
---|
319 | |
---|
320 | |
---|
321 | % --- Executes on button press in pushbutton10. |
---|
322 | function pushbutton10_Callback(hObject, eventdata, handles) |
---|
323 | % hObject handle to pushbutton10 (see GCBO) |
---|
324 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
325 | % handles structure with handles and user data (see GUIDATA) |
---|
326 | |
---|
327 | |
---|
328 | % --- Executes on button press in pushbutton_touschek. |
---|
329 | function pushbutton_touschek_Callback(hObject, eventdata, handles) |
---|
330 | % hObject handle to pushbutton_touschek (see GCBO) |
---|
331 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
332 | % handles structure with handles and user data (see GUIDATA) |
---|
333 | |
---|
334 | prompt = {... |
---|
335 | 'Tracy output filename', ... |
---|
336 | 'Tracy linear optics ouput filename',... |
---|
337 | 'RMS H-emittance value (nm.rad):', ... |
---|
338 | 'RMS bunch length (mm):', ... |
---|
339 | 'Coupling value:' , ... |
---|
340 | 'Energy value (GeV):', ... |
---|
341 | 'Full Machine (0/1)'}; |
---|
342 | dlg_title = 'Input for Touscheck lifetime computation'; |
---|
343 | num_lines = 1; |
---|
344 | def = {'soleil.out','linlat.out', '3.7E-9', ... |
---|
345 | '6E-3', '1E-2', '2.739', '0'}; |
---|
346 | answer = inputdlg(prompt,dlg_title,num_lines,def); |
---|
347 | |
---|
348 | if ~isempty(answer) |
---|
349 | if strcmp(answer{length(def)}, '1'), |
---|
350 | Type = 'FullMachine'; |
---|
351 | else |
---|
352 | Type = 'SuperPeriode'; |
---|
353 | end |
---|
354 | |
---|
355 | fprintf('Computing ...'); |
---|
356 | [T, Tp, Tn] = Calc_Tous( ... |
---|
357 | answer{1}, answer{2}, ... |
---|
358 | str2double(answer{3}), str2double(answer{4}),... |
---|
359 | str2double(answer{5}), str2double(answer{6}),... |
---|
360 | Type); |
---|
361 | fprintf('Touschek lifetime T=%4.2f h Tp=%4.2f h Tn=%4.2f h\n', T, Tp, Tn); |
---|
362 | end |
---|
363 | |
---|
364 | |
---|
365 | % --- Executes on button press in pushbutton_beta. |
---|
366 | function pushbutton_beta_Callback(hObject, eventdata, handles) |
---|
367 | % hObject handle to pushbutton_beta (see GCBO) |
---|
368 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
369 | % handles structure with handles and user data (see GUIDATA) |
---|
370 | plottwissT; |
---|
371 | |
---|
372 | % --- Executes on button press in pushbutton_dispersion. |
---|
373 | function pushbutton_dispersion_Callback(hObject, eventdata, handles) |
---|
374 | % hObject handle to pushbutton_dispersion (see GCBO) |
---|
375 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
376 | % handles structure with handles and user data (see GUIDATA) |
---|
377 | plot_fmapdp6D('fmapdp.out'); |
---|
378 | |
---|
379 | % --- Executes on button press in pushbutton_twiss. |
---|
380 | function pushbutton_twiss_Callback(hObject, eventdata, handles) |
---|
381 | % hObject handle to pushbutton_twiss (see GCBO) |
---|
382 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
383 | % handles structure with handles and user data (see GUIDATA) |
---|
384 | |
---|
385 | |
---|
386 | % --- Executes on button press in checkbox_tracy3. |
---|
387 | function checkbox_tracy3_Callback(hObject, eventdata, handles) |
---|
388 | % hObject handle to checkbox_tracy3 (see GCBO) |
---|
389 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
390 | % handles structure with handles and user data (see GUIDATA) |
---|
391 | |
---|
392 | % Hint: get(hObject,'Value') returns toggle state of checkbox_tracy3 |
---|