Skip to content

Commit

Permalink
fix plot bug: do not overwrite the path used for plot
Browse files Browse the repository at this point in the history
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 <[email protected]>
Change-Id: I0351c37de0d74391ebeb68e974b777b1f51572aa
  • Loading branch information
EstherLerouzic committed Jan 10, 2025
1 parent 4b50ee0 commit 4ef01d5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gnpy/tools/cli_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,22 +225,22 @@ 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:')
else:
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)
Expand Down

0 comments on commit 4ef01d5

Please sign in to comment.