-
Notifications
You must be signed in to change notification settings - Fork 0
/
simple_DSOcontinuous.m
56 lines (42 loc) · 1.34 KB
/
simple_DSOcontinuous.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
%% Take continuous DSO measurements
% Sequence settings
ch = 4;
dev = '165.1';
lambda = 1030;
measurement = 'thermal_FP';
wg = '2µm_SSC_half';
savPath='~/labshare/measurements/station2';
%% Set up plot
h = figureSize(1, 800, 600); clf(h); hold on;
plH = plot([1 2], [NaN NaN], '-', 'MarkerSize', 10, 'LineWidth', 3);
grid on;
xlabel('Time'); ylabel('PD [V]');
set(gcf, 'CurrentCharacter', '_');
% Title
title('Continuous DSO Trace', 'FontSize', 20, 'FontName', 'Source Sans Pro');
%% Execute
disp('Saving traces continuously: ');
lastKey = get(gcf, 'CurrentCharacter'); i=0; lastOut=0;
while (isempty(lastKey) || (lastKey == '_')) && isvalid(h)
i = i+1;
% Get data
[Y, X] = dev_DSOgetTrace(ch, mapDSO('Station2USB').visaAddr, 1);
% Save data
dataFile = sprintf('%s-%s-%s-%inm-%s-ch%i-%s.mat', datestr(now, 'yyyymmdd'), ...
dev, measurement, lambda, wg, ch, datestr(now, 'Thhmmss.FFF'));
save([savPath dataFile], 'X','Y', 'dev', 'lambda', 'measurement', 'wg', 'ch');
% Update display
fprintf(repmat('\b', [1 lastOut]));
lastOut = fprintf('%i', i);
if isvalid(h)
% Update plot
plH.XData = X;
plH.YData = Y;
drawnow;
end
if isvalid(h)
% Check for abort
lastKey = get(h, 'CurrentCharacter');
end
end
fprintf("\nMeasurement concluded.\n");