minimal examplw
This commit is contained in:
@@ -51,7 +51,7 @@ classdef DBHandler < handle
|
|||||||
"Vendor", "MySQL", ...
|
"Vendor", "MySQL", ...
|
||||||
"Server", "134.245.243.254", ...
|
"Server", "134.245.243.254", ...
|
||||||
"PortNumber", 3306, ...
|
"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
|
end
|
||||||
|
|
||||||
catch e
|
catch e
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ switch precode_mode
|
|||||||
tx_bits_demapped = mapper.demap(tx_symbols);
|
tx_bits_demapped = mapper.demap(tx_symbols);
|
||||||
rx_bits = mapper.demap(eq_signal_hd);
|
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);
|
[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
|
end
|
||||||
|
|
||||||
function displayAnalysis(eq_noise, eq_signal_sd, rx_signal, eq_, tx_symbols, M, postFFE)
|
function displayAnalysis(eq_noise, eq_signal_sd, rx_signal, eq_, tx_symbols, M, postFFE)
|
||||||
|
|||||||
@@ -1,113 +1,151 @@
|
|||||||
function beautifyBERplot(options)
|
function beautifyBERplot(options)
|
||||||
% BEAUTIFYBERPLOT Enhances BER-style plots for publication-quality figures.
|
% BEAUTIFYBERPLOT Publication-style beautification for BER / NSD plots.
|
||||||
% Supports automatic smoothing and trend-line overlay.
|
% Style aligned to manual plotting script (lw=0.8, ms=4, white markers).
|
||||||
%
|
%
|
||||||
% Usage examples:
|
% Usage examples:
|
||||||
% beautifyBERplot; % default
|
% beautifyBERplot
|
||||||
% beautifyBERplot("polyfit",1); % add polynomial fit
|
% beautifyBERplot("polyfit",true,"polyorder",1)
|
||||||
% beautifyBERplot("polyfit",1,"fitmethod","pchip") % piecewise cubic fit
|
% beautifyBERplot("polyfit",true,"fitmethod","pchip")
|
||||||
%
|
|
||||||
% Supported fitmethod options: 'polyfit', 'smoothingspline', 'loess', 'pchip'
|
|
||||||
|
|
||||||
arguments
|
arguments
|
||||||
options.logscale (1,1) logical = 1
|
options.logscale (1,1) logical = 1
|
||||||
options.setmarkers (1,1) logical = 1;
|
options.setmarkers (1,1) logical = 1
|
||||||
options.polyfit (1,1) logical = 0
|
options.setcolors (1,1) logical = 1
|
||||||
options.polyorder (1,1) double = 2
|
options.polyfit (1,1) logical = 0
|
||||||
options.fitmethod (1,1) string = "polyfit" % choose fit type
|
options.polyorder (1,1) double = 2
|
||||||
|
options.fitmethod (1,1) string = "polyfit"
|
||||||
end
|
end
|
||||||
|
|
||||||
% --- find all line objects in current axes
|
ax = gca;
|
||||||
lines = findall(gca, 'Type', 'Line');
|
|
||||||
markers = {'o', 's', 'd', '^', 'v', '>', '<', 'p', 'h'};
|
|
||||||
num_markers = length(markers);
|
|
||||||
|
|
||||||
% --- style all lines consistently
|
% ---------------------------------------------------------
|
||||||
for i = 1:length(lines)
|
% Extract *only* real data lines from ax.Children
|
||||||
lines(i).LineWidth = 1.2;
|
% ---------------------------------------------------------
|
||||||
% lines(i).LineStyle = '-';
|
children = ax.Children;
|
||||||
if options.setmarkers == 1
|
isLine = arrayfun(@(h) isa(h,'matlab.graphics.chart.primitive.Line'), children);
|
||||||
if string(lines(i).Marker) == "none"
|
lines = children(isLine);
|
||||||
lines(i).Marker = markers{mod(i-1, num_markers) + 1};
|
|
||||||
|
% 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
|
end
|
||||||
lines(i).MarkerSize = 4;
|
ln.MarkerSize = ms;
|
||||||
lines(i).MarkerFaceColor = lines(i).Color;
|
if options.setcolors
|
||||||
|
ln.MarkerEdgeColor = cmap(i,:);
|
||||||
|
end
|
||||||
|
ln.MarkerFaceColor = [1 1 1];
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
% --- optional smoothing/fitting overlay
|
% ---------------------------------------------------------
|
||||||
|
% Optional smoothing / fitting overlay
|
||||||
|
% ---------------------------------------------------------
|
||||||
if options.polyfit
|
if options.polyfit
|
||||||
hold on
|
hold on
|
||||||
for i = 1:length(lines)
|
for i = 1:n
|
||||||
x = lines(i).XData;
|
ln = lines(n-i+1);
|
||||||
y = lines(i).YData;
|
x = ln.XData(:);
|
||||||
|
y = ln.YData(:);
|
||||||
valid = isfinite(x) & isfinite(y);
|
valid = isfinite(x) & isfinite(y);
|
||||||
if sum(valid) < options.polyorder + 1
|
|
||||||
continue;
|
if sum(valid) < options.polyorder+1
|
||||||
|
continue
|
||||||
end
|
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)
|
switch lower(options.fitmethod)
|
||||||
case "polyfit"
|
case "polyfit"
|
||||||
p = polyfit(x(valid), y(valid), options.polyorder);
|
p = polyfit(x(valid),y(valid),options.polyorder);
|
||||||
yf = polyval(p, xf);
|
yf = polyval(p,xf);
|
||||||
|
|
||||||
case "smoothingspline"
|
case "smoothingspline"
|
||||||
try
|
try
|
||||||
f = fit(x(valid)', y(valid)', 'smoothingspline');
|
f = fit(x(valid),y(valid),'smoothingspline');
|
||||||
yf = feval(f, xf);
|
yf = feval(f,xf);
|
||||||
catch
|
catch
|
||||||
yf = interp1(x(valid), y(valid), xf, 'pchip');
|
yf = interp1(x(valid),y(valid),xf,'pchip');
|
||||||
end
|
end
|
||||||
|
|
||||||
case "loess"
|
case "loess"
|
||||||
yf = smooth(x(valid), y(valid), 0.2, 'loess');
|
ys = smooth(x(valid),y(valid),0.2,'loess');
|
||||||
yf = interp1(x(valid), yf, xf, 'linear', 'extrap');
|
yf = interp1(x(valid),ys,xf,'linear','extrap');
|
||||||
|
|
||||||
case "pchip"
|
case "pchip"
|
||||||
yf = interp1(x(valid), y(valid), xf, 'pchip');
|
yf = interp1(x(valid),y(valid),xf,'pchip');
|
||||||
|
|
||||||
otherwise
|
otherwise
|
||||||
warning('Unknown fitmethod "%s". Using polyfit.', options.fitmethod);
|
p = polyfit(x(valid),y(valid),options.polyorder);
|
||||||
p = polyfit(x(valid), y(valid), options.polyorder);
|
yf = polyval(p,xf);
|
||||||
yf = polyval(p, xf);
|
|
||||||
end
|
end
|
||||||
|
|
||||||
% --- lightened color for fit overlay
|
lightcol = ln.Color + 0.4*(1-ln.Color);
|
||||||
lightcol = lines(i).Color + 0.4 * (1 - lines(i).Color);
|
lightcol(lightcol>1)=1;
|
||||||
lightcol(lightcol > 1) = 1;
|
|
||||||
|
|
||||||
plot(xf, yf, '-', 'Color', lightcol, ...
|
plot(xf,yf,'-','Color',lightcol,...
|
||||||
'LineWidth', 0.7, 'Marker', 'none', ...
|
'LineWidth',0.7,'Marker','none',...
|
||||||
'HandleVisibility','off');
|
'HandleVisibility','off');
|
||||||
end
|
end
|
||||||
hold off
|
hold off
|
||||||
end
|
end
|
||||||
|
|
||||||
% --- axis scaling and cosmetics
|
% ---------------------------------------------------------
|
||||||
|
% Axes formatting (matches first script)
|
||||||
|
% ---------------------------------------------------------
|
||||||
if options.logscale
|
if options.logscale
|
||||||
set(gca, 'YScale', 'log');
|
set(ax,'YScale','log')
|
||||||
end
|
end
|
||||||
|
|
||||||
% --- Figure size in centimeters ---
|
grid(ax,'on')
|
||||||
% width_pt = 500;
|
set(ax,'GridLineStyle','--',...
|
||||||
% height_pt = 300;
|
'GridLineWidth',0.5,...
|
||||||
%
|
'MinorGridLineWidth',0.5)
|
||||||
% 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]);
|
|
||||||
|
|
||||||
% --- Formatting ---
|
set(ax,'FontSize',12,...
|
||||||
set(findall(gca, '-property', 'Interpreter'), 'Interpreter', 'latex');
|
'Box','on',...
|
||||||
set(gcf, 'Color', 'w');
|
'LineWidth',0.8)
|
||||||
set(gca, 'Box', 'on', 'LineWidth', 0.8);
|
|
||||||
grid on;
|
|
||||||
set(gca, 'FontSize', 10, 'FontName', 'Latin Modern Roman');
|
|
||||||
|
|
||||||
|
set(findall(ax,'-property','Interpreter'),'Interpreter','latex')
|
||||||
|
set(gcf,'Color','w')
|
||||||
|
|
||||||
end
|
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])
|
ylim([1e-6 1e3])
|
||||||
xlim([-10 23])
|
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';
|
% fig_path = 'C:\Users\Silas\Documents\Dissertation\00_Examples\tikz\textfig.tikz';
|
||||||
matlab2tikz(fig_path, ...
|
% matlab2tikz(fig_path, ...
|
||||||
'width','\fwidth', ...
|
% 'width','\fwidth', ...
|
||||||
'height','\fheight', ...
|
% 'height','\fheight', ...
|
||||||
'showInfo',false, ...
|
% 'showInfo',false, ...
|
||||||
'extraAxisOptions',{ ...
|
% 'extraAxisOptions',{ ...
|
||||||
'legend style={font=\footnotesize}', ...
|
% 'legend style={font=\footnotesize}', ...
|
||||||
'xlabel style={font=\color{white!15!black},font=\small},',...
|
% 'xlabel style={font=\color{white!15!black},font=\small},',...
|
||||||
'ylabel style={font=\color{white!15!black},font=\small},',...
|
% 'ylabel style={font=\color{white!15!black},font=\small},',...
|
||||||
'legend columns=1', ...
|
% 'legend columns=1', ...
|
||||||
'every axis/.append style={font=\scriptsize}',...
|
% 'every axis/.append style={font=\scriptsize}',...
|
||||||
'legend columns=2',...
|
% '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}',...
|
% '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','rop_attenuation','EQUALS', 0);
|
||||||
fp.where('Runs','is_mpi','EQUALS', 0);
|
fp.where('Runs','is_mpi','EQUALS', 0);
|
||||||
fp.where('Runs', 'db_mode','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);
|
[dataTable,~] = db.queryDB(fp, fields);
|
||||||
|
|
||||||
|
|
||||||
fsym = dataTable.symbolrate;
|
fsym = dataTable(1,:).symbolrate;
|
||||||
M = double(dataTable.pam_level);
|
M = double(dataTable(1,:).pam_level);
|
||||||
duob_mode = db_mode(strrep(dataTable.db_mode,'"',''));
|
duob_mode = db_mode(strrep(dataTable(1,:).db_mode,'"',''));
|
||||||
|
|
||||||
|
|
||||||
% Load and Sync signal data from DB
|
% 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
|
% Preprocess signal
|
||||||
Scpe_sig = preprocessSignal(Scpe_cell{1}, Symbols, fsym);
|
Scpe_sig = preprocessSignal(Scpe_cell{1}, Symbols, fsym);
|
||||||
@@ -31,6 +36,40 @@ Scpe_sig = preprocessSignal(Scpe_cell{1}, Symbols, fsym);
|
|||||||
% Show spectrum
|
% Show spectrum
|
||||||
Scpe_sig.spectrum("fignum",1,"displayname",'Rx')
|
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