From 4ef01d54a55bcd35f2ec25df9ca77287e2f84113 Mon Sep 17 00:00:00 2001 From: EstherLerouzic Date: Fri, 10 Jan 2025 09:48:04 +0100 Subject: [PATCH] fix plot bug: do not overwrite the path used for plot The plot function failed to recognize 'path' as part of the network due to the reuse of the 'path' variable. This led to errors when attempting to plot. Solution is to use a different name for the deepcopy of path elements used to record the propagation results 'propagated_path'. Signed-off-by: EstherLerouzic Change-Id: I0351c37de0d74391ebeb68e974b777b1f51572aa --- gnpy/tools/cli_examples.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gnpy/tools/cli_examples.py b/gnpy/tools/cli_examples.py index 13c2cafbd..2218cb172 100644 --- a/gnpy/tools/cli_examples.py +++ b/gnpy/tools/cli_examples.py @@ -225,14 +225,14 @@ def transmission_main_example(args=None): + ' transceiver output power = ' + f'{pretty_summary_print(per_label_average(watt2dbm(infos.tx_power), infos.label))}dBm,\n' + f' nb_channels = {infos.number_of_channels})') - for path, power_dbm in zip(propagations_for_path, powers_dbm): + for mypath, power_dbm in zip(propagations_for_path, powers_dbm): if power_mode: print(f'Input optical power reference in span = {ansi_escapes.cyan}{power_dbm:.2f} ' + f'dBm{ansi_escapes.reset}:') else: print('\nPropagating in {ansi_escapes.cyan}gain mode{ansi_escapes.reset}: power cannot be set manually') if len(powers_dbm) == 1: - for elem in path: + for elem in mypath: print(elem) if power_mode: print(f'\nTransmission result for input optical power reference in span = {power_dbm:.2f} dBm:') @@ -240,7 +240,7 @@ def transmission_main_example(args=None): print('\nTransmission results:') print(f' Final GSNR (0.1 nm): {ansi_escapes.cyan}{mean(destination.snr_01nm):.02f} dB{ansi_escapes.reset}') else: - print(path[-1]) + print(mypath[-1]) if args.save_network is not None: save_network(network, args.save_network)