-
Notifications
You must be signed in to change notification settings - Fork 0
/
LDC_LI.m
85 lines (68 loc) · 2.43 KB
/
LDC_LI.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
%% Simple LIV curve using an LDC and power meter
% Michael Nickerson 2020-06-26
% Updated 2021-04-01
%% Setup
% Record Parameters
die = '123.1.2';
dev = 'MZM4.1';
measurement = 'IV';
savName = sprintf('%s_%s-%s_%s_%s', datestr(now, 'yyyymmdd'), ...
die, dev, measurement, datestr(now, 'Thhmmss'));
% Measurement Parameters
N = 100;
Irange = [40, 120]; % mA
ldcID = 'Station2';
pmID = 'Station2';
avgT = 2.0;
lambda = 1030;
% Allocate storage
I = linspace(min(Irange), max(Irange), N)';
V = NaN(size(I)); L = V;
%% Set up plot
[figH, axH, plotH] = plotStandard2D([I, V], 'style', 'x', 'y2', 'legend', 'Voltage', ...
[I, L], 'style', 'x', 'legend', 'Power', ...
'fig', 1, 'legendloc', 'nw', ...
'xlabel', 'Current [mA]', ...
'ylabel', 'Optical Power [mW]', ...
'y2label', 'Compliance [V]', ...
'title', ['LIV: ' savName]);
%% Run
set(figH, 'CurrentCharacter', '_');
disp('Starting LIV sweep');
ifaceLDC(ldcID, 'current', I(1)*1e-3, 'avg', avgT, 'state', 1);
ifacePM(pmID, 'wavelength', lambda);
for i=1:N
% Measure
IVT = ifaceLDC(ldcID, 'current', I(i) * 1e-3, 'avg', avgT); % Setpoint in A
L(i) = ifacePM(pmID, 'avg', avgT)*1e3;
I(i) = IVT(1)*1e3; V(i) = IVT(2);
% Update plot
plotH(1).XData = I;
plotH(1).YData = V;
plotH(2).XData = I;
plotH(2).YData = L;
drawnow;
% Check for abort
lastKey = get(figH, 'CurrentCharacter');
if ~isempty(lastKey) && (lastKey ~= '_')
disp('Keypress detected: aborting');
break;
end
end
ifaceLDC(ldcID, 'current', 0, 'state', 0);
disp('Done measuring');
%% Fit and plot simple line
LIfit = polyfit(I(L>0.05*max(L)), L(L>0.05*max(L)), 2);
plotStandard2D([I, V], 'style', 'x', 'y2', 'legend', 'Voltage', ...
[I, L], 'style', 'x', 'legend', 'Power', ...
[I(L>0.05*max(L)), polyval(LIfit, I(L>0.05*max(L)))], ...
'style', ':', 'legend', sprintf('%.4g * I + %.4g * I^2', LIfit(2), LIfit(1)), ...
'fig', 1, 'legendloc', 'nw', ...
'xlabel', 'Current [mA]', ...
'ylabel', 'Optical Power [mW]', ...
'y2label', 'Compliance [V]', ...
'title', ['LIV: ' savName]);
%% Save results
savPath='~/labshare/measurements/station2';
print([savPath savName '.png'], '-dpng');
save([savPath savName '_LI.mat'],'L','I','V', 'LIfit');