source: MML/trunk/machine/SOLEIL/StorageRing/diagnostics/sniffer_interface.m @ 4

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

Initial import--MML version from SOLEIL@2013

File size: 56.4 KB
Line 
1function varargout = sniffer_interface(varargin)
2% SNIFFER_INTERFACE M-file for sniffer_interface.fig
3%      SNIFFER_INTERFACE, by itself, creates a new SNIFFER_INTERFACE or raises the existing
4%      singleton*.
5%
6%      H = SNIFFER_INTERFACE returns the handle to a new SNIFFER_INTERFACE or the handle to
7%      the existing singleton*.
8%
9%      SNIFFER_INTERFACE('CALLBACK',hObject,eventData,handles,...) calls the local
10%      function named CALLBACK in SNIFFER_INTERFACE.M with the given input arguments.
11%
12%      SNIFFER_INTERFACE('Property','Value',...) creates a new SNIFFER_INTERFACE or raises the
13%      existing singleton*.  Starting from the left, property value pairs are
14%      applied to the GUI before sniffer_interface_OpeningFunction gets called.  An
15%      unrecognized property name or invalid value makes property application
16%      stop.  All inputs are passed to sniffer_interface_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 sniffer_interface
24
25% Last Modified by GUIDE v2.5 29-Sep-2008 14:38:57
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', @sniffer_interface_OpeningFcn, ...
32                   'gui_OutputFcn',  @sniffer_interface_OutputFcn, ...
33                   'gui_LayoutFcn',  [] , ...
34                   'gui_Callback',   []);
35if nargin && ischar(varargin{1})
36    gui_State.gui_Callback = str2func(varargin{1});
37end
38
39if nargout
40    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
41else
42    gui_mainfcn(gui_State, varargin{:});
43end
44% End initialization code - DO NOT EDIT
45
46
47% --- Executes just before sniffer_interface is made visible.
48function sniffer_interface_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 sniffer_interface (see VARARGIN)
54
55% Choose default command line output for sniffer_interface
56handles.output = hObject;
57global continuous;
58continuous=0;
59dev='ANS/DG/fofb-sniffer.1';
60tango_set_timeout(dev,10000)
61% Update handles structure
62guidata(hObject, handles);
63
64% UIWAIT makes sniffer_interface wait for user response (see UIRESUME)
65% uiwait(handles.figure1);
66
67
68% --- Outputs from this function are returned to the command line.
69function varargout = sniffer_interface_OutputFcn(hObject, eventdata, handles)
70% varargout  cell array for returning output args (see VARARGOUT);
71% hObject    handle to figure
72% eventdata  reserved - to be defined in a future version of MATLAB
73% handles    structure with handles and user data (see GUIDATA)
74
75% Get default command line output from handles structure
76varargout{1} = handles.output;
77
78
79
80function selection_Callback(hObject, eventdata, handles)
81% hObject    handle to selection (see GCBO)
82% eventdata  reserved - to be defined in a future version of MATLAB
83% handles    structure with handles and user data (see GUIDATA)
84
85% Hints: get(hObject,'String') returns contents of selection as text
86%        str2double(get(hObject,'String')) returns contents of selection as a double
87
88
89% --- Executes during object creation, after setting all properties.
90function selection_CreateFcn(hObject, eventdata, handles)
91% hObject    handle to selection (see GCBO)
92% eventdata  reserved - to be defined in a future version of MATLAB
93% handles    empty - handles not created until after all CreateFcns called
94
95% Hint: edit controls usually have a white background on Windows.
96%       See ISPC and COMPUTER.
97if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
98    set(hObject,'BackgroundColor','white');
99end
100
101
102% --- Executes on button press in RX_link_up_1.
103function RX_link_up_1_Callback(hObject, eventdata, handles)
104% hObject    handle to RX_link_up_1 (see GCBO)
105% eventdata  reserved - to be defined in a future version of MATLAB
106% handles    structure with handles and user data (see GUIDATA)
107
108% Hint: get(hObject,'Value') returns toggle state of RX_link_up_1
109
110
111% --- Executes on button press in RX_link_up_2.
112function RX_link_up_2_Callback(hObject, eventdata, handles)
113% hObject    handle to RX_link_up_2 (see GCBO)
114% eventdata  reserved - to be defined in a future version of MATLAB
115% handles    structure with handles and user data (see GUIDATA)
116
117% Hint: get(hObject,'Value') returns toggle state of RX_link_up_2
118
119
120% --- Executes on button press in TX_link_up_1.
121function TX_link_up_1_Callback(hObject, eventdata, handles)
122% hObject    handle to TX_link_up_1 (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
126% Hint: get(hObject,'Value') returns toggle state of TX_link_up_1
127
128
129% --- Executes on button press in TX_link_up_2.
130function TX_link_up_2_Callback(hObject, eventdata, handles)
131% hObject    handle to TX_link_up_2 (see GCBO)
132% eventdata  reserved - to be defined in a future version of MATLAB
133% handles    structure with handles and user data (see GUIDATA)
134
135% Hint: get(hObject,'Value') returns toggle state of TX_link_up_2
136
137
138
139function sniffer_firmware_Callback(hObject, eventdata, handles)
140% hObject    handle to sniffer_firmware (see GCBO)
141% eventdata  reserved - to be defined in a future version of MATLAB
142% handles    structure with handles and user data (see GUIDATA)
143
144% Hints: get(hObject,'String') returns contents of sniffer_firmware as text
145%        str2double(get(hObject,'String')) returns contents of sniffer_firmware as a double
146
147
148% --- Executes during object creation, after setting all properties.
149function sniffer_firmware_CreateFcn(hObject, eventdata, handles)
150% hObject    handle to sniffer_firmware (see GCBO)
151% eventdata  reserved - to be defined in a future version of MATLAB
152% handles    empty - handles not created until after all CreateFcns called
153
154% Hint: edit controls usually have a white background on Windows.
155%       See ISPC and COMPUTER.
156if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
157    set(hObject,'BackgroundColor','white');
158end
159
160
161
162function CC_firmware_Callback(hObject, eventdata, handles)
163% hObject    handle to CC_firmware (see GCBO)
164% eventdata  reserved - to be defined in a future version of MATLAB
165% handles    structure with handles and user data (see GUIDATA)
166
167% Hints: get(hObject,'String') returns contents of CC_firmware as text
168%        str2double(get(hObject,'String')) returns contents of CC_firmware as a double
169
170
171% --- Executes during object creation, after setting all properties.
172function CC_firmware_CreateFcn(hObject, eventdata, handles)
173% hObject    handle to CC_firmware (see GCBO)
174% eventdata  reserved - to be defined in a future version of MATLAB
175% handles    empty - handles not created until after all CreateFcns called
176
177% Hint: edit controls usually have a white background on Windows.
178%       See ISPC and COMPUTER.
179if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
180    set(hObject,'BackgroundColor','white');
181end
182
183
184
185function link_partner_2_Callback(hObject, eventdata, handles)
186% hObject    handle to link_partner_2 (see GCBO)
187% eventdata  reserved - to be defined in a future version of MATLAB
188% handles    structure with handles and user data (see GUIDATA)
189
190% Hints: get(hObject,'String') returns contents of link_partner_2 as text
191%        str2double(get(hObject,'String')) returns contents of link_partner_2 as a double
192
193
194% --- Executes during object creation, after setting all properties.
195function link_partner_2_CreateFcn(hObject, eventdata, handles)
196% hObject    handle to link_partner_2 (see GCBO)
197% eventdata  reserved - to be defined in a future version of MATLAB
198% handles    empty - handles not created until after all CreateFcns called
199
200% Hint: edit controls usually have a white background on Windows.
201%       See ISPC and COMPUTER.
202if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
203    set(hObject,'BackgroundColor','white');
204end
205
206
207
208function edit6_Callback(hObject, eventdata, handles)
209% hObject    handle to edit6 (see GCBO)
210% eventdata  reserved - to be defined in a future version of MATLAB
211% handles    structure with handles and user data (see GUIDATA)
212
213% Hints: get(hObject,'String') returns contents of edit6 as text
214%        str2double(get(hObject,'String')) returns contents of edit6 as a double
215
216
217% --- Executes during object creation, after setting all properties.
218function edit6_CreateFcn(hObject, eventdata, handles)
219% hObject    handle to edit6 (see GCBO)
220% eventdata  reserved - to be defined in a future version of MATLAB
221% handles    empty - handles not created until after all CreateFcns called
222
223% Hint: edit controls usually have a white background on Windows.
224%       See ISPC and COMPUTER.
225if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
226    set(hObject,'BackgroundColor','white');
227end
228
229
230
231function RX_count_2_Callback(hObject, eventdata, handles)
232% hObject    handle to RX_count_2 (see GCBO)
233% eventdata  reserved - to be defined in a future version of MATLAB
234% handles    structure with handles and user data (see GUIDATA)
235
236% Hints: get(hObject,'String') returns contents of RX_count_2 as text
237%        str2double(get(hObject,'String')) returns contents of RX_count_2 as a double
238
239
240% --- Executes during object creation, after setting all properties.
241function RX_count_2_CreateFcn(hObject, eventdata, handles)
242% hObject    handle to RX_count_2 (see GCBO)
243% eventdata  reserved - to be defined in a future version of MATLAB
244% handles    empty - handles not created until after all CreateFcns called
245
246% Hint: edit controls usually have a white background on Windows.
247%       See ISPC and COMPUTER.
248if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
249    set(hObject,'BackgroundColor','white');
250end
251
252
253
254function RX_count_1_Callback(hObject, eventdata, handles)
255% hObject    handle to RX_count_1 (see GCBO)
256% eventdata  reserved - to be defined in a future version of MATLAB
257% handles    structure with handles and user data (see GUIDATA)
258
259% Hints: get(hObject,'String') returns contents of RX_count_1 as text
260%        str2double(get(hObject,'String')) returns contents of RX_count_1 as a double
261
262
263% --- Executes during object creation, after setting all properties.
264function RX_count_1_CreateFcn(hObject, eventdata, handles)
265% hObject    handle to RX_count_1 (see GCBO)
266% eventdata  reserved - to be defined in a future version of MATLAB
267% handles    empty - handles not created until after all CreateFcns called
268
269% Hint: edit controls usually have a white background on Windows.
270%       See ISPC and COMPUTER.
271if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
272    set(hObject,'BackgroundColor','white');
273end
274
275
276
277function TX_count_2_Callback(hObject, eventdata, handles)
278% hObject    handle to TX_count_2 (see GCBO)
279% eventdata  reserved - to be defined in a future version of MATLAB
280% handles    structure with handles and user data (see GUIDATA)
281
282% Hints: get(hObject,'String') returns contents of TX_count_2 as text
283%        str2double(get(hObject,'String')) returns contents of TX_count_2 as a double
284
285
286% --- Executes during object creation, after setting all properties.
287function TX_count_2_CreateFcn(hObject, eventdata, handles)
288% hObject    handle to TX_count_2 (see GCBO)
289% eventdata  reserved - to be defined in a future version of MATLAB
290% handles    empty - handles not created until after all CreateFcns called
291
292% Hint: edit controls usually have a white background on Windows.
293%       See ISPC and COMPUTER.
294if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
295    set(hObject,'BackgroundColor','white');
296end
297
298
299
300function TX_count_1_Callback(hObject, eventdata, handles)
301% hObject    handle to TX_count_1 (see GCBO)
302% eventdata  reserved - to be defined in a future version of MATLAB
303% handles    structure with handles and user data (see GUIDATA)
304
305% Hints: get(hObject,'String') returns contents of TX_count_1 as text
306%        str2double(get(hObject,'String')) returns contents of TX_count_1 as a double
307
308
309% --- Executes during object creation, after setting all properties.
310function TX_count_1_CreateFcn(hObject, eventdata, handles)
311% hObject    handle to TX_count_1 (see GCBO)
312% eventdata  reserved - to be defined in a future version of MATLAB
313% handles    empty - handles not created until after all CreateFcns called
314
315% Hint: edit controls usually have a white background on Windows.
316%       See ISPC and COMPUTER.
317if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
318    set(hObject,'BackgroundColor','white');
319end
320
321
322
323function hard_err_cnt_2_Callback(hObject, eventdata, handles)
324% hObject    handle to hard_err_cnt_2 (see GCBO)
325% eventdata  reserved - to be defined in a future version of MATLAB
326% handles    structure with handles and user data (see GUIDATA)
327
328% Hints: get(hObject,'String') returns contents of hard_err_cnt_2 as text
329%        str2double(get(hObject,'String')) returns contents of hard_err_cnt_2 as a double
330
331
332% --- Executes during object creation, after setting all properties.
333function hard_err_cnt_2_CreateFcn(hObject, eventdata, handles)
334% hObject    handle to hard_err_cnt_2 (see GCBO)
335% eventdata  reserved - to be defined in a future version of MATLAB
336% handles    empty - handles not created until after all CreateFcns called
337
338% Hint: edit controls usually have a white background on Windows.
339%       See ISPC and COMPUTER.
340if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
341    set(hObject,'BackgroundColor','white');
342end
343
344
345
346function hard_err_cnt_1_Callback(hObject, eventdata, handles)
347% hObject    handle to hard_err_cnt_1 (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,'String') returns contents of hard_err_cnt_1 as text
352%        str2double(get(hObject,'String')) returns contents of hard_err_cnt_1 as a double
353
354
355% --- Executes during object creation, after setting all properties.
356function hard_err_cnt_1_CreateFcn(hObject, eventdata, handles)
357% hObject    handle to hard_err_cnt_1 (see GCBO)
358% eventdata  reserved - to be defined in a future version of MATLAB
359% handles    empty - handles not created until after all CreateFcns called
360
361% Hint: edit controls usually have a white background on Windows.
362%       See ISPC and COMPUTER.
363if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
364    set(hObject,'BackgroundColor','white');
365end
366
367
368
369function soft_err_cnt_2_Callback(hObject, eventdata, handles)
370% hObject    handle to soft_err_cnt_2 (see GCBO)
371% eventdata  reserved - to be defined in a future version of MATLAB
372% handles    structure with handles and user data (see GUIDATA)
373
374% Hints: get(hObject,'String') returns contents of soft_err_cnt_2 as text
375%        str2double(get(hObject,'String')) returns contents of soft_err_cnt_2 as a double
376
377
378% --- Executes during object creation, after setting all properties.
379function soft_err_cnt_2_CreateFcn(hObject, eventdata, handles)
380% hObject    handle to soft_err_cnt_2 (see GCBO)
381% eventdata  reserved - to be defined in a future version of MATLAB
382% handles    empty - handles not created until after all CreateFcns called
383
384% Hint: edit controls usually have a white background on Windows.
385%       See ISPC and COMPUTER.
386if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
387    set(hObject,'BackgroundColor','white');
388end
389
390
391
392function soft_err_cnt_1_Callback(hObject, eventdata, handles)
393% hObject    handle to soft_err_cnt_1 (see GCBO)
394% eventdata  reserved - to be defined in a future version of MATLAB
395% handles    structure with handles and user data (see GUIDATA)
396
397% Hints: get(hObject,'String') returns contents of soft_err_cnt_1 as text
398%        str2double(get(hObject,'String')) returns contents of soft_err_cnt_1 as a double
399
400
401% --- Executes during object creation, after setting all properties.
402function soft_err_cnt_1_CreateFcn(hObject, eventdata, handles)
403% hObject    handle to soft_err_cnt_1 (see GCBO)
404% eventdata  reserved - to be defined in a future version of MATLAB
405% handles    empty - handles not created until after all CreateFcns called
406
407% Hint: edit controls usually have a white background on Windows.
408%       See ISPC and COMPUTER.
409if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
410    set(hObject,'BackgroundColor','white');
411end
412
413
414
415function frame_err_cnt_2_Callback(hObject, eventdata, handles)
416% hObject    handle to frame_err_cnt_2 (see GCBO)
417% eventdata  reserved - to be defined in a future version of MATLAB
418% handles    structure with handles and user data (see GUIDATA)
419
420% Hints: get(hObject,'String') returns contents of frame_err_cnt_2 as text
421%        str2double(get(hObject,'String')) returns contents of frame_err_cnt_2 as a double
422
423
424% --- Executes during object creation, after setting all properties.
425function frame_err_cnt_2_CreateFcn(hObject, eventdata, handles)
426% hObject    handle to frame_err_cnt_2 (see GCBO)
427% eventdata  reserved - to be defined in a future version of MATLAB
428% handles    empty - handles not created until after all CreateFcns called
429
430% Hint: edit controls usually have a white background on Windows.
431%       See ISPC and COMPUTER.
432if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
433    set(hObject,'BackgroundColor','white');
434end
435
436
437
438function frame_err_cnt_1_Callback(hObject, eventdata, handles)
439% hObject    handle to frame_err_cnt_1 (see GCBO)
440% eventdata  reserved - to be defined in a future version of MATLAB
441% handles    structure with handles and user data (see GUIDATA)
442
443% Hints: get(hObject,'String') returns contents of frame_err_cnt_1 as text
444%        str2double(get(hObject,'String')) returns contents of frame_err_cnt_1 as a double
445
446
447% --- Executes during object creation, after setting all properties.
448function frame_err_cnt_1_CreateFcn(hObject, eventdata, handles)
449% hObject    handle to frame_err_cnt_1 (see GCBO)
450% eventdata  reserved - to be defined in a future version of MATLAB
451% handles    empty - handles not created until after all CreateFcns called
452
453% Hint: edit controls usually have a white background on Windows.
454%       See ISPC and COMPUTER.
455if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
456    set(hObject,'BackgroundColor','white');
457end
458
459
460
461function edit17_Callback(hObject, eventdata, handles)
462% hObject    handle to edit17 (see GCBO)
463% eventdata  reserved - to be defined in a future version of MATLAB
464% handles    structure with handles and user data (see GUIDATA)
465
466% Hints: get(hObject,'String') returns contents of edit17 as text
467%        str2double(get(hObject,'String')) returns contents of edit17 as a double
468
469
470% --- Executes during object creation, after setting all properties.
471function edit17_CreateFcn(hObject, eventdata, handles)
472% hObject    handle to edit17 (see GCBO)
473% eventdata  reserved - to be defined in a future version of MATLAB
474% handles    empty - handles not created until after all CreateFcns called
475
476% Hint: edit controls usually have a white background on Windows.
477%       See ISPC and COMPUTER.
478if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
479    set(hObject,'BackgroundColor','white');
480end
481
482
483
484function CC_process_time_Callback(hObject, eventdata, handles)
485% hObject    handle to CC_process_time (see GCBO)
486% eventdata  reserved - to be defined in a future version of MATLAB
487% handles    structure with handles and user data (see GUIDATA)
488
489% Hints: get(hObject,'String') returns contents of CC_process_time as text
490%        str2double(get(hObject,'String')) returns contents of CC_process_time as a double
491
492
493% --- Executes during object creation, after setting all properties.
494function CC_process_time_CreateFcn(hObject, eventdata, handles)
495% hObject    handle to CC_process_time (see GCBO)
496% eventdata  reserved - to be defined in a future version of MATLAB
497% handles    empty - handles not created until after all CreateFcns called
498
499% Hint: edit controls usually have a white background on Windows.
500%       See ISPC and COMPUTER.
501if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
502    set(hObject,'BackgroundColor','white');
503end
504
505
506
507function bpm_involved_Callback(hObject, eventdata, handles)
508% hObject    handle to bpm_involved (see GCBO)
509% eventdata  reserved - to be defined in a future version of MATLAB
510% handles    structure with handles and user data (see GUIDATA)
511
512% Hints: get(hObject,'String') returns contents of bpm_involved as text
513%        str2double(get(hObject,'String')) returns contents of bpm_involved as a double
514
515
516% --- Executes during object creation, after setting all properties.
517function bpm_involved_CreateFcn(hObject, eventdata, handles)
518% hObject    handle to bpm_involved (see GCBO)
519% eventdata  reserved - to be defined in a future version of MATLAB
520% handles    empty - handles not created until after all CreateFcns called
521
522% Hint: edit controls usually have a white background on Windows.
523%       See ISPC and COMPUTER.
524if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
525    set(hObject,'BackgroundColor','white');
526end
527
528
529% --- Executes on button press in rd_fifo_full.
530function rd_fifo_full_Callback(hObject, eventdata, handles)
531% hObject    handle to rd_fifo_full (see GCBO)
532% eventdata  reserved - to be defined in a future version of MATLAB
533% handles    structure with handles and user data (see GUIDATA)
534
535% Hint: get(hObject,'Value') returns toggle state of rd_fifo_full
536
537
538% --- Executes on button press in rd_fifo_empty.
539function rd_fifo_empty_Callback(hObject, eventdata, handles)
540% hObject    handle to rd_fifo_empty (see GCBO)
541% eventdata  reserved - to be defined in a future version of MATLAB
542% handles    structure with handles and user data (see GUIDATA)
543
544% Hint: get(hObject,'Value') returns toggle state of rd_fifo_empty
545
546
547% --- Executes on button press in wt_fifo_full.
548function wt_fifo_full_Callback(hObject, eventdata, handles)
549% hObject    handle to wt_fifo_full (see GCBO)
550% eventdata  reserved - to be defined in a future version of MATLAB
551% handles    structure with handles and user data (see GUIDATA)
552
553% Hint: get(hObject,'Value') returns toggle state of wt_fifo_full
554
555
556% --- Executes on button press in wt_fifo_empty.
557function wt_fifo_empty_Callback(hObject, eventdata, handles)
558% hObject    handle to wt_fifo_empty (see GCBO)
559% eventdata  reserved - to be defined in a future version of MATLAB
560% handles    structure with handles and user data (see GUIDATA)
561
562% Hint: get(hObject,'Value') returns toggle state of wt_fifo_empty
563
564
565
566function rd_fifo_data_cnt_Callback(hObject, eventdata, handles)
567% hObject    handle to rd_fifo_data_cnt (see GCBO)
568% eventdata  reserved - to be defined in a future version of MATLAB
569% handles    structure with handles and user data (see GUIDATA)
570
571% Hints: get(hObject,'String') returns contents of rd_fifo_data_cnt as text
572%        str2double(get(hObject,'String')) returns contents of rd_fifo_data_cnt as a double
573
574
575% --- Executes during object creation, after setting all properties.
576function rd_fifo_data_cnt_CreateFcn(hObject, eventdata, handles)
577% hObject    handle to rd_fifo_data_cnt (see GCBO)
578% eventdata  reserved - to be defined in a future version of MATLAB
579% handles    empty - handles not created until after all CreateFcns called
580
581% Hint: edit controls usually have a white background on Windows.
582%       See ISPC and COMPUTER.
583if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
584    set(hObject,'BackgroundColor','white');
585end
586
587
588
589function sniffer_id_Callback(hObject, eventdata, handles)
590% hObject    handle to sniffer_id (see GCBO)
591% eventdata  reserved - to be defined in a future version of MATLAB
592% handles    structure with handles and user data (see GUIDATA)
593
594% Hints: get(hObject,'String') returns contents of sniffer_id as text
595%        str2double(get(hObject,'String')) returns contents of sniffer_id as a double
596
597
598% --- Executes during object creation, after setting all properties.
599function sniffer_id_CreateFcn(hObject, eventdata, handles)
600% hObject    handle to sniffer_id (see GCBO)
601% eventdata  reserved - to be defined in a future version of MATLAB
602% handles    empty - handles not created until after all CreateFcns called
603
604% Hint: edit controls usually have a white background on Windows.
605%       See ISPC and COMPUTER.
606if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
607    set(hObject,'BackgroundColor','white');
608end
609
610
611
612function time_frame_lenght_Callback(hObject, eventdata, handles)
613% hObject    handle to time_frame_lenght (see GCBO)
614% eventdata  reserved - to be defined in a future version of MATLAB
615% handles    structure with handles and user data (see GUIDATA)
616
617% Hints: get(hObject,'String') returns contents of time_frame_lenght as text
618%        str2double(get(hObject,'String')) returns contents of time_frame_lenght as a double
619
620
621% --- Executes during object creation, after setting all properties.
622function time_frame_lenght_CreateFcn(hObject, eventdata, handles)
623% hObject    handle to time_frame_lenght (see GCBO)
624% eventdata  reserved - to be defined in a future version of MATLAB
625% handles    empty - handles not created until after all CreateFcns called
626
627% Hint: edit controls usually have a white background on Windows.
628%       See ISPC and COMPUTER.
629if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
630    set(hObject,'BackgroundColor','white');
631end
632
633
634
635function mgt_powerdown_Callback(hObject, eventdata, handles)
636% hObject    handle to mgt_powerdown (see GCBO)
637% eventdata  reserved - to be defined in a future version of MATLAB
638% handles    structure with handles and user data (see GUIDATA)
639
640% Hints: get(hObject,'String') returns contents of mgt_powerdown as text
641%        str2double(get(hObject,'String')) returns contents of mgt_powerdown as a double
642
643
644% --- Executes during object creation, after setting all properties.
645function mgt_powerdown_CreateFcn(hObject, eventdata, handles)
646% hObject    handle to mgt_powerdown (see GCBO)
647% eventdata  reserved - to be defined in a future version of MATLAB
648% handles    empty - handles not created until after all CreateFcns called
649
650% Hint: edit controls usually have a white background on Windows.
651%       See ISPC and COMPUTER.
652if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
653    set(hObject,'BackgroundColor','white');
654end
655
656
657
658function mgt_loopback_Callback(hObject, eventdata, handles)
659% hObject    handle to mgt_loopback (see GCBO)
660% eventdata  reserved - to be defined in a future version of MATLAB
661% handles    structure with handles and user data (see GUIDATA)
662
663% Hints: get(hObject,'String') returns contents of mgt_loopback as text
664%        str2double(get(hObject,'String')) returns contents of mgt_loopback as a double
665
666
667% --- Executes during object creation, after setting all properties.
668function mgt_loopback_CreateFcn(hObject, eventdata, handles)
669% hObject    handle to mgt_loopback (see GCBO)
670% eventdata  reserved - to be defined in a future version of MATLAB
671% handles    empty - handles not created until after all CreateFcns called
672
673% Hint: edit controls usually have a white background on Windows.
674%       See ISPC and COMPUTER.
675if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
676    set(hObject,'BackgroundColor','white');
677end
678
679
680
681function buf_clr_dly_Callback(hObject, eventdata, handles)
682% hObject    handle to buf_clr_dly (see GCBO)
683% eventdata  reserved - to be defined in a future version of MATLAB
684% handles    structure with handles and user data (see GUIDATA)
685
686% Hints: get(hObject,'String') returns contents of buf_clr_dly as text
687%        str2double(get(hObject,'String')) returns contents of buf_clr_dly as a double
688
689
690% --- Executes during object creation, after setting all properties.
691function buf_clr_dly_CreateFcn(hObject, eventdata, handles)
692% hObject    handle to buf_clr_dly (see GCBO)
693% eventdata  reserved - to be defined in a future version of MATLAB
694% handles    empty - handles not created until after all CreateFcns called
695
696% Hint: edit controls usually have a white background on Windows.
697%       See ISPC and COMPUTER.
698if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
699    set(hObject,'BackgroundColor','white');
700end
701
702
703
704function data_rate_Callback(hObject, eventdata, handles)
705% hObject    handle to data_rate (see GCBO)
706% eventdata  reserved - to be defined in a future version of MATLAB
707% handles    structure with handles and user data (see GUIDATA)
708
709% Hints: get(hObject,'String') returns contents of data_rate as text
710%        str2double(get(hObject,'String')) returns contents of data_rate as a double
711
712
713% --- Executes during object creation, after setting all properties.
714function data_rate_CreateFcn(hObject, eventdata, handles)
715% hObject    handle to data_rate (see GCBO)
716% eventdata  reserved - to be defined in a future version of MATLAB
717% handles    empty - handles not created until after all CreateFcns called
718
719% Hint: edit controls usually have a white background on Windows.
720%       See ISPC and COMPUTER.
721if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
722    set(hObject,'BackgroundColor','white');
723end
724
725
726
727function lost_frames_Callback(hObject, eventdata, handles)
728% hObject    handle to lost_frames (see GCBO)
729% eventdata  reserved - to be defined in a future version of MATLAB
730% handles    structure with handles and user data (see GUIDATA)
731
732% Hints: get(hObject,'String') returns contents of lost_frames as text
733%        str2double(get(hObject,'String')) returns contents of lost_frames as a double
734
735
736% --- Executes during object creation, after setting all properties.
737function lost_frames_CreateFcn(hObject, eventdata, handles)
738% hObject    handle to lost_frames (see GCBO)
739% eventdata  reserved - to be defined in a future version of MATLAB
740% handles    empty - handles not created until after all CreateFcns called
741
742% Hint: edit controls usually have a white background on Windows.
743%       See ISPC and COMPUTER.
744if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
745    set(hObject,'BackgroundColor','white');
746end
747
748
749
750function fifo_overruns_Callback(hObject, eventdata, handles)
751% hObject    handle to fifo_overruns (see GCBO)
752% eventdata  reserved - to be defined in a future version of MATLAB
753% handles    structure with handles and user data (see GUIDATA)
754
755% Hints: get(hObject,'String') returns contents of fifo_overruns as text
756%        str2double(get(hObject,'String')) returns contents of fifo_overruns as a double
757
758
759% --- Executes during object creation, after setting all properties.
760function fifo_overruns_CreateFcn(hObject, eventdata, handles)
761% hObject    handle to fifo_overruns (see GCBO)
762% eventdata  reserved - to be defined in a future version of MATLAB
763% handles    empty - handles not created until after all CreateFcns called
764
765% Hint: edit controls usually have a white background on Windows.
766%       See ISPC and COMPUTER.
767if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
768    set(hObject,'BackgroundColor','white');
769end
770
771
772
773function frame_offset_in_DMA_Callback(hObject, eventdata, handles)
774% hObject    handle to frame_offset_in_DMA (see GCBO)
775% eventdata  reserved - to be defined in a future version of MATLAB
776% handles    structure with handles and user data (see GUIDATA)
777
778% Hints: get(hObject,'String') returns contents of frame_offset_in_DMA as text
779%        str2double(get(hObject,'String')) returns contents of frame_offset_in_DMA as a double
780
781
782% --- Executes during object creation, after setting all properties.
783function frame_offset_in_DMA_CreateFcn(hObject, eventdata, handles)
784% hObject    handle to frame_offset_in_DMA (see GCBO)
785% eventdata  reserved - to be defined in a future version of MATLAB
786% handles    empty - handles not created until after all CreateFcns called
787
788% Hint: edit controls usually have a white background on Windows.
789%       See ISPC and COMPUTER.
790if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
791    set(hObject,'BackgroundColor','white');
792end
793
794
795
796function frame_offset_between_DMA_Callback(hObject, eventdata, handles)
797% hObject    handle to frame_offset_between_DMA (see GCBO)
798% eventdata  reserved - to be defined in a future version of MATLAB
799% handles    structure with handles and user data (see GUIDATA)
800
801% Hints: get(hObject,'String') returns contents of frame_offset_between_DMA as text
802%        str2double(get(hObject,'String')) returns contents of frame_offset_between_DMA as a double
803
804
805% --- Executes during object creation, after setting all properties.
806function frame_offset_between_DMA_CreateFcn(hObject, eventdata, handles)
807% hObject    handle to frame_offset_between_DMA (see GCBO)
808% eventdata  reserved - to be defined in a future version of MATLAB
809% handles    empty - handles not created until after all CreateFcns called
810
811% Hint: edit controls usually have a white background on Windows.
812%       See ISPC and COMPUTER.
813if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
814    set(hObject,'BackgroundColor','white');
815end
816
817
818
819function lost_frame_ratio_Callback(hObject, eventdata, handles)
820% hObject    handle to lost_frame_ratio (see GCBO)
821% eventdata  reserved - to be defined in a future version of MATLAB
822% handles    structure with handles and user data (see GUIDATA)
823
824% Hints: get(hObject,'String') returns contents of lost_frame_ratio as text
825%        str2double(get(hObject,'String')) returns contents of lost_frame_ratio as a double
826
827
828% --- Executes during object creation, after setting all properties.
829function lost_frame_ratio_CreateFcn(hObject, eventdata, handles)
830% hObject    handle to lost_frame_ratio (see GCBO)
831% eventdata  reserved - to be defined in a future version of MATLAB
832% handles    empty - handles not created until after all CreateFcns called
833
834% Hint: edit controls usually have a white background on Windows.
835%       See ISPC and COMPUTER.
836if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
837    set(hObject,'BackgroundColor','white');
838end
839
840
841% --- Executes on button press in refresh.
842function refresh_Callback(hObject, eventdata, handles)
843% hObject    handle to refresh (see GCBO)
844% eventdata  reserved - to be defined in a future version of MATLAB
845% handles    structure with handles and user data (see GUIDATA)
846attr_list={'inputDataRate','lostFrames','fifoOverruns','frameOffsetInDMA','frameOffsetBetweenDMA','firmwareType','comConfig','comProcessTime','bpmCount','rdFIFOContent','rdFIFOFull','wtFIFOFull','rdFIFOEmpty','wtFIFOEmpty','comFirmwareType','comStatus','comLinkPartner1','comLinkPartner2','comLinkUp','comHwErrCont1','comHwErrCont2','comSwErrCont1','comSwErrCont2','comFrameErrCont1','comFrameErrCont2','comRxPacketsCont1','comRxPacketsCont2','comTxPacketsCont1','comTxPacketsCont2','cfgSnifferID','cfgTimeFrameLength','cfgMgtPowerDown','cfgMgtLoopBack','cfgBufferClearDelay','lostFramesRatio'};
847dev_list=get(handles.sniffer_dev,'string');
848dev_value=get(handles.sniffer_dev,'value');   
849dev=dev_list{dev_value};
850result=tango_read_attributes(dev,attr_list)
851set(handles.data_rate,'string',num2str(result(1).value));
852set(handles.lost_frames,'string',num2str(result(2).value));
853set(handles.fifo_overruns,'string',num2str(result(3).value));
854set(handles.frame_offset_in_DMA,'string',num2str(result(4).value));
855set(handles.frame_offset_between_DMA,'string',num2str(result(5).value));
856set(handles.sniffer_firmware,'string',num2str(result(6).value));
857set(handles.CC_process_time,'string',num2str(result(8).value));
858set(handles.bpm_involved,'string',num2str(result(9).value));
859set(handles.rd_fifo_data_cnt,'string',num2str(result(10).value));
860set(handles.rd_fifo_full,'value',(result(11).value));
861set(handles.wt_fifo_full,'value',(result(12).value));
862set(handles.rd_fifo_empty,'value',(result(13).value));
863set(handles.wt_fifo_empty,'value',(result(14).value));
864set(handles.CC_firmware,'string',num2str(result(15).value));
865set(handles.link_partner_1,'string',num2str(result(17).value));
866set(handles.link_partner_2,'string',num2str(result(18).value));
867link_up=dec2bin(result(19).value,8);
868set(handles.RX_link_up_1,'value',str2num(link_up(8)));
869set(handles.RX_link_up_2,'value',str2num(link_up(7)));
870set(handles.TX_link_up_1,'value',str2num(link_up(4)));
871set(handles.TX_link_up_2,'value',str2num(link_up(3)));
872set(handles.hard_err_cnt_1,'string',num2str(result(20).value));
873set(handles.hard_err_cnt_2,'string',num2str(result(21).value));
874set(handles.soft_err_cnt_1,'string',num2str(result(22).value));
875set(handles.soft_err_cnt_2,'string',num2str(result(23).value));
876set(handles.frame_err_cnt_1,'string',num2str(result(24).value));
877set(handles.frame_err_cnt_2,'string',num2str(result(25).value));
878set(handles.RX_count_1,'string',num2str(result(26).value));
879set(handles.RX_count_2,'string',num2str(result(27).value));
880set(handles.TX_count_1,'string',num2str(result(28).value));
881set(handles.TX_count_2,'string',num2str(result(29).value));
882set(handles.sniffer_id,'string',num2str(result(30).value));
883set(handles.time_frame_lenght,'string',num2str(result(31).value));
884set(handles.mgt_powerdown,'string',num2str(result(32).value));
885set(handles.mgt_loopback,'string',num2str(result(33).value));
886set(handles.buf_clr_dly,'string',num2str(result(34).value));
887set(handles.lost_frame_ratio,'string',num2str(result(35).value));
888
889
890% --- Executes on button press in display.
891function display_Callback(hObject, eventdata, handles)
892% hObject    handle to display (see GCBO)
893% eventdata  reserved - to be defined in a future version of MATLAB
894% handles    structure with handles and user data (see GUIDATA)
895
896%attr_list={'xPosData','zPosData','firstTimeFrame','lastTimeFrame'};
897dev_list=get(handles.sniffer_dev,'string');
898dev_value=get(handles.sniffer_dev,'value');   
899dev=dev_list{dev_value};
900
901%while continuous==1
902%Nsamples=4096*Nbuffer;
903
904% for i=1:1:Nbuffer
905%     result{i}=tango_read_attributes(dev,attr_list);
906%     delai=.8 + sqrt(0.5) * randn
907%     pause(delai)
908%     waitbar(i/Nbuffer,h);
909% end
910
911axes(handles.graph)
912
913if get(handles.is_orbit,'value')
914    attr_list={'XPosMean','ZPosMean'};
915    result=tango_read_attributes2(dev,attr_list)
916    plot(double(result(2).value(2:121))./1000)
917    hold on
918    plot(double(result(1).value(2:121))./1000,'r')
919    xlabel('bpm number')
920    ylabel('µm')
921    title('orbit display')
922    legend('Vertical','Horizontal');
923    hold off
924    grid on
925
926
927else if get(handles.is_buffer,'value')
928    dataX=0;
929    dataZ=0;
930    bpm=str2num(get(handles.selection,'string'))
931    dataX=tango_command_inout2(dev,'GetXPosData',uint16(bpm));
932    dataZ=tango_command_inout2(dev,'GetZPosData',uint16(bpm));
933
934%         for j=2:1:121
935%         [toto tata]=find(result{i}(1).value(j,:)==0);
936%         if isempty(find(result{i}(2).value(j,tata)==0))==0
937%             bpm_nul=bpm_nul+1;
938%             frame_nulle(tata)=frame_nulle(tata)+1;
939%          end
940%         
941%         end
942
943%     index=find(frame_nulle)
944%     frame_nulle(index)
945%     dataX=dataX(2:size(dataX,2));
946%     dataZ=dataZ(2:size(dataZ,2));
947    plot(double(dataX)./1000.0)
948    hold on
949    plot(double(dataZ)./1000.0,'r')
950    xlabel('sample number (at 10 kHz)')
951    ylabel('µm')
952    title(['buffer display bpm ',num2str(bpm)])
953    legend('Horizontal','Vertical');
954    hold off
955    grid on
956%     (result{Nbuffer}(4).value-result{1}(3).value)/4096;
957   
958%     
959%     set(handles.ff_cnt,'string',num2str(result(3).value));
960%     set(handles.lf_cnt,'string',num2str(result(4).value));
961%     
962   
963else if get(handles.is_fft,'value')
964    dataX=0;
965    dataZ=0;
966    bpm=str2num(get(handles.selection,'string'))
967    dataX=tango_command_inout2(dev,'GetXPosData',uint16(bpm));
968    dataZ=tango_command_inout2(dev,'GetZPosData',uint16(bpm));
969    Nsamples=size(dataX,2)
970    xfft=0;
971    pxfft=0;
972    pxfftaff=0;
973%      for i=1:1:Nbuffer
974%         dataX=[dataX result{i}(1).value(bpm+1,:)];
975%         dataZ=[dataZ result{i}(2).value(bpm+1,:)];
976%
977%     end
978%     dataX=dataX(2:size(dataX,2));
979%     dataZ=dataZ(2:size(dataZ,2));
980
981    fech=10079;
982    fmax=100;
983    Nfft=1000*Nsamples;
984    xfft=fft(double(dataX./10^3),Nsamples)/Nsamples;
985    zfft=fft(double(dataZ./10^3),Nsamples)/Nsamples;
986    pxfft=2*xfft.*conj(xfft);
987    pzfft=2*zfft.*conj(zfft);
988    %on normalise pour afficher la dsp en µm^2/Hz et non pas en µm^2/largeur de bande entre 2 échantillons
989    pxfftaff=sqrt(pxfft*Nsamples/fech);
990    pzfftaff=sqrt(pzfft*Nsamples/fech);
991    f_bpm=(1:Nsamples-1)*fech/Nsamples;
992    n_bpm=(1:120);
993    semilogy(f_bpm,pxfftaff(1,2:Nsamples),'r');
994    hold on;
995    semilogy(f_bpm,pzfftaff(1,2:Nsamples),'b');
996    %xlim([0 fmax]);
997    fmin=str2num(get(handles.fmin,'string'));
998    fmax=str2num(get(handles.fmax,'string'));
999    xlim([fmin fmax]);
1000 %   xlim([0 90]);
1001    ylim([10^-3 10^2]);
1002    xlabel('frequency (Hz)')
1003    ylabel('µm/sqrt(Hz)')
1004    title(['fft on bpm ',num2str(bpm)])
1005    legend('Horizontal','Vertical');
1006    hold off
1007     grid on;
1008    axes(handles.graph2)
1009    PXintegrale_bpm(1:Nsamples)=0;
1010    PZintegrale_bpm(1:Nsamples)=0;
1011
1012    for step=2:Nsamples
1013        PXintegrale_bpm(step)=PXintegrale_bpm(step-1) + pxfft(step);
1014        PZintegrale_bpm(step)=PZintegrale_bpm(step-1) + pzfft(step);
1015    end
1016    Xintegrale_bpm=sqrt((PXintegrale_bpm));
1017    Zintegrale_bpm=sqrt((PZintegrale_bpm));
1018    bruitX_bpm = Xintegrale_bpm(floor(Nsamples/2))
1019    bruitZ_bpm = Zintegrale_bpm(floor(Nsamples/2))
1020    plot(f_bpm,Xintegrale_bpm(2:Nsamples),'r')
1021    hold on
1022    plot(f_bpm,Zintegrale_bpm(2:Nsamples),'b')
1023    %xlim([0 fmax]);
1024    xlim([fmin fmax]);
1025    %xlim([0 90]);
1026    xlabel('frequence (Hz)');
1027    ylabel('µm');
1028    legend('Horizontal','Vertical');
1029    hold off
1030    grid on;
1031    end
1032    end
1033
1034end
1035% close(h);
1036%end
1037% first_frame=result{1}(3).value;
1038%     last_frame=result{Nbuffer}(4).value;
1039%     if last_frame<first_frame
1040%         last_frame=last_frame+2^16;
1041%     end
1042%     last_frame-first_frame
1043%     if ((last_frame-first_frame)+1==Nsamples)
1044%         set(handles.record_done,'value',1)
1045%     else
1046%          set(handles.record_done,'value',0)
1047%     end
1048
1049function edit32_Callback(hObject, eventdata, handles)
1050% hObject    handle to edit32 (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: get(hObject,'String') returns contents of edit32 as text
1055%        str2double(get(hObject,'String')) returns contents of edit32 as a double
1056
1057
1058% --- Executes during object creation, after setting all properties.
1059function edit32_CreateFcn(hObject, eventdata, handles)
1060% hObject    handle to edit32 (see GCBO)
1061% eventdata  reserved - to be defined in a future version of MATLAB
1062% handles    empty - handles not created until after all CreateFcns called
1063
1064% Hint: edit controls usually have a white background on Windows.
1065%       See ISPC and COMPUTER.
1066if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1067    set(hObject,'BackgroundColor','white');
1068end
1069
1070
1071
1072
1073% --- Executes on selection change in command.
1074function command_Callback(hObject, eventdata, handles)
1075% hObject    handle to command (see GCBO)
1076% eventdata  reserved - to be defined in a future version of MATLAB
1077% handles    structure with handles and user data (see GUIDATA)
1078
1079% Hints: contents = get(hObject,'String') returns command contents as cell array
1080%        contents{get(hObject,'Value')} returns selected item from command
1081button=questdlg('Apply command ?','Confirm','Yes');
1082switch button
1083    case 'Yes'
1084    command_list=get(handles.command,'string')
1085    command_line=get(handles.command,'value')
1086    command=command_list{command_line}
1087    dev_list=get(handles.sniffer_dev,'string');
1088    dev_value=get(handles.sniffer_dev,'value');   
1089    dev=dev_list{dev_value};
1090    result=tango_command_inout2(dev,command)   
1091    otherwise
1092end
1093
1094% --- Executes during object creation, after setting all properties.
1095function command_CreateFcn(hObject, eventdata, handles)
1096% hObject    handle to command (see GCBO)
1097% eventdata  reserved - to be defined in a future version of MATLAB
1098% handles    empty - handles not created until after all CreateFcns called
1099
1100% Hint: popupmenu controls usually have a white background on Windows.
1101%       See ISPC and COMPUTER.
1102if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1103    set(hObject,'BackgroundColor','white');
1104end
1105
1106
1107
1108
1109% --- Executes on button press in is_fft_3d.
1110function fft_3d_Callback(hObject, eventdata, handles)
1111% hObject    handle to is_fft_3d (see GCBO)
1112% eventdata  reserved - to be defined in a future version of MATLAB
1113% handles    structure with handles and user data (see GUIDATA)
1114attr_list={'xPosData','zPosData'};
1115dev_list=get(handles.sniffer_dev,'string');
1116dev_value=get(handles.sniffer_dev,'value');   
1117dev=dev_list{dev_value};
1118result=tango_read_attributes(dev,attr_list)
1119
1120xfft=0;
1121pxfft=0;
1122pxfftaff=0;
1123Nsamples=4096;
1124fech=10079
1125
1126xfft=fft((double(transpose(result(1).value(2:121,:)./1000))))./Nsamples;
1127zfft=fft((double(transpose(result(2).value(2:121,:)./1000))))./Nsamples;
1128pxfft=2*xfft.*conj(xfft);
1129pzfft=2*zfft.*conj(zfft);
1130pxfftaff=pxfft*Nsamples/fech;
1131pzfftaff=pzfft*Nsamples/fech;
1132f_bpm=(0:Nsamples-1)*fech/Nsamples;
1133n_bpm=(1:120);
1134
1135figure(1)
1136surf(n_bpm,f_bpm(2:Nsamples),log(pxfftaff(2:Nsamples,:)))
1137ylim([0 1000])
1138xlabel('bpm number');
1139ylabel('frequency (Hz)');
1140zlabel('log de la densite spectrale de puissance')
1141title('densité spectrale de puissance mesurée sur les données FA (@10 kHz) sur les 120 BPMs dans le plan horizontal');
1142figure(2)
1143surf(n_bpm,f_bpm(2:Nsamples),log(pzfftaff(2:Nsamples,:)))
1144ylim([0 1000])
1145xlabel('bpm number');
1146ylabel('frequency (Hz)');
1147zlabel('log de la densite spectrale de puissance')
1148title('densité spectrale de puissance mesurée sur les données FA (@10 kHz) sur les 120 BPMs dans le plan vertical');
1149
1150
1151
1152% --- Executes on button press in is_fft.
1153function is_fft_Callback(hObject, eventdata, handles)
1154% hObject    handle to is_fft (see GCBO)
1155% eventdata  reserved - to be defined in a future version of MATLAB
1156% handles    structure with handles and user data (see GUIDATA)
1157
1158
1159% --- Executes on button press in integrated_noise.
1160function integrated_noise_Callback(hObject, eventdata, handles)
1161% hObject    handle to integrated_noise (see GCBO)
1162% eventdata  reserved - to be defined in a future version of MATLAB
1163% handles    structure with handles and user data (see GUIDATA)
1164attr_list={'xPosData','zPosData'};
1165dev_list=get(handles.sniffer_dev,'string');
1166dev_value=get(handles.sniffer_dev,'value');   
1167dev=dev_list{dev_value};
1168result=tango_read_attributes(dev,attr_list)
1169xfft=0;
1170pxfft=0;
1171pxfftaff=0;
1172Nsamples=4096;
1173fech=10079
1174fmax=1200;
1175xfft=fft((double(transpose(result(1).value(2:121,:)./1000))))./Nsamples;
1176zfft=fft((double(transpose(result(2).value(2:121,:)./1000))))./Nsamples;
1177pxfft=2*xfft.*conj(xfft);
1178pzfft=2*zfft.*conj(zfft);
1179pxfftaff=pxfft*Nsamples/fech;
1180pzfftaff=pzfft*Nsamples/fech;
1181f_bpm=(0:Nsamples-1)*fech/Nsamples;
1182n_bpm=(1:120);
1183
1184PXintegrale_bpm(1:4096,1:120)=0;
1185PZintegrale_bpm(1:4096,1:120)=0;
1186
1187for j=1:1:120
1188    for step=2:Nsamples
1189        PXintegrale_bpm(step,j)=PXintegrale_bpm(step-1,j) + pxfft(step,j);
1190        PZintegrale_bpm(step,j)=PZintegrale_bpm(step-1,j) + pzfft(step,j);
1191    end
1192end
1193Xintegrale_bpm=sqrt((PXintegrale_bpm));
1194Zintegrale_bpm=sqrt((PZintegrale_bpm));
1195bruitX_bpm = Xintegrale_bpm(Nsamples/2)
1196bruitZ_bpm = Zintegrale_bpm(Nsamples/2)
1197
1198figure(1)
1199subplot(3,2,1)
1200semilogy(f_bpm(2:Nsamples),pxfftaff(2:Nsamples,:));
1201xlim([0 fmax]);
1202ylim([10^-6 10^2])
1203title('densité spectrale de puissance horizontale sur les 120 bpms');
1204xlabel('frequence (Hz)');
1205ylabel('µm^2/Hz');
1206grid on;
1207
1208subplot(3,2,2)
1209semilogy(f_bpm(2:Nsamples),pzfftaff(2:Nsamples,:));
1210xlim([0 fmax]);
1211ylim([10^-6 10^2])
1212title('densité spectrale de puissance verticale sur les 120 bpms');
1213xlabel('frequence (Hz)');
1214ylabel('µm^2/Hz');
1215grid on;
1216
1217subplot(3,2,3)
1218plot(f_bpm,Xintegrale_bpm)
1219xlim([0 fmax]);
1220title('bruit integré horizontal en fonction de la frequence sur les 120 bpms');
1221xlabel('frequence (Hz)');
1222ylabel('µm');
1223grid on;
1224
1225subplot(3,2,4)
1226plot(f_bpm,Zintegrale_bpm)
1227xlim([0 fmax]);
1228title('bruit integré vertical en fonction de la frequence sur les 120 bpms');
1229xlabel('frequence (Hz)');
1230ylabel('µm');
1231grid on;
1232
1233index=find(f_bpm>=fmax)
1234
1235subplot(3,2,5)
1236plot(Xintegrale_bpm(index(1),:))
1237xlim([0 120]);
1238title(['bruit integré horizontal dans la bande 0-',num2str(fmax),' Hz en fonction de la position sur les 120 bpms']);
1239xlabel('numéro du bpm');
1240ylabel('µm');
1241grid on;
1242
1243subplot(3,2,6)
1244plot(Zintegrale_bpm(index(1),:))
1245xlim([0 120]);
1246title(['bruit integré vertical dans la bande 0-',num2str(fmax),' Hz en fonction de la position sur les 120 bpms']);
1247xlabel('numéro du bpm');
1248ylabel('µm');   
1249grid on;
1250
1251save bruit_integre pxfftaff pzfftaff Xintegrale_bpm Zintegrale_bpm f_bpm
1252
1253
1254% --- Executes on button press in continuous.
1255function continuous_Callback(hObject, eventdata, handles)
1256% hObject    handle to continuous (see GCBO)
1257% eventdata  reserved - to be defined in a future version of MATLAB
1258% handles    structure with handles and user data (see GUIDATA)
1259
1260% Hint: get(hObject,'Value') returns toggle state of continuous
1261% global continuous;
1262%
1263% continuous=get(handles.continuous,'value')
1264
1265
1266
1267function ff_cnt_Callback(hObject, eventdata, handles)
1268% hObject    handle to ff_cnt (see GCBO)
1269% eventdata  reserved - to be defined in a future version of MATLAB
1270% handles    structure with handles and user data (see GUIDATA)
1271
1272% Hints: get(hObject,'String') returns contents of ff_cnt as text
1273%        str2double(get(hObject,'String')) returns contents of ff_cnt as a double
1274
1275
1276% --- Executes during object creation, after setting all properties.
1277function ff_cnt_CreateFcn(hObject, eventdata, handles)
1278% hObject    handle to ff_cnt (see GCBO)
1279% eventdata  reserved - to be defined in a future version of MATLAB
1280% handles    empty - handles not created until after all CreateFcns called
1281
1282% Hint: edit controls usually have a white background on Windows.
1283%       See ISPC and COMPUTER.
1284if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1285    set(hObject,'BackgroundColor','white');
1286end
1287
1288
1289
1290function lf_cnt_Callback(hObject, eventdata, handles)
1291% hObject    handle to lf_cnt (see GCBO)
1292% eventdata  reserved - to be defined in a future version of MATLAB
1293% handles    structure with handles and user data (see GUIDATA)
1294
1295% Hints: get(hObject,'String') returns contents of lf_cnt as text
1296%        str2double(get(hObject,'String')) returns contents of lf_cnt as a double
1297
1298
1299% --- Executes during object creation, after setting all properties.
1300function lf_cnt_CreateFcn(hObject, eventdata, handles)
1301% hObject    handle to lf_cnt (see GCBO)
1302% eventdata  reserved - to be defined in a future version of MATLAB
1303% handles    empty - handles not created until after all CreateFcns called
1304
1305% Hint: edit controls usually have a white background on Windows.
1306%       See ISPC and COMPUTER.
1307if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1308    set(hObject,'BackgroundColor','white');
1309end
1310
1311
1312
1313
1314
1315function Buffer_length_Callback(hObject, eventdata, handles)
1316% hObject    handle to Buffer_length (see GCBO)
1317% eventdata  reserved - to be defined in a future version of MATLAB
1318% handles    structure with handles and user data (see GUIDATA)
1319
1320% Hints: get(hObject,'String') returns contents of Buffer_length as text
1321%        str2double(get(hObject,'String')) returns contents of Buffer_length as a double
1322duree=get(handles.Buffer_length,'string')
1323dev_list=get(handles.sniffer_dev,'string');
1324dev_value=get(handles.sniffer_dev,'value');   
1325dev=dev_list{dev_value};
1326tango_write_attribute2(dev,'recordLengthInSecs',str2num(duree))
1327
1328
1329% --- Executes during object creation, after setting all properties.
1330function Buffer_length_CreateFcn(hObject, eventdata, handles)
1331% hObject    handle to Buffer_length (see GCBO)
1332% eventdata  reserved - to be defined in a future version of MATLAB
1333% handles    empty - handles not created until after all CreateFcns called
1334
1335% Hint: edit controls usually have a white background on Windows.
1336%       See ISPC and COMPUTER.
1337if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1338    set(hObject,'BackgroundColor','white');
1339end
1340
1341% --- Executes on button press in record_done.
1342function record_done_Callback(hObject, eventdata, handles)
1343% hObject    handle to record_done (see GCBO)
1344% eventdata  reserved - to be defined in a future version of MATLAB
1345% handles    structure with handles and user data (see GUIDATA)
1346
1347% Hint: get(hObject,'Value') returns toggle state of record_done
1348
1349
1350
1351
1352
1353function fmax_Callback(hObject, eventdata, handles)
1354% hObject    handle to fmax (see GCBO)
1355% eventdata  reserved - to be defined in a future version of MATLAB
1356% handles    structure with handles and user data (see GUIDATA)
1357
1358% Hints: get(hObject,'String') returns contents of fmax as text
1359%        str2double(get(hObject,'String')) returns contents of fmax as a double
1360axes(handles.graph)
1361fmin=str2num(get(handles.fmin,'string'));
1362fmax=str2num(get(handles.fmax,'string'));
1363xlim([fmin fmax]);
1364axes(handles.graph2)
1365xlim([fmin fmax]);
1366
1367% --- Executes during object creation, after setting all properties.
1368function fmax_CreateFcn(hObject, eventdata, handles)
1369% hObject    handle to fmax (see GCBO)
1370% eventdata  reserved - to be defined in a future version of MATLAB
1371% handles    empty - handles not created until after all CreateFcns called
1372
1373% Hint: edit controls usually have a white background on Windows.
1374%       See ISPC and COMPUTER.
1375if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1376    set(hObject,'BackgroundColor','white');
1377end
1378
1379
1380
1381function fmin_Callback(hObject, eventdata, handles)
1382% hObject    handle to fmin (see GCBO)
1383% eventdata  reserved - to be defined in a future version of MATLAB
1384% handles    structure with handles and user data (see GUIDATA)
1385
1386% Hints: get(hObject,'String') returns contents of fmin as text
1387%        str2double(get(hObject,'String')) returns contents of fmin as a double
1388axes(handles.graph)
1389fmin=str2num(get(handles.fmin,'string'));
1390fmax=str2num(get(handles.fmax,'string'));
1391xlim([fmin fmax]);
1392axes(handles.graph2)
1393xlim([fmin fmax]);
1394
1395% --- Executes during object creation, after setting all properties.
1396function fmin_CreateFcn(hObject, eventdata, handles)
1397% hObject    handle to fmin (see GCBO)
1398% eventdata  reserved - to be defined in a future version of MATLAB
1399% handles    empty - handles not created until after all CreateFcns called
1400
1401% Hint: edit controls usually have a white background on Windows.
1402%       See ISPC and COMPUTER.
1403if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1404    set(hObject,'BackgroundColor','white');
1405end
1406
1407
1408
1409
1410% --- Executes on button press in start_record.
1411function start_record_Callback(hObject, eventdata, handles)
1412% hObject    handle to start_record (see GCBO)
1413% eventdata  reserved - to be defined in a future version of MATLAB
1414% handles    structure with handles and user data (see GUIDATA)
1415dev_list=get(handles.sniffer_dev,'string');
1416dev_value=get(handles.sniffer_dev,'value');   
1417dev=dev_list{dev_value};
1418set(handles.record_done,'value',0)
1419record_done=0;
1420result_duree=tango_read_attribute2(dev,'recordLengthInSecs');
1421duree=result_duree.value(1)
1422set(handles.Buffer_length,'string',num2str(duree));
1423tango_command_inout2(dev,'StartRecording');
1424h = waitbar(0,'Please wait...');
1425for i=1:10,
1426pause(duree/10)
1427% computation here %
1428waitbar(i/10,h)
1429end
1430while record_done==0
1431    result=tango_read_attribute2(dev,'recordReady')
1432    if result.value==1
1433        set(handles.record_done,'value',1)
1434        close(h)
1435        record_done=1;
1436    else
1437        pause(1)
1438    end
1439end
1440
1441
1442% --- Executes on selection change in sniffer_dev.
1443function sniffer_dev_Callback(hObject, eventdata, handles)
1444% hObject    handle to sniffer_dev (see GCBO)
1445% eventdata  reserved - to be defined in a future version of MATLAB
1446% handles    structure with handles and user data (see GUIDATA)
1447
1448% Hints: contents = get(hObject,'String') returns sniffer_dev contents as cell array
1449%        contents{get(hObject,'Value')} returns selected item from sniffer_dev
1450
1451
1452% --- Executes during object creation, after setting all properties.
1453function sniffer_dev_CreateFcn(hObject, eventdata, handles)
1454% hObject    handle to sniffer_dev (see GCBO)
1455% eventdata  reserved - to be defined in a future version of MATLAB
1456% handles    empty - handles not created until after all CreateFcns called
1457
1458% Hint: popupmenu controls usually have a white background on Windows.
1459%       See ISPC and COMPUTER.
1460if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1461    set(hObject,'BackgroundColor','white');
1462end
1463
1464
Note: See TracBrowser for help on using the repository browser.