minimal examplw
This commit is contained in:
@@ -51,7 +51,7 @@ classdef DBHandler < handle
|
||||
"Vendor", "MySQL", ...
|
||||
"Server", "134.245.243.254", ...
|
||||
"PortNumber", 3306, ...
|
||||
"JDBCDriverLocation", "C:\Users\sioe\Documents\mysql-connector-j-9.3.0\mysql-connector-j-9.3.0.jar");
|
||||
"JDBCDriverLocation", "C:\Users\Silas\Documents\mysql-connector-j-9.3.0\mysql-connector-j-9.3.0.jar");
|
||||
end
|
||||
|
||||
catch e
|
||||
|
||||
@@ -149,7 +149,7 @@ switch precode_mode
|
||||
tx_bits_demapped = mapper.demap(tx_symbols);
|
||||
rx_bits = mapper.demap(eq_signal_hd);
|
||||
[bits, errors, ber, error_pos] = calc_ber(rx_bits.signal, tx_bits_demapped.signal, "skip_front", 30000, "skip_end", 150, "returnErrorLocation", 1);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function displayAnalysis(eq_noise, eq_signal_sd, rx_signal, eq_, tx_symbols, M, postFFE)
|
||||
|
||||
@@ -1,113 +1,151 @@
|
||||
function beautifyBERplot(options)
|
||||
% BEAUTIFYBERPLOT Enhances BER-style plots for publication-quality figures.
|
||||
% Supports automatic smoothing and trend-line overlay.
|
||||
% BEAUTIFYBERPLOT Publication-style beautification for BER / NSD plots.
|
||||
% Style aligned to manual plotting script (lw=0.8, ms=4, white markers).
|
||||
%
|
||||
% Usage examples:
|
||||
% beautifyBERplot; % default
|
||||
% beautifyBERplot("polyfit",1); % add polynomial fit
|
||||
% beautifyBERplot("polyfit",1,"fitmethod","pchip") % piecewise cubic fit
|
||||
%
|
||||
% Supported fitmethod options: 'polyfit', 'smoothingspline', 'loess', 'pchip'
|
||||
% beautifyBERplot
|
||||
% beautifyBERplot("polyfit",true,"polyorder",1)
|
||||
% beautifyBERplot("polyfit",true,"fitmethod","pchip")
|
||||
|
||||
arguments
|
||||
options.logscale (1,1) logical = 1
|
||||
options.setmarkers (1,1) logical = 1;
|
||||
options.polyfit (1,1) logical = 0
|
||||
options.polyorder (1,1) double = 2
|
||||
options.fitmethod (1,1) string = "polyfit" % choose fit type
|
||||
options.logscale (1,1) logical = 1
|
||||
options.setmarkers (1,1) logical = 1
|
||||
options.setcolors (1,1) logical = 1
|
||||
options.polyfit (1,1) logical = 0
|
||||
options.polyorder (1,1) double = 2
|
||||
options.fitmethod (1,1) string = "polyfit"
|
||||
end
|
||||
|
||||
% --- find all line objects in current axes
|
||||
lines = findall(gca, 'Type', 'Line');
|
||||
markers = {'o', 's', 'd', '^', 'v', '>', '<', 'p', 'h'};
|
||||
num_markers = length(markers);
|
||||
ax = gca;
|
||||
|
||||
% --- style all lines consistently
|
||||
for i = 1:length(lines)
|
||||
lines(i).LineWidth = 1.2;
|
||||
% lines(i).LineStyle = '-';
|
||||
if options.setmarkers == 1
|
||||
if string(lines(i).Marker) == "none"
|
||||
lines(i).Marker = markers{mod(i-1, num_markers) + 1};
|
||||
% ---------------------------------------------------------
|
||||
% Extract *only* real data lines from ax.Children
|
||||
% ---------------------------------------------------------
|
||||
children = ax.Children;
|
||||
isLine = arrayfun(@(h) isa(h,'matlab.graphics.chart.primitive.Line'), children);
|
||||
lines = children(isLine);
|
||||
|
||||
% Remove helper lines (e.g. yline, fit overlays)
|
||||
lines = lines(~strcmp({lines.Tag},'ConstantLine'));
|
||||
|
||||
n = numel(lines);
|
||||
if n == 0
|
||||
return
|
||||
end
|
||||
|
||||
% ---------------------------------------------------------
|
||||
% Fixed color palette (deterministic across figures)
|
||||
% ---------------------------------------------------------
|
||||
try
|
||||
cmap = linspecer(n);
|
||||
catch
|
||||
cmap = lines(n).Color; %#ok<NASGU>
|
||||
cmap = linespecer_fallback(n);
|
||||
end
|
||||
|
||||
markers = {'o','s','o','o','^','v','d','>'};
|
||||
lw = 0.8;
|
||||
ms = 4;
|
||||
|
||||
% ---------------------------------------------------------
|
||||
% Apply line + marker styling
|
||||
% ---------------------------------------------------------
|
||||
for i = 1:n
|
||||
ln = lines(n-i+1); % preserve plotting order
|
||||
ln.LineWidth = lw;
|
||||
|
||||
if options.setcolors
|
||||
ln.Color = cmap(i,:);
|
||||
end
|
||||
|
||||
if options.setmarkers
|
||||
if strcmp(ln.Marker,'none')
|
||||
ln.Marker = markers{mod(i-1,numel(markers))+1};
|
||||
end
|
||||
lines(i).MarkerSize = 4;
|
||||
lines(i).MarkerFaceColor = lines(i).Color;
|
||||
ln.MarkerSize = ms;
|
||||
if options.setcolors
|
||||
ln.MarkerEdgeColor = cmap(i,:);
|
||||
end
|
||||
ln.MarkerFaceColor = [1 1 1];
|
||||
end
|
||||
end
|
||||
|
||||
% --- optional smoothing/fitting overlay
|
||||
% ---------------------------------------------------------
|
||||
% Optional smoothing / fitting overlay
|
||||
% ---------------------------------------------------------
|
||||
if options.polyfit
|
||||
hold on
|
||||
for i = 1:length(lines)
|
||||
x = lines(i).XData;
|
||||
y = lines(i).YData;
|
||||
for i = 1:n
|
||||
ln = lines(n-i+1);
|
||||
x = ln.XData(:);
|
||||
y = ln.YData(:);
|
||||
valid = isfinite(x) & isfinite(y);
|
||||
if sum(valid) < options.polyorder + 1
|
||||
continue;
|
||||
|
||||
if sum(valid) < options.polyorder+1
|
||||
continue
|
||||
end
|
||||
|
||||
xf = linspace(min(x(valid)), max(x(valid)), 200);
|
||||
xf = linspace(min(x(valid)),max(x(valid)),200);
|
||||
|
||||
% ----- choose fitting method -----
|
||||
switch lower(options.fitmethod)
|
||||
case "polyfit"
|
||||
p = polyfit(x(valid), y(valid), options.polyorder);
|
||||
yf = polyval(p, xf);
|
||||
p = polyfit(x(valid),y(valid),options.polyorder);
|
||||
yf = polyval(p,xf);
|
||||
|
||||
case "smoothingspline"
|
||||
try
|
||||
f = fit(x(valid)', y(valid)', 'smoothingspline');
|
||||
yf = feval(f, xf);
|
||||
f = fit(x(valid),y(valid),'smoothingspline');
|
||||
yf = feval(f,xf);
|
||||
catch
|
||||
yf = interp1(x(valid), y(valid), xf, 'pchip');
|
||||
yf = interp1(x(valid),y(valid),xf,'pchip');
|
||||
end
|
||||
|
||||
case "loess"
|
||||
yf = smooth(x(valid), y(valid), 0.2, 'loess');
|
||||
yf = interp1(x(valid), yf, xf, 'linear', 'extrap');
|
||||
ys = smooth(x(valid),y(valid),0.2,'loess');
|
||||
yf = interp1(x(valid),ys,xf,'linear','extrap');
|
||||
|
||||
case "pchip"
|
||||
yf = interp1(x(valid), y(valid), xf, 'pchip');
|
||||
yf = interp1(x(valid),y(valid),xf,'pchip');
|
||||
|
||||
otherwise
|
||||
warning('Unknown fitmethod "%s". Using polyfit.', options.fitmethod);
|
||||
p = polyfit(x(valid), y(valid), options.polyorder);
|
||||
yf = polyval(p, xf);
|
||||
p = polyfit(x(valid),y(valid),options.polyorder);
|
||||
yf = polyval(p,xf);
|
||||
end
|
||||
|
||||
% --- lightened color for fit overlay
|
||||
lightcol = lines(i).Color + 0.4 * (1 - lines(i).Color);
|
||||
lightcol(lightcol > 1) = 1;
|
||||
lightcol = ln.Color + 0.4*(1-ln.Color);
|
||||
lightcol(lightcol>1)=1;
|
||||
|
||||
plot(xf, yf, '-', 'Color', lightcol, ...
|
||||
'LineWidth', 0.7, 'Marker', 'none', ...
|
||||
plot(xf,yf,'-','Color',lightcol,...
|
||||
'LineWidth',0.7,'Marker','none',...
|
||||
'HandleVisibility','off');
|
||||
end
|
||||
hold off
|
||||
end
|
||||
|
||||
% --- axis scaling and cosmetics
|
||||
% ---------------------------------------------------------
|
||||
% Axes formatting (matches first script)
|
||||
% ---------------------------------------------------------
|
||||
if options.logscale
|
||||
set(gca, 'YScale', 'log');
|
||||
set(ax,'YScale','log')
|
||||
end
|
||||
|
||||
% --- Figure size in centimeters ---
|
||||
% width_pt = 500;
|
||||
% height_pt = 300;
|
||||
%
|
||||
% pt2cm = 0.03514598; % TeX point → cm
|
||||
% width_cm = width_pt * pt2cm; % = 8.85 cm
|
||||
% height_cm = height_pt * pt2cm; % = 2.81 cm
|
||||
%
|
||||
% set(gcf, 'Units', 'centimeters', 'Position', [2 2 width_cm height_cm]);
|
||||
% set(gcf, 'PaperUnits', 'centimeters', 'PaperPosition', [0 0 width_cm height_cm]);
|
||||
grid(ax,'on')
|
||||
set(ax,'GridLineStyle','--',...
|
||||
'GridLineWidth',0.5,...
|
||||
'MinorGridLineWidth',0.5)
|
||||
|
||||
% --- Formatting ---
|
||||
set(findall(gca, '-property', 'Interpreter'), 'Interpreter', 'latex');
|
||||
set(gcf, 'Color', 'w');
|
||||
set(gca, 'Box', 'on', 'LineWidth', 0.8);
|
||||
grid on;
|
||||
set(gca, 'FontSize', 10, 'FontName', 'Latin Modern Roman');
|
||||
set(ax,'FontSize',12,...
|
||||
'Box','on',...
|
||||
'LineWidth',0.8)
|
||||
|
||||
set(findall(ax,'-property','Interpreter'),'Interpreter','latex')
|
||||
set(gcf,'Color','w')
|
||||
|
||||
end
|
||||
|
||||
% ---------------------------------------------------------
|
||||
% Fallback palette (only used if linspecer is missing)
|
||||
% ---------------------------------------------------------
|
||||
function cmap = linespecer_fallback(n)
|
||||
cmap = lines(n);
|
||||
end
|
||||
|
||||
@@ -29,36 +29,19 @@ set(gca,'FontSize',12,'YScale','log');
|
||||
ylim([1e-6 1e3])
|
||||
xlim([-10 23])
|
||||
|
||||
% % Create textarrow
|
||||
% annotation(figure1,'textarrow',[0.564444444444444 0.548148148148148],...
|
||||
% [0.768523809523809 0.63047619047619],'String',{'(A)'});
|
||||
%
|
||||
% % Create doublearrow
|
||||
% annotation(figure1,'doublearrow',[0.724444444444444 0.699259259259259],...
|
||||
% [0.854238095238095 0.723809523809524]);
|
||||
%
|
||||
% % Create line
|
||||
% annotation(figure1,'line',[0.700740740740741 0.699259259259259],...
|
||||
% [0.554285714285714 0.405714285714286]);
|
||||
%
|
||||
% % Create textbox
|
||||
% annotation(figure1,'textbox',...
|
||||
% [0.578777777777778 0.194285714285714 0.104185185185185 0.0685714285714286],...
|
||||
% 'String',{'BOX'},...
|
||||
% 'FitBoxToText','off');
|
||||
|
||||
%
|
||||
fig_path = 'C:\Users\Silas\Documents\Dissertation\00_Examples\tikz\textfig.tikz';
|
||||
matlab2tikz(fig_path, ...
|
||||
'width','\fwidth', ...
|
||||
'height','\fheight', ...
|
||||
'showInfo',false, ...
|
||||
'extraAxisOptions',{ ...
|
||||
'legend style={font=\footnotesize}', ...
|
||||
'xlabel style={font=\color{white!15!black},font=\small},',...
|
||||
'ylabel style={font=\color{white!15!black},font=\small},',...
|
||||
'legend columns=1', ...
|
||||
'every axis/.append style={font=\scriptsize}',...
|
||||
'legend columns=2',...
|
||||
'legend style={at={(0.02,0.98)},font=\footnotesize,draw=black!60,rounded corners=2pt,inner sep=1pt,fill=white,column sep=6pt,anchor= north west}',...
|
||||
});
|
||||
% fig_path = 'C:\Users\Silas\Documents\Dissertation\00_Examples\tikz\textfig.tikz';
|
||||
% matlab2tikz(fig_path, ...
|
||||
% 'width','\fwidth', ...
|
||||
% 'height','\fheight', ...
|
||||
% 'showInfo',false, ...
|
||||
% 'extraAxisOptions',{ ...
|
||||
% 'legend style={font=\footnotesize}', ...
|
||||
% 'xlabel style={font=\color{white!15!black},font=\small},',...
|
||||
% 'ylabel style={font=\color{white!15!black},font=\small},',...
|
||||
% 'legend columns=1', ...
|
||||
% 'every axis/.append style={font=\scriptsize}',...
|
||||
% 'legend columns=2',...
|
||||
% 'legend style={at={(0.02,0.98)},font=\footnotesize,draw=black!60,rounded corners=2pt,inner sep=1pt,fill=white,column sep=6pt,anchor= north west}',...
|
||||
% });
|
||||
@@ -13,17 +13,22 @@ fp.where('Runs','pam_level','EQUALS', 4);
|
||||
fp.where('Runs','rop_attenuation','EQUALS', 0);
|
||||
fp.where('Runs','is_mpi','EQUALS', 0);
|
||||
fp.where('Runs', 'db_mode','EQUALS', 0);
|
||||
fields = db.getTableFieldNames('Runs');
|
||||
% fields = db.getTableFieldNames('Runs');
|
||||
% [dataTable,~] = db.queryDB(fp, fields);
|
||||
fields = db.getTableFieldNames('power_state_info');
|
||||
fields = [fields; db.getTableFieldNames('Runs')];
|
||||
fields = [fields; db.getTableFieldNames('dashboard_ungrouped_alltime')]; %dashboard_ungrouped_after_nov_2025 dashboard_ungrouped_aug_nov_2025
|
||||
fields = unique(fields);
|
||||
[dataTable,~] = db.queryDB(fp, fields);
|
||||
|
||||
|
||||
fsym = dataTable.symbolrate;
|
||||
M = double(dataTable.pam_level);
|
||||
duob_mode = db_mode(strrep(dataTable.db_mode,'"',''));
|
||||
fsym = dataTable(1,:).symbolrate;
|
||||
M = double(dataTable(1,:).pam_level);
|
||||
duob_mode = db_mode(strrep(dataTable(1,:).db_mode,'"',''));
|
||||
|
||||
|
||||
% Load and Sync signal data from DB
|
||||
[Tx_bits, Symbols, Scpe_cell, ~] = loadAndSyncSignalDataFromDb(dataTable, dsp_options);
|
||||
[Tx_bits, Symbols, Scpe_cell, ~] = loadAndSyncSignalDataFromDb(dataTable(1,:), dsp_options);
|
||||
|
||||
% Preprocess signal
|
||||
Scpe_sig = preprocessSignal(Scpe_cell{1}, Symbols, fsym);
|
||||
@@ -31,6 +36,40 @@ Scpe_sig = preprocessSignal(Scpe_cell{1}, Symbols, fsym);
|
||||
% Show spectrum
|
||||
Scpe_sig.spectrum("fignum",1,"displayname",'Rx')
|
||||
|
||||
% meta = struct();
|
||||
% meta.varnames = dataTable.Properties.VariableNames;
|
||||
%
|
||||
% for k = 1:numel(meta.varnames)
|
||||
% v = meta.varnames{k};
|
||||
% col = dataTable.(v);
|
||||
%
|
||||
% if isnumeric(col) || islogical(col)
|
||||
% meta.(v) = col;
|
||||
% elseif isstring(col)
|
||||
% meta.(v) = cellstr(col);
|
||||
% elseif iscellstr(col)
|
||||
% meta.(v) = col;
|
||||
% else
|
||||
% error("Unsupported table column type: %s", class(col))
|
||||
% end
|
||||
% end
|
||||
% exp_data.metadata = meta;
|
||||
|
||||
exp_data = struct();
|
||||
exp_data.metadata = dataTable;
|
||||
exp_data.tx_bits = Tx_bits.signal;
|
||||
exp_data.tx_signal = Symbols.signal;
|
||||
exp_data.rx_signal_2sps = Scpe_sig.signal;
|
||||
|
||||
fname = dataTable(1,:).rx_raw_path;
|
||||
[~, filename, ext] = fileparts(fname);
|
||||
filename = strrep(filename,"_raw_signal","");
|
||||
filename = filename + ext;
|
||||
savepath = fullfile('F:\2024\sioe_labor\export_skuehl\',filename);
|
||||
save(savepath,'exp_data','-v7.3');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
% Silas Amplifier characterization
|
||||
|
||||
laser = Exfo_laser("mainframe_channel",1,"safety_mode",0,"connection_id",'10','lab_interface','gpib');
|
||||
laser.getLaserInfo();
|
||||
laser.disableLaser;
|
||||
laser.setWavelength(1310);
|
||||
laser.enableLaser;
|
||||
|
||||
% pm = OptPowerMeter8153A("active",[0,1],"wavelength_nm",[1550,1310]);
|
||||
% pm.readPower
|
||||
|
||||
% pdfa = Thor_PDFA();
|
||||
%%
|
||||
params.laserpower = [-30,-20,-10,0];
|
||||
params.lambda = [1260:5:1360]; %calcWavelengthPlan(16, 400e9 , 1310);
|
||||
params.pump = [50,75,100];
|
||||
|
||||
wh = DataStorage(params);
|
||||
wh.addStorage("spectrum_osa");
|
||||
wh.addStorage("wavelength_osa");
|
||||
wh.addStorage("psig_osa");
|
||||
wh.addStorage("pase_osa");
|
||||
wh.addStorage("osnr_osa");
|
||||
wh.addStorage("amp_gain");
|
||||
wh.addStorage("psig_total");
|
||||
|
||||
cols = linspecer(numel(params.laserpower));
|
||||
ccnt = 0;
|
||||
for p = params.laserpower
|
||||
ccnt=ccnt+1;
|
||||
laser.setWavelength(params.lambda(1));
|
||||
usrcmd = sprintf('Laser to %d dBm',p);
|
||||
waitUntilClick('Text',usrcmd);
|
||||
|
||||
for pmp = params.pump
|
||||
% pdfa.setPumpLevel(pmp);
|
||||
usrcmd = sprintf('Amp to %d mA',2*pmp);
|
||||
waitUntilClick('Text',usrcmd);
|
||||
|
||||
for w = params.lambda
|
||||
laser.setWavelength(w)
|
||||
% pm.setWavelength([1550, w]);
|
||||
span_nm = 5;
|
||||
lambda_c_nm = w;
|
||||
osa = OSA_Advantest( ...
|
||||
'span_nm', 40, ...
|
||||
'lambda_c_nm', w, ...
|
||||
'resolution_nm', 0.1, ...
|
||||
'sampling_points', 1001 );
|
||||
osa.configure();
|
||||
|
||||
|
||||
|
||||
% OSA
|
||||
[lambda_nm, psd_dBm] = osa.measure();
|
||||
osnr = osa.computeOSNR('bw_signal_nm',0.01,'ref_bw_nm',0.1,'debugplots',0,...
|
||||
'carrier_frequency',w,'noise_guard_nm',1,'noise_window_nm',1);
|
||||
|
||||
osa.plot("FigureNumber",pmp+1,"Color",cols(ccnt,:));
|
||||
xlabel('Wavelength [nm]');
|
||||
ylabel('Opt. Spectrum [dBm]');
|
||||
xlim([params.lambda(1)-5 params.lambda(end)+5])
|
||||
grid minor
|
||||
|
||||
% Powermeter
|
||||
totalpower=10*log10(sum(10.^(psd_dBm./10)));
|
||||
% [totalpower]=pm.readPower;
|
||||
% totalpower=totalpower(2) + 20; %20dB attenuation with eigenlight to satisfy 3dB max of PMeter
|
||||
|
||||
wh.addValueToStorage(lambda_nm,'wavelength_osa',p,w,pmp);
|
||||
wh.addValueToStorage(psd_dBm,'spectrum_osa',p,w,pmp);
|
||||
wh.addValueToStorage(osnr.p_ase_db,'pase_osa',p,w,pmp);
|
||||
wh.addValueToStorage(osnr.p_sig_db,'psig_osa',p,w,pmp);
|
||||
wh.addValueToStorage(osnr,'osnr_osa',p,w,pmp);
|
||||
wh.addValueToStorage(totalpower,'psig_total',p,w,pmp);
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
% before tuning all the way back to 1270nm set PDFA off
|
||||
% pdfa.setPumpLevel(0);
|
||||
% pdfa.disablePDFA;
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
%% OSNR
|
||||
|
||||
figure(2);hold on
|
||||
for p = [-30:10:0]
|
||||
pmp = 100;
|
||||
osnr = wh.getStoValue('osnr_osa',p,params.lambda,pmp);
|
||||
osnr_measured_dB = cellfun(@(x) x.measured_dB, osnr);
|
||||
osnr_direct_dB = cellfun(@(x) x.direct_dB, osnr);
|
||||
plot(params.lambda,osnr_direct_dB,'DisplayName',sprintf('P_{in}: %d dB ',p));
|
||||
end
|
||||
legend
|
||||
|
||||
%% P out
|
||||
|
||||
figure(3);hold on
|
||||
for p = [-30:10:0]
|
||||
pmp = 100;
|
||||
psig_osa = wh.getStoValue('psig_osa',p,params.lambda,pmp)+3;
|
||||
pl=plot(params.lambda,psig_osa,'DisplayName',sprintf('P_{signal}: %d dB ',p));
|
||||
|
||||
psig_powermeter = wh.getStoValue('psig_total',p,params.lambda,pmp)+3;
|
||||
plot(params.lambda,psig_powermeter,'DisplayName',sprintf('P_{total}: %d dB ',p),'LineStyle','--','Color',pl.Color);
|
||||
|
||||
yline(p,'Color',pl.Color,'DisplayName',sprintf('P_{total}: %d dB ',p));
|
||||
end
|
||||
legend
|
||||
|
||||
%% GAIN
|
||||
|
||||
figure(3);hold on
|
||||
for p = [-30:10:0]
|
||||
|
||||
pmp = 50;
|
||||
psig_osa = wh.getStoValue('psig_osa',p,params.lambda,pmp);
|
||||
% psig_powermeter = wh.getStoValue('psig_powermeter',p,params.lambda,pmp);
|
||||
|
||||
g = psig_osa-p;
|
||||
pl=plot(params.lambda,g,'DisplayName',sprintf('P_{in}: %d dB ',p));
|
||||
end
|
||||
legend
|
||||
@@ -1,54 +0,0 @@
|
||||
laser = Exfo_laser("mainframe_channel",1,"safety_mode",0,"connection_id",'10','lab_interface','gpib');
|
||||
laser.getLaserInfo();
|
||||
|
||||
pm = OptPowerMeter8153A("active",[0,1],"wavelength_nm",[1550,start_wavelength]);
|
||||
pm.readPower
|
||||
|
||||
laserparams.lambda = [1260:2:1360];
|
||||
laserparams.laserpower = [0,3,6,8,10];
|
||||
laser_output_wh = DataStorage(laserparams);
|
||||
laser_output_wh.addStorage("plaser");
|
||||
|
||||
pm = OptPowerMeter8153A("active",[0,1],"wavelength_nm",[1550,1310]);
|
||||
laser.setWavelength(1310);
|
||||
|
||||
cw_pwr = NaN(numel(laserparams.laserpower),numel(laserparams.lambda));
|
||||
row = 1;
|
||||
for p = laserparams.laserpower
|
||||
laser.setPower(p);
|
||||
cnt = 1;
|
||||
for w = laserparams.lambda
|
||||
laser.setWavelength(w);
|
||||
pm.setWavelength([1550,w]);
|
||||
|
||||
for i = 1:20
|
||||
[totalpower]=pm.readPower;
|
||||
cw_measurement(i)=totalpower(2)+10;
|
||||
cw_pwr(row,cnt) = mean(cw_measurement);
|
||||
pause(3);
|
||||
end
|
||||
|
||||
laser_output_wh.addValueToStorage(cw_measurement,'plaser',w,p);
|
||||
|
||||
figure(2027);clf
|
||||
plot(laserparams.lambda,cw_pwr(1:row,:),'Marker','*');
|
||||
xlabel('Wavelength [nm]');
|
||||
ylabel('Laser Output Power [dBm]');
|
||||
ylim([0, 11]);
|
||||
xlim([laserparams.lambda(1) laserparams.lambda(end)])
|
||||
grid minor
|
||||
|
||||
cnt = cnt+1;
|
||||
end
|
||||
row = row+1;
|
||||
end
|
||||
|
||||
figure();hold on
|
||||
for p = laserparams.laserpower
|
||||
plot(laserparams.lambda,laser_output_wh.getStoValue('plaser',laserparams.lambda,p))
|
||||
end
|
||||
xlabel('Wavelength [nm]');
|
||||
ylabel('Laser Output Power [dBm]');
|
||||
ylim([0, 11]);
|
||||
xlim([laserparams.lambda(1) laserparams.lambda(end)])
|
||||
grid minor
|
||||
Reference in New Issue
Block a user