source: MML/trunk/machine/SOLEIL/common/naff/naffutils/naffgui.m @ 4

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

Initial import--MML version from SOLEIL@2013

File size: 14.8 KB
Line 
1function 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
28gui_Singleton = 1;
29gui_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',   []);
35if nargin & isstr(varargin{1})
36    gui_State.gui_Callback = str2func(varargin{1});
37end
38
39if nargout
40    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
41else
42    gui_mainfcn(gui_State, varargin{:});
43end
44% End initialization code - DO NOT EDIT
45
46
47% --- Executes just before naffgui is made visible.
48function 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
56handles.output = hObject;
57handles.a = 3;
58handles.b = 1;
59handles.c = 65;
60handles.periodicity = 4;
61handles.order = 4;
62handles.fen=[18 19 10 11];
63
64reson(handles.order,handles.periodicity,handles.fen);
65set(handles.periodicityvalue,'String',num2str(handles.periodicity));
66set(handles.ordervalue,'String',num2str(handles.order));
67set(handles.avalue,'String',num2str(handles.a));
68set(handles.bvalue,'String',num2str(handles.b));
69set(handles.cvalue,'String',num2str(handles.c));
70set(handles.eq1,'String',[num2str(handles.a) ' nux + ' num2str(handles.b) ...
71        ' nuz = ' num2str(handles.c)]);
72
73reson(handles.order,handles.periodicity,handles.fen);
74hold on
75reson(3,handles.periodicity,handles.fen);
76reson(5,handles.periodicity,handles.fen);
77reson(7,handles.periodicity,handles.fen);
78axis(handles.fen);
79
80% Update handles structure
81guidata(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.
88function 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
95varargout{1} = handles.output;
96
97
98% --- Executes on button press in pushbutton1.
99function 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 !
104figs=findobj('Type','Figure');
105close(figs(figs~=gcbf));
106
107% --- Executes on button press in pushbutton2.
108function 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)
112plot_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.
121function 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)
125tracy_plotnudx
126
127% --- Executes on button press in pushbutton_nudp.
128function 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)
132plotnudpT
133
134% --- Executes on button press in pushbutton5.
135function 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
140if get(handles.checkbox_tracy3,'Value') == 1
141    plotchamberT('tracy3')
142else
143    plotchamberT
144end
145   
146
147% --- Executes on button press in pushbutton6.
148function 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)
152plot_fmapdp('fmapdp.out')
153
154% --- Executes during object creation, after setting all properties.
155function 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.
162if ispc
163    set(hObject,'BackgroundColor','white');
164else
165    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
166end
167
168
169
170function 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
178val = str2double(get(hObject,'String'));
179handles.c = val;
180guidata(hObject, handles);
181set(handles.eq1,'String',[num2str(handles.a) ' nux + ' num2str(handles.b) ...
182        ' nuz = ' num2str(handles.c)]);
183plot_reson(handles.a,handles.b,handles.c,handles.fen)
184
185% --- Executes during object creation, after setting all properties.
186function 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.
193if ispc
194    set(hObject,'BackgroundColor','white');
195else
196    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
197end
198
199
200
201function 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
208val = str2double(get(hObject,'String'));
209handles.a = val;
210guidata(hObject, handles);
211set(handles.eq1,'String',[num2str(handles.a) ' nux + ' num2str(handles.b) ...
212        ' nuz = ' num2str(handles.c)]);
213plot_reson(handles.a,handles.b,handles.c,handles.fen)
214
215
216% --- Executes during object creation, after setting all properties.
217function 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.
224if ispc
225    set(hObject,'BackgroundColor','white');
226else
227    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
228end
229
230
231
232function 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
239val = str2double(get(hObject,'String'));
240handles.b = val;
241guidata(hObject, handles);
242set(handles.eq1,'String',[num2str(handles.a) ' nux + ' num2str(handles.b) ...
243        ' nuz = ' num2str(handles.c)]);
244plot_reson(handles.a,handles.b,handles.c,handles.fen)
245
246
247% --- Executes during object creation, after setting all properties.
248function 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.
255if ispc
256    set(hObject,'BackgroundColor','white');
257else
258    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
259end
260
261
262
263function 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
270val = str2double(get(hObject,'String'));
271handles.periodicity = val;
272guidata(hObject, handles);
273reson(handles.order,handles.periodicity,handles.fen);
274
275
276% --- Executes during object creation, after setting all properties.
277function 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.
284if ispc
285    set(hObject,'BackgroundColor','white');
286else
287    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
288end
289
290
291
292function 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
299val = str2double(get(hObject,'String'));
300handles.order = val;
301guidata(hObject, handles);
302reson(handles.order,handles.periodicity,handles.fen);
303
304
305% --- Executes on button press in pushbutton7.
306function 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)
310reson(handles.order,handles.periodicity,handles.fen);
311
312
313% --- Executes on button press in pushbutton8.
314function 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)
318cla
319
320
321% --- Executes on button press in pushbutton10.
322function 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.
329function 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
334prompt = {...
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)'};
342dlg_title = 'Input for Touscheck lifetime computation';
343num_lines = 1;
344def = {'soleil.out','linlat.out', '3.7E-9', ...
345    '6E-3', '1E-2',  '2.739', '0'};
346answer = inputdlg(prompt,dlg_title,num_lines,def);
347
348if ~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);
362end
363
364
365% --- Executes on button press in pushbutton_beta.
366function 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)
370plottwissT;
371
372% --- Executes on button press in pushbutton_dispersion.
373function 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)
377plot_fmapdp6D('fmapdp.out');
378
379% --- Executes on button press in pushbutton_twiss.
380function 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.
387function 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
Note: See TracBrowser for help on using the repository browser.