Creates a set of functions to be called by CLI and API

Instead of copying the CLI script in API code, use functions shared
by CLI and API

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: I3f9b30b8700b68237d0e80768db015d8dec3deb5
This commit is contained in:
EstherLerouzic
2024-01-16 17:00:32 +01:00
committed by Andrea D'Amico
parent ae858b911a
commit 30ead40e76
20 changed files with 659 additions and 242 deletions

View File

@@ -12,24 +12,21 @@ import argparse
import logging
import sys
from math import ceil
from numpy import linspace, mean
from numpy import mean
from pathlib import Path
from copy import deepcopy
import gnpy.core.ansi_escapes as ansi_escapes
from gnpy.core.elements import Transceiver, Fiber, RamanFiber
from gnpy.core.equipment import trx_mode_params
from gnpy.core.elements import Transceiver, Fiber, RamanFiber, Roadm
import gnpy.core.exceptions as exceptions
from gnpy.core.network import add_missing_elements_in_network, design_network
from gnpy.core.parameters import SimParams
from gnpy.core.utils import db2lin, lin2db, automatic_nch, watt2dbm, dbm2watt
from gnpy.topology.request import (ResultElement, jsontocsv, compute_path_dsjctn, requests_aggregation,
BLOCKING_NOPATH, correct_json_route_list,
deduplicate_disjunctions, compute_path_with_disjunction,
PathRequest, compute_constrained_path, propagate)
from gnpy.topology.spectrum_assignment import build_oms_list, pth_assign_spectrum
from gnpy.core.utils import lin2db, pretty_summary_print, per_label_average, watt2dbm
from gnpy.topology.request import (ResultElement, jsontocsv, BLOCKING_NOPATH)
from gnpy.tools.json_io import (load_equipment, load_network, load_json, load_requests, save_network,
requests_from_json, disjunctions_from_json, save_json, load_initial_spectrum)
requests_from_json, save_json, load_initial_spectrum)
from gnpy.tools.plots import plot_baseline, plot_results
from gnpy.tools.worker_utils import designed_network, transmission_simulation, planning
_logger = logging.getLogger(__name__)
_examples_dir = Path(__file__).parent.parent / 'example-data'
@@ -144,19 +141,17 @@ def transmission_main_example(args=None):
sys.exit()
# First try to find exact match if source/destination provided
source = None
if args.source:
source = transceivers.pop(args.source, None)
valid_source = True if source else False
else:
source = None
_logger.info('No source node specified: picking random transceiver')
destination = None
nodes_list = []
loose_list = []
if args.destination:
destination = transceivers.pop(args.destination, None)
valid_destination = True if destination else False
else:
destination = None
_logger.info('No destination node specified: picking random transceiver')
# If no exact match try to find partial match
if args.source and not source:
@@ -173,107 +168,72 @@ def transmission_main_example(args=None):
if not source:
source = list(transceivers.values())[0]
del transceivers[source.uid]
_logger.info('No source node specified: picking random transceiver')
if not destination:
destination = list(transceivers.values())[0]
nodes_list = [destination.uid]
loose_list = ['STRICT']
_logger.info('No destination node specified: picking random transceiver')
_logger.info(f'source = {args.source!r}')
_logger.info(f'destination = {args.destination!r}')
_logger.info(f'source = {source.uid!r}')
_logger.info(f'destination = {destination.uid!r}')
params = {}
params['request_id'] = 0
params['trx_type'] = ''
params['trx_mode'] = ''
params['source'] = source.uid
params['destination'] = destination.uid
params['bidir'] = False
params['nodes_list'] = [destination.uid]
params['loose_list'] = ['strict']
params['format'] = ''
params['path_bandwidth'] = 0
params['effective_freq_slot'] = None
trx_params = trx_mode_params(equipment)
trx_params['power'] = dbm2watt(equipment['SI']['default'].power_dbm)
trx_params['tx_power'] = dbm2watt(equipment['SI']['default'].power_dbm)
if args.power:
trx_params['power'] = dbm2watt(float(args.power))
trx_params['tx_power'] = dbm2watt(float(args.power))
params.update(trx_params)
initial_spectrum = None
params['nb_channel'] = automatic_nch(trx_params['f_min'], trx_params['f_max'], trx_params['spacing'])
# use ref_req to hold reference channel used for design and req for the propagation
# and req to hold channels to be propagated
# apply power sweep on the design and on the channels
ref_req = PathRequest(**params)
pref_ch_db = watt2dbm(ref_req.power)
if args.spectrum:
# use the spectrum defined by user for the propagation.
# the nb of channel for design remains the one of the reference channel
initial_spectrum = load_initial_spectrum(args.spectrum)
params['nb_channel'] = len(initial_spectrum)
print('User input for spectrum used for propagation instead of SI')
req = PathRequest(**params)
p_ch_db = watt2dbm(req.power)
req.initial_spectrum = initial_spectrum
print(f'There are {req.nb_channel} channels propagating')
power_mode = equipment['Span']['default'].power_mode
print('\n'.join([f'Power mode is set to {power_mode}',
'=> it can be modified in eqpt_config.json - Span']))
if not args.no_insert_edfas:
try:
add_missing_elements_in_network(network, equipment)
except exceptions.NetworkTopologyError as e:
print(f'{ansi_escapes.red}Invalid network definition:{ansi_escapes.reset} {e}')
sys.exit(1)
except exceptions.ConfigurationError as e:
print(f'{ansi_escapes.red}Configuration error:{ansi_escapes.reset} {e}')
sys.exit(1)
path = compute_constrained_path(network, req)
spans = [s.params.length for s in path if isinstance(s, RamanFiber) or isinstance(s, Fiber)]
power_range = [0]
if power_mode:
# power cannot be changed in gain mode
try:
p_start, p_stop, p_step = equipment['SI']['default'].power_range_db
p_num = abs(int(round((p_stop - p_start) / p_step))) + 1 if p_step != 0 else 1
power_range = list(linspace(p_start, p_stop, p_num))
except TypeError:
print('invalid power range definition in eqpt_config, should be power_range_db: [lower, upper, step]')
# initial network is designed using req.power. that is that any missing information (amp gain or delta_p) is filled
# using this req.power, previous to any sweep requested later on.
# Simulate !
try:
design_network(ref_req, network, equipment, set_connector_losses=True, verbose=True)
network, req, ref_req = designed_network(equipment, network, source.uid, destination.uid,
nodes_list=nodes_list, loose_list=loose_list,
args_power=args.power,
initial_spectrum=initial_spectrum,
no_insert_edfas=args.no_insert_edfas)
path, propagations_for_path, powers_dbm, infos = transmission_simulation(equipment, network, req, ref_req)
except exceptions.NetworkTopologyError as e:
print(f'{ansi_escapes.red}Invalid network definition:{ansi_escapes.reset} {e}')
sys.exit(1)
except exceptions.ConfigurationError as e:
print(f'{ansi_escapes.red}Configuration error:{ansi_escapes.reset} {e}')
sys.exit(1)
except exceptions.ServiceError as e:
print(f'Service error: {e}')
sys.exit(1)
except ValueError:
sys.exit(1)
# print or export results
spans = [s.params.length for s in path if isinstance(s, RamanFiber) or isinstance(s, Fiber)]
print(f'\nThere are {len(spans)} fiber spans over {sum(spans)/1000:.0f} km between {source.uid} '
f'and {destination.uid}')
print(f'\nNow propagating between {source.uid} and {destination.uid}:')
for dp_db in power_range:
ref_req.power = dbm2watt(pref_ch_db + dp_db)
req.power = dbm2watt(p_ch_db + dp_db)
design_network(ref_req, network, equipment, set_connector_losses=False, verbose=False)
# if initial spectrum did not contain any power, now we need to use this one.
# note the initial power defines a differential wrt req.power so that if req.power is set to 2mW (3dBm)
# and initial spectrum was set to 0, this sets a initial per channel delta power to -3dB, so that
# whatever the equalization, -3 dB is applied on all channels (ie initial power in initial spectrum pre-empts
# "--power" option)
print(f'Reference used for design: (Input optical power reference in span = {watt2dbm(ref_req.power):.2f}dBm,\n'
+ f' spacing = {ref_req.spacing * 1e-9:.2f}GHz\n'
+ f' nb_channels = {ref_req.nb_channel})')
print('\nChannels propagating: (Input optical power deviation in span = '
+ f'{pretty_summary_print(per_label_average(infos.delta_pdb_per_channel, infos.label))}dB,\n'
+ ' spacing = '
+ f'{pretty_summary_print(per_label_average(infos.slot_width * 1e-9, infos.label))}GHz,\n'
+ ' 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):
if power_mode:
print(f'\nPropagating with input power = {ansi_escapes.cyan}{watt2dbm(req.power):.2f} '
print(f'Input optical power reference in span = {ansi_escapes.cyan}{power_dbm:.2f} '
+ f'dBm{ansi_escapes.reset}:')
else:
print(f'\nPropagating in {ansi_escapes.cyan}gain mode{ansi_escapes.reset}: power cannot be set manually')
infos = propagate(path, req, equipment)
if len(power_range) == 1:
print('\nPropagating in gain mode: power cannot be set manually')
if len(powers_dbm) == 1:
for elem in path:
print(elem)
if power_mode:
print(f'\nTransmission result for input power = {lin2db(req.power*1e3):.2f} dBm:')
print(f'\nTransmission result for input optical power reference in span = {power_dbm:.2f} dBm:')
else:
print(f'\nTransmission results:')
print(f' Final GSNR (0.1 nm): {ansi_escapes.cyan}{mean(destination.snr_01nm):.02f} dB{ansi_escapes.reset}')
@@ -345,105 +305,41 @@ def path_requests_run(args=None):
_logger.info(f'Computing path requests {args.service_filename.name} into JSON format')
(equipment, network) = load_common_data(args.equipment, args.topology, args.sim_params, args.save_network_before_autodesign)
(equipment, network) = \
load_common_data(args.equipment, args.topology, args.sim_params, args.save_network_before_autodesign)
# Build the network once using the default power defined in SI in eqpt config
# TODO power density: db2linp(ower_dbm": 0)/power_dbm": 0 * nb channels as defined by
# spacing, f_min and f_max
if not args.no_insert_edfas:
try:
add_missing_elements_in_network(network, equipment)
except exceptions.NetworkTopologyError as e:
print(f'{ansi_escapes.red}Invalid network definition:{ansi_escapes.reset} {e}')
sys.exit(1)
except exceptions.ConfigurationError as e:
print(f'{ansi_escapes.red}Configuration error:{ansi_escapes.reset} {e}')
sys.exit(1)
if args.save_network is not None:
save_network(network, args.save_network)
print(f'Network (after autodesign) saved to {args.save_network}')
params = {
'request_id': 'reference',
'trx_type': '',
'trx_mode': '',
'source': None,
'destination': None,
'bidir': False,
'nodes_list': [],
'loose_list': [],
'format': '',
'path_bandwidth': 0,
'effective_freq_slot': None,
'nb_channel': automatic_nch(equipment['SI']['default'].f_min, equipment['SI']['default'].f_max,
equipment['SI']['default'].spacing),
'power': dbm2watt(equipment['SI']['default'].power_dbm),
'tx_power': dbm2watt(equipment['SI']['default'].power_dbm)
}
trx_params = trx_mode_params(equipment)
params.update(trx_params)
reference_channel = PathRequest(**params)
try:
design_network(reference_channel, network, equipment, verbose=True)
network, _, _ = designed_network(equipment, network, no_insert_edfas=args.no_insert_edfas)
data = load_requests(args.service_filename, equipment, bidir=args.bidir,
network=network, network_filename=args.topology)
_data = requests_from_json(data, equipment)
oms_list, propagatedpths, reversed_propagatedpths, rqs, dsjn, result = \
planning(network, equipment, data)
except exceptions.NetworkTopologyError as e:
print(f'{ansi_escapes.red}Invalid network definition:{ansi_escapes.reset} {e}')
sys.exit(1)
except exceptions.ConfigurationError as e:
print(f'{ansi_escapes.red}Configuration error:{ansi_escapes.reset} {e}')
sys.exit(1)
if args.save_network is not None:
save_network(network, args.save_network)
print(f'{ansi_escapes.blue}Network (after autodesign) saved to {args.save_network}{ansi_escapes.reset}')
oms_list = build_oms_list(network, equipment)
try:
data = load_requests(args.service_filename, equipment, bidir=args.bidir,
network=network, network_filename=args.topology)
rqs = requests_from_json(data, equipment)
except exceptions.ServiceError as e:
print(f'{ansi_escapes.red}Service error:{ansi_escapes.reset} {e}')
sys.exit(1)
# check that request ids are unique. Non unique ids, may
# mess the computation: better to stop the computation
all_ids = [r.request_id for r in rqs]
if len(all_ids) != len(set(all_ids)):
for item in list(set(all_ids)):
all_ids.remove(item)
msg = f'Requests id {all_ids} are not unique'
_logger.critical(msg)
sys.exit()
rqs = correct_json_route_list(network, rqs)
# pths = compute_path(network, equipment, rqs)
dsjn = disjunctions_from_json(data)
print(f'{ansi_escapes.blue}List of disjunctions{ansi_escapes.reset}')
print(dsjn)
# need to warn or correct in case of wrong disjunction form
# disjunction must not be repeated with same or different ids
dsjn = deduplicate_disjunctions(dsjn)
# Aggregate demands with same exact constraints
print(f'{ansi_escapes.blue}Aggregating similar requests{ansi_escapes.reset}')
rqs, dsjn = requests_aggregation(rqs, dsjn)
# TODO export novel set of aggregated demands in a json file
print(f'{ansi_escapes.blue}The following services have been requested:{ansi_escapes.reset}')
print(rqs)
print(f'{ansi_escapes.blue}Computing all paths with constraints{ansi_escapes.reset}')
try:
pths = compute_path_dsjctn(network, equipment, rqs, dsjn)
except exceptions.DisjunctionError as this_e:
print(f'{ansi_escapes.red}Disjunction error:{ansi_escapes.reset} {this_e}')
sys.exit(1)
print(f'{ansi_escapes.blue}Propagating on selected path{ansi_escapes.reset}')
propagatedpths, reversed_pths, reversed_propagatedpths = compute_path_with_disjunction(network, equipment, rqs, pths)
# Note that deepcopy used in compute_path_with_disjunction returns
# a list of nodes which are not belonging to network (they are copies of the node objects).
# so there can not be propagation on these nodes.
pth_assign_spectrum(pths, rqs, oms_list, reversed_pths)
except exceptions.ServiceError as e:
print(f'Service error: {e}')
sys.exit(1)
except ValueError:
sys.exit(1)
print(f'{ansi_escapes.blue}List of disjunctions{ansi_escapes.reset}')
print(dsjn)
print(f'{ansi_escapes.blue}The following services have been requested:{ansi_escapes.reset}')
print(_data)
print(f'{ansi_escapes.blue}Result summary{ansi_escapes.reset}')
header = ['req id', ' demand', ' GSNR@bandwidth A-Z (Z-A)', ' GSNR@0.1nm A-Z (Z-A)',

245
gnpy/tools/worker_utils.py Normal file
View File

@@ -0,0 +1,245 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
gnpy.tools.worker_utils
=======================
Common code for CLI examples and API
'''
import logging
from copy import deepcopy
from typing import Union, List, Tuple
from numpy import linspace
from networkx import DiGraph
from gnpy.core.utils import automatic_nch, watt2dbm, dbm2watt, pretty_summary_print, per_label_average
from gnpy.core.equipment import trx_mode_params
from gnpy.core.network import add_missing_elements_in_network, design_network
from gnpy.core import exceptions
from gnpy.core.info import SpectralInformation
from gnpy.topology.spectrum_assignment import build_oms_list, pth_assign_spectrum, OMS
from gnpy.topology.request import correct_json_route_list, deduplicate_disjunctions, requests_aggregation, \
compute_path_dsjctn, compute_path_with_disjunction, ResultElement, PathRequest, Disjunction, \
compute_constrained_path, propagate
from gnpy.tools.json_io import requests_from_json, disjunctions_from_json
logger = logging.getLogger(__name__)
def designed_network(equipment: dict, network: DiGraph, source: str = None, destination: str = None,
nodes_list: List[str] = None, loose_list: List[str] = None,
initial_spectrum: dict = None, no_insert_edfas: bool = False,
args_power: Union[str, float, int] = None,
service_req: PathRequest = None) -> Tuple[DiGraph, PathRequest, PathRequest]:
"""Build the reference channels based on inputs and design the network for this reference channel, and build the
channel to be propagated for the single transmission script.
Reference channel (target input power in spans, nb of channels, transceiver output power) is built using
equipment['SI'] information. If indicated, with target input power in spans is updated with args_power.
Channel to be propagated is using the same channel reference, except if different settings are provided
with service_req and initial_spectrum. The service to be propagated uses specified source, destination
and list nodes_list of include nodes constraint except if the service_req is specified.
Args:
- equipment: a dictionary containing equipment information.
- network: a directed graph representing the initial network.
- no_insert_edfas: a boolean indicating whether to insert EDFAs in the network.
- args_power: the power to be used for the network design.
- service_req: the service request the user wants to propagate.
- source: the source node for the channel to be propagated if no service_req is specified.
- destination: the destination node for the channel to be propagated if no service_req is specified.
- nodes_list: a list of nodes to be included ifor the channel to be propagated if no service_req is specified.
- loose_list: a list of loose nodes to be included in the network design.
- initial_spectrum: a dictionary representing the initial spectrum to propagate.
Returns:
- The designed network.
- The channel to propagate.
- The reference channel used for the design.
"""
if loose_list is None:
loose_list = []
if nodes_list is None:
nodes_list = []
if not no_insert_edfas:
add_missing_elements_in_network(network, equipment)
if not nodes_list:
if destination:
nodes_list = [destination]
loose_list = ['STRICT']
else:
nodes_list = []
loose_list = []
params = {
'request_id': 'reference',
'trx_type': '',
'trx_mode': '',
'source': source,
'destination': destination,
'bidir': False,
'nodes_list': nodes_list,
'loose_list': loose_list,
'format': '',
'path_bandwidth': 0,
'effective_freq_slot': None,
'nb_channel': automatic_nch(equipment['SI']['default'].f_min, equipment['SI']['default'].f_max,
equipment['SI']['default'].spacing),
'power': dbm2watt(equipment['SI']['default'].power_dbm),
'tx_power': None
}
params['tx_power'] = dbm2watt(equipment['SI']['default'].power_dbm)
if equipment['SI']['default'].tx_power_dbm is not None:
# use SI tx_power if present
params['tx_power'] = dbm2watt(equipment['SI']['default'].tx_power_dbm)
trx_params = trx_mode_params(equipment)
params.update(trx_params)
# use args_power instead of si
if args_power:
params['power'] = dbm2watt(float(args_power))
if equipment['SI']['default'].tx_power_dbm is None:
params['tx_power'] = params['power']
# use si as reference channel
reference_channel = PathRequest(**params)
# temporary till multiband design feat is available: do not design for L band
reference_channel.nb_channel = min(params['nb_channel'], automatic_nch(191.2e12, 196.0e12, params['spacing']))
if service_req:
# use service_req as reference channel with si tx_power if service_req tx_power is None
if service_req.tx_power is None:
service_req.tx_power = params['tx_power']
reference_channel = service_req
design_network(reference_channel, network, equipment, set_connector_losses=True, verbose=True)
if initial_spectrum:
params['nb_channel'] = len(initial_spectrum)
req = PathRequest(**params)
if service_req:
req = service_req
req.initial_spectrum = initial_spectrum
return network, req, reference_channel
def check_request_path_ids(rqs: List[PathRequest]):
"""check that request ids are unique. Non unique ids, may
mess the computation: better to stop the computation
"""
all_ids = [r.request_id for r in rqs]
if len(all_ids) != len(set(all_ids)):
for item in list(set(all_ids)):
all_ids.remove(item)
msg = f'Requests id {all_ids} are not unique'
logger.error(msg)
raise ValueError(msg)
def planning(network: DiGraph, equipment: dict, data: dict) \
-> Tuple[List[OMS], list, list, List[PathRequest], List[Disjunction], List[ResultElement]]:
"""Run planning
data contain the service dict from json
"""
oms_list = build_oms_list(network, equipment)
rqs = requests_from_json(data, equipment)
# check that request ids are unique.
check_request_path_ids(rqs)
rqs = correct_json_route_list(network, rqs)
dsjn = disjunctions_from_json(data)
logger.info('List of disjunctions:\n%s', dsjn)
# need to warn or correct in case of wrong disjunction form
# disjunction must not be repeated with same or different ids
dsjn = deduplicate_disjunctions(dsjn)
logger.info('Aggregating similar requests')
rqs, dsjn = requests_aggregation(rqs, dsjn)
logger.info('The following services have been requested:\n%s', rqs)
# logger.info('Computing all paths with constraints for request %s', optical_path_result_id)
pths = compute_path_dsjctn(network, equipment, rqs, dsjn)
logger.info('Propagating on selected path')
propagatedpths, reversed_pths, reversed_propagatedpths = \
compute_path_with_disjunction(network, equipment, rqs, pths)
# Note that deepcopy used in compute_path_with_disjunction returns
# a list of nodes which are not belonging to network (they are copies of the node objects).
# so there can not be propagation on these nodes.
# Allowed user_policy are first_fit and 2partition
pth_assign_spectrum(pths, rqs, oms_list, reversed_pths)
for i, rq in enumerate(rqs):
if hasattr(rq, 'OSNR') and rq.OSNR:
rq.osnr_with_sys_margin = rq.OSNR + equipment["SI"]["default"].sys_margins
# assumes that list of rqs and list of propgatedpths have same order
result = [ResultElement(rq, pth, rpth) for rq, pth, rpth in zip(rqs, propagatedpths, reversed_propagatedpths)]
return oms_list, propagatedpths, reversed_propagatedpths, rqs, dsjn, result
def transmission_simulation(equipment: dict, network: DiGraph, req: PathRequest, ref_req: PathRequest) \
-> Tuple[list, List[list], List[Union[float, int]], SpectralInformation]:
"""Run simulation and returms the propagation result for each power sweep iteration.
Args:
- equipment: a dictionary containing equipment information.
- network: network after being designed using ref_req. Any missing information (amp gain or delta_p) must have
been filled using ref_req as reference channel previuos to this function.
- req: channel to be propagated.
- ref_req: the reference channel used for filling missing information in the network.
In case of power sweep, network is redesigned using ref_req whose target input power in span is
updated with the power step.
Returns a tuple containing:
- path: last propagated path. Power sweep is not possible with gain mode (as gain targets are used)
- propagations: list of propagated path for each power iteration
- powers_dbm: list of power used for the power sweep
- infos: last propagated spectral information
"""
power_mode = equipment['Span']['default'].power_mode
logger.info('Power mode is set to %s=> it can be modified in eqpt_config.json - Span', power_mode)
# initial network is designed using ref_req. that is that any missing information (amp gain or delta_p) is filled
# using this ref_req.power, previous to any sweep requested later on.
pref_ch_db = watt2dbm(ref_req.power)
p_ch_db = watt2dbm(req.power)
path = compute_constrained_path(network, req)
power_range = [0]
if power_mode:
# power cannot be changed in gain mode
try:
p_start, p_stop, p_step = equipment['SI']['default'].power_range_db
p_num = abs(int(round((p_stop - p_start) / p_step))) + 1 if p_step != 0 else 1
power_range = list(linspace(p_start, p_stop, p_num))
except TypeError as e:
msg = 'invalid power range definition in eqpt_config, should be power_range_db: [lower, upper, step]'
logger.error(msg)
raise exceptions.EquipmentConfigError(msg) from e
logger.info('Now propagating between %s and %s', req.source, req.destination)
propagations = []
powers_dbm = []
for dp_db in power_range:
ref_req.power = dbm2watt(pref_ch_db + dp_db)
req.power = dbm2watt(p_ch_db + dp_db)
# Power sweep is made to evaluate different span input powers, so redesign is mandatory for each power,
# but no need to redesign if there are no power sweep
if len(power_range) > 1:
design_network(ref_req, network.subgraph(path), equipment, set_connector_losses=False, verbose=False)
infos = propagate(path, req, equipment)
propagations.append(deepcopy(path))
powers_dbm.append(pref_ch_db + dp_db)
logger.info('\nChannels propagating: (Input optical power deviation in span = '
+ f'{pretty_summary_print(per_label_average(infos.delta_pdb_per_channel, infos.label))}dB,\n'
+ ' spacing = '
+ f'{pretty_summary_print(per_label_average(infos.slot_width * 1e-9, infos.label))}GHz,\n'
+ ' 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})')
if not power_mode:
logger.info('\n\tPropagating using gain targets: Input optical power deviation in span ignored')
return path, propagations, powers_dbm, infos