Simplify logic for showing per-channel results

As Jonas pointed out, the code used to contain a check for non-nan
values, effectively skipping channels where the Raman gain was not
explicitly computed.

Now that we do not introduce NaNs into some channels anymore, this
shortcut no longer works. We could either add explicit filtering for
only showing those channels which are covered by the Raman engine, but
then the result would be rather confusing in the non-Raman case. One
could also add another column with the simulated vs. approximated NLI,
but when I tried this, the output looked a bit cluttered.

I think that the best course of action for now is to just show info
about all channels (if asked by the user). So this is just a cleanup for
a condition which is now always on.
This commit is contained in:
Jan Kundrát
2019-09-02 18:19:37 +02:00
parent 54bf426472
commit 6f93b64f84

View File

@@ -18,7 +18,7 @@ from pathlib import Path
from json import loads
from collections import Counter
from logging import getLogger, basicConfig, INFO, ERROR, DEBUG
from numpy import linspace, mean, log10, isnan
from numpy import linspace, mean, log10
from matplotlib.pyplot import show, axis, figure, title, text
from networkx import (draw_networkx_nodes, draw_networkx_edges,
draw_networkx_labels, dijkstra_path)
@@ -299,9 +299,8 @@ if __name__ == '__main__':
ch_power = 10 * log10(final_carrier.power.signal)
ch_snr_nl = ch_power - 10 * log10(final_carrier.power.nli)
ch_snr = ch_power - 10 * log10(final_carrier.power.nli + final_carrier.power.ase)
if not isnan(ch_snr):
print(f'{final_carrier.channel_number} \t\t {round(ch_freq, 2):.2f} \t\t\t {round(ch_snr_nl, 2):.2f} '
f'\t\t\t\t {round(ch_snr, 2):.2f}')
print(f'{final_carrier.channel_number} \t\t {round(ch_freq, 2):.2f} \t\t\t {round(ch_snr_nl, 2):.2f} '
f'\t\t\t\t {round(ch_snr, 2):.2f}')
if not args.source:
print(f'\n(No source node specified: picked {source.uid})')