Add Datastorage
This commit is contained in:
@@ -0,0 +1,157 @@
|
||||
function plotBerVsZdwFailureRate(wh,plotJob)
|
||||
|
||||
fig = findall(groot, 'Type', 'figure', 'Name', plotJob.figName);
|
||||
|
||||
if isvalid(fig)
|
||||
figure(fig)
|
||||
fig = get(fig);
|
||||
AxesMain = fig.CurrentAxes;
|
||||
hold on
|
||||
else
|
||||
fig = figure('name',char(plotJob.figName));
|
||||
AxesMain = gca;
|
||||
hold on
|
||||
end
|
||||
|
||||
|
||||
col = plotJob.color;
|
||||
|
||||
% we want to fetch all realizations
|
||||
realization = wh.parameter.realization.values(1:end);
|
||||
|
||||
% get all xAxis values
|
||||
xAxis = wh.parameter.p_out.values;
|
||||
|
||||
% get all center wavelengths
|
||||
wavelengths = wh.parameter.center_wavelength.values;
|
||||
%wavelengths = wavelengths(2:end);
|
||||
% totber = NaN(numel(realization),1,numel(xAxis),numel(wavelengths));
|
||||
% ber = zeros(numel(realization),plotJob.ch,numel(xAxis),numel(wavelengths));
|
||||
|
||||
%get BER values for query
|
||||
for w = 1:numel(wavelengths)
|
||||
|
||||
for xl = 1:numel(xAxis)
|
||||
|
||||
c_wavelen = wavelengths(w);
|
||||
p_out = xAxis(xl);
|
||||
|
||||
% dim1 : realiz; dim2: channels, dim3: rop, dim4, c_wavelength
|
||||
temp = removeZeros(wh.getStoValue('ber',plotJob.l,plotJob.d,plotJob.sgm,string(plotJob.pol),plotJob.p_in,p_out,plotJob.pmd,plotJob.gamma,realization,plotJob.ch,c_wavelen,plotJob.channelspacing,plotJob.randzdw));
|
||||
ber(1:size(temp,1),:,xl,w) = temp;
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
hdfec = 3.8e-3.*ones(size(xAxis));
|
||||
zdw_ = [];
|
||||
zdw_chann = [];
|
||||
zdw_tot = [];
|
||||
cf_tot = [];
|
||||
cf_ = [];
|
||||
S = [];
|
||||
Stot = [];
|
||||
S_chann = [];
|
||||
cf_chann = [];
|
||||
|
||||
cnt = 0;
|
||||
%get fec thresholds
|
||||
%linear = squeeze(linear);
|
||||
for c_wavelen = 1:size(ber,4)
|
||||
for realiz = 1:size(ber,1)
|
||||
for chann = 1:size(ber,2)
|
||||
|
||||
%finde Schnittpunkt zwischen FEC und BER Kurve
|
||||
temp_ber = squeeze(ber(realiz,chann,:,c_wavelen)).';
|
||||
if ~all(temp_ber == 0)
|
||||
%nur wenn nicht alles nullen sind
|
||||
crossing_ch = InterX([hdfec;xAxis],[temp_ber;xAxis]);
|
||||
else
|
||||
continue
|
||||
end
|
||||
|
||||
%Req. FEC Ergebnis einsortieren
|
||||
if ~isempty(crossing_ch)
|
||||
if crossing_ch(2) == 0
|
||||
print("d")
|
||||
end
|
||||
S(realiz,chann,c_wavelen) = crossing_ch(2);
|
||||
else
|
||||
S(realiz,chann,c_wavelen) = -1;
|
||||
cnt = cnt +1;
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
temp_max = -inf;
|
||||
sum_FEC_not_crossed=[];
|
||||
sum_FEC_crossed=[];
|
||||
|
||||
threshold = plotJob.p_in - 10;
|
||||
|
||||
for i = 1:plotJob.ch
|
||||
hold on
|
||||
%S:: 1.dim: realiz; 2.dim: channel; 3.dim: center wavelength
|
||||
%squeeze a channel:
|
||||
temp_data = squeeze(S(:,i,:));
|
||||
|
||||
%remove realizations that have no entry (only zero)
|
||||
temp_data = removeZeros(temp_data);
|
||||
|
||||
%replace zeros with NAN (e.g. for the wavelengths that have missing realizations)
|
||||
temp_data(temp_data==0) = NaN;
|
||||
|
||||
%for current channel
|
||||
FEC_crossed = temp_data < threshold & ~isnan(temp_data);
|
||||
FEC_not_crossed = temp_data >= threshold & ~isnan(temp_data);
|
||||
|
||||
%sum over channels for overall picture
|
||||
sum_FEC_not_crossed(i,:) = sum(FEC_not_crossed);
|
||||
sum_FEC_crossed(i,:) = sum(FEC_crossed);
|
||||
|
||||
failure_rate_channelwise(i,:) = sum_FEC_not_crossed(i,:)./ ( sum_FEC_crossed(i,:) + sum_FEC_not_crossed(i,:));
|
||||
|
||||
end
|
||||
|
||||
failure_rate_total = sum(sum_FEC_not_crossed,1) ./ ( sum(sum_FEC_crossed,1) + sum(sum_FEC_not_crossed,1) );
|
||||
% plot failure rate (nbetween 0 and 1)
|
||||
|
||||
plot(wavelengths,failure_rate_total,'Color',plotJob.color,'LineWidth',1,'LineStyle',plotJob.plotTypeArg,'Marker','x','MarkerSize',5,'MarkerFaceColor',plotJob.color,'DisplayName',plotJob.displayname);
|
||||
|
||||
%plot max overall
|
||||
%scatter(wavelengths,failure_rate_channelwise ,35,plotJob.color,'Marker','.');
|
||||
|
||||
ylabel('Failure Rate of Link');
|
||||
xlabel('Wavelength in nm');
|
||||
|
||||
xlim([min(wavelengths),max(wavelengths) ]);
|
||||
ylim([0,1]);
|
||||
|
||||
grid minor;
|
||||
set(gca, 'color', 'none');
|
||||
legend = [];
|
||||
|
||||
% fontsize(AxesMain,8,"points")
|
||||
|
||||
fig.Position = plotJob.Position;
|
||||
fig.Units = "centimeters";
|
||||
fig.Position = [0 0 12 5 7];
|
||||
|
||||
try
|
||||
set(AxesMain,'TickLabelInterpreter','latex')
|
||||
|
||||
set(AxesMain.Legend,'Interpreter','latex')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function vec = removeZeros(vec)
|
||||
% Find rows that contain only zeros
|
||||
rows_to_remove = all(vec == 0, 2);
|
||||
|
||||
% Remove rows with only zeros
|
||||
vec(rows_to_remove, :) = [];
|
||||
end
|
||||
Reference in New Issue
Block a user