gnpy.core package

Submodules

gnpy.core.elements module

gnpy.core.elements

This module contains standard network elements.

A network element is a Python callable. It takes a .info.SpectralInformation object and returns a copy with appropriate fields affected. This structure represents spectral information that is “propogated” by this network element. Network elements must have only a local “view” of the network and propogate SpectralInformation using only this information. They should be independent and self-contained.

Network elements MUST implement two attributes .uid and .name representing a unique identifier and a printable name.

class gnpy.core.elements.Edfa(*args, params={}, operational={}, **kwargs)

Bases: gnpy.core.node.Node

carriers(loc, attr)

retrieve carriers information loc = (in, out) of the class element attr = (ase, nli, signal, total) power information

interpol_params(frequencies, pin, baud_rates, pref)

interpolate SI channel frequencies with the edfa dgt and gain_ripple frquencies from json set the edfa class __init__ None parameters :

self.channel_freq, self.nf, self.interpol_dgt and self.interpol_gain_ripple
noise_profile(bw) computes amplifier ase (W) in signal bw (Hz)

noise is calculated at amplifier input

Bw:signal bandwidth = baud rate in Hz
Returns:the asepower in W in the signal bandwidth bw for 96 channels
Return type:numpy array of float

ASE POWER USING PER CHANNEL GAIN PROFILE INPUTS: NF_dB - Noise figure in dB, vector of length number of channels or

spectral slices
G_dB - Actual gain calculated for the EDFA, vector of length number of
channels or spectral slices
ffs - Center frequency grid of the channels or spectral slices in
THz, vector of length number of channels or spectral slices
dF - width of each channel or spectral slice in THz,
vector of length number of channels or spectral slices
OUTPUT:
ase_dBm - ase in dBm per channel or spectral slice

NOTE: the output is the total ASE in the channel or spectral slice. For 50GHz channels the ASE BW is effectively 0.4nm. To get to noise power in 0.1nm, subtract 6dB.

ONSR is usually quoted as channel power divided by the ASE power in 0.1nm RBW, regardless of the width of the actual channel. This is a historical convention from the days when optical signals were much smaller (155Mbps, 2.5Gbps, … 10Gbps) than the resolution of the OSAs that were used to measure spectral power which were set to 0.1nm resolution for convenience. Moving forward into flexible grid and high baud rate signals, it may be convenient to begin quoting power spectral density in the same BW for both signal and ASE, e.g. 12.5GHz.

propagate(pref, *carriers)

add ase noise to the propagating carriers of SpectralInformation

to_json
update_pref(pref)
class gnpy.core.elements.EdfaOperational(**operational)

Bases: object

default_values = {'delta_p': None, 'gain_target': None, 'out_voa': None, 'tilt_target': 0}
update_attr(kwargs)
class gnpy.core.elements.EdfaParams(**params)

Bases: object

update_params(kwargs)
class gnpy.core.elements.Fiber(*args, params=None, **kwargs)

Bases: gnpy.core.node.Node

asymptotic_length
beta2(ref_wavelength=None)

Returns beta2 from dispersion parameter. Dispersion is entered in ps/nm/km. Disperion can be a numpy array or a single value. If a value ref_wavelength is not entered 1550e-9m will be assumed. ref_wavelength can be a numpy array.

carriers(loc, attr)

retrieve carriers information loc = (in, out) of the class element attr = (ase, nli, signal, total) power information

dbkm_2_lin()

calculates the linear loss coefficient

effective_length
fiber_loss
lin_attenuation
loss
passive
propagate(*carriers)
to_json
update_pref(pref)
class gnpy.core.elements.FiberParams(type_variety, length, loss_coef, length_units, att_in, con_in, con_out, dispersion, gamma)

Bases: tuple

att_in

Alias for field number 4

con_in

Alias for field number 5

con_out

Alias for field number 6

dispersion

Alias for field number 7

gamma

Alias for field number 8

length

Alias for field number 1

length_units

Alias for field number 3

loss_coef

Alias for field number 2

type_variety

Alias for field number 0

class gnpy.core.elements.Fused(*args, params=None, **kwargs)

Bases: gnpy.core.node.Node

propagate(*carriers)
to_json
update_pref(pref)
class gnpy.core.elements.FusedParams(loss)

Bases: tuple

loss

Alias for field number 0

class gnpy.core.elements.Roadm(*args, params, **kwargs)

Bases: gnpy.core.node.Node

propagate(pref, *carriers)
to_json
update_pref(pref)
class gnpy.core.elements.RoadmParams(target_pch_out_db, add_drop_osnr)

Bases: tuple

add_drop_osnr

Alias for field number 1

target_pch_out_db

Alias for field number 0

class gnpy.core.elements.Transceiver(*args, **kwargs)

Bases: gnpy.core.node.Node

to_json
update_snr(*args)

snr_added in 0.1nm compute SNR penalties such as transponder Tx_osnr or Roadm add_drop_osnr only applied in request.py / propagate on the last Trasceiver node of the path all penalties are added in a single call because to avoid uncontrolled cumul

gnpy.core.execute module

gnpy.core.execute

This module contains functions for executing the propogation of spectral information on a gnpy network.

gnpy.core.info module

gnpy.core.info

This module contains classes for modelling SpectralInformation.

class gnpy.core.info.Channel

Bases: gnpy.core.info.Channel, gnpy.core.info.ConvenienceAccess

channel
ffs
freq
num_chan
class gnpy.core.info.ConvenienceAccess

Bases: object

update(**kwargs)
class gnpy.core.info.Power

Bases: gnpy.core.info.Power, gnpy.core.info.ConvenienceAccess

carriers power in W

ase
nli
class gnpy.core.info.Pref

Bases: gnpy.core.info.Pref, gnpy.core.info.ConvenienceAccess

noiseless reference power in dBm: p0: inital target carrier power pi: carrier power after element i neqch: equivalent channel count in dB

p0
pi
class gnpy.core.info.SpectralInformation

Bases: gnpy.core.info.SpectralInformation, gnpy.core.info.ConvenienceAccess

gnpy.core.info.create_input_spectral_information(f_min, f_max, roll_off, baud_rate, power, spacing)
gnpy.core.info.merge_input_spectral_information(*si)

mix channel combs of different baud rates and power

gnpy.core.network module

gnpy.core.network

This module contains functions for constructing networks of network elements.

gnpy.core.network.add_connector_loss(network, fibers, default_con_in, default_con_out, EOL)
gnpy.core.network.add_egress_amplifier(network, node)
gnpy.core.network.add_fiber_padding(network, fibers, padding)

last_fibers = (fiber for n in network.nodes() if not (isinstance(n, Fiber) or isinstance(n, Fused)) for fiber in network.predecessors(n) if isinstance(fiber, Fiber))

gnpy.core.network.build_network(network, equipment, pref_ch_db, pref_total_db)
gnpy.core.network.calculate_new_length(fiber_length, bounds, target_length)
gnpy.core.network.find_first_node(network, node)

Fused node interest: returns the 1st node at the origin of a succession of fused nodes (aka no amp in between)

gnpy.core.network.find_last_node(network, node)

Fused node interest: returns the last node in a succession of fused nodes (aka no amp in between)

gnpy.core.network.load_network(filename, equipment, name_matching=False)
gnpy.core.network.network_from_json(json_data, equipment)
gnpy.core.network.network_to_json(network)
gnpy.core.network.next_node_generator(network, node)

fused spans interest: iterate over all successors while they are Fused or Fiber type

gnpy.core.network.prev_node_generator(network, node)

fused spans interest: iterate over all predecessors while they are Fused or Fiber type

gnpy.core.network.save_network(filename, network)
gnpy.core.network.select_edfa(raman_allowed, gain_target, power_target, equipment, uid)

amplifer selection algorithm @Orange Jean-Luc Augé

gnpy.core.network.set_amplifier_voa(amp, power_target, power_mode)
gnpy.core.network.set_egress_amplifier(network, roadm, equipment, pref_total_db)
gnpy.core.network.span_loss(network, node)

Fused span interest: return the total span loss of all the fibers spliced by a Fused node

gnpy.core.network.split_fiber(network, fiber, bounds, target_length, equipment)
gnpy.core.network.target_power(network, node, equipment)

gnpy.core.node module

gnpy.core.node

This module contains the base class for a network element.

Strictly, a network element is any callable which accepts an immutable .info.SpectralInformation object and returns a .info.SpectralInformation object (a copy.)

Network elements MUST implement two attributes .uid and .name representing a unique identifier and a printable name.

This base class provides a mode convenient way to define a network element via subclassing.

class gnpy.core.node.Location

Bases: gnpy.core.node.Location

class gnpy.core.node.Node(uid, name=None, params=None, metadata={'location': {}}, operational=None)

Bases: object

coords
lat
latitude
lng
loc
location
longitude

gnpy.core.units module

gnpy.core.utils module

gnpy.core.utils

This module contains utility functions that are used with gnpy.

gnpy.core.utils.c()

Returns the speed of light in meters per second

gnpy.core.utils.db2lin(value)
gnpy.core.utils.deltaf2deltawl(delta_f, frequency)
deltawl2deltaf(delta_f, frequency):
converts delta frequency to delta wavelength units for delta_wl and wavelength must be same
Parameters:
  • delta_f (float or numpy.ndarray) – delta frequency in same units as frequency
  • frequency (float) – frequency BW is relevant for
Returns:

The BW in wavelength units

Return type:

float or ndarray

gnpy.core.utils.deltawl2deltaf(delta_wl, wavelength)

deltawl2deltaf(delta_wl, wavelength): delta_wl is BW in wavelength units wavelength is the center wl units for delta_wl and wavelength must be same

Parameters:
  • delta_wl (float or numpy.ndarray) – delta wavelength BW in same units as wavelength
  • wavelength (float) – wavelength BW is relevant for
Returns:

The BW in frequency units

Return type:

float or ndarray

gnpy.core.utils.freq2wavelength(value)

Converts frequency units to wavelength units.

gnpy.core.utils.h()

Returns plank’s constant in J*s

gnpy.core.utils.itufl(length, startf=191.35, stopf=196.1)

Creates an array of frequencies whose default range is 191.35-196.10 THz

Parameters:
  • length (integer) – number of elements
  • starf – Start frequency in THz
  • stopf (float) – Stop frequency in THz

:return an array of frequnecies determined by the spacing parameter :rtype: numpy.ndarray

gnpy.core.utils.itufs(spacing, startf=191.35, stopf=196.1)

Creates an array of frequencies whose default range is 191.35-196.10 THz

Parameters:
  • spacing (float) – Frequency spacing in THz
  • starf – Start frequency in THz
  • stopf (float) – Stop frequency in THz

:return an array of frequnecies determined by the spacing parameter :rtype: numpy.ndarray

gnpy.core.utils.lin2db(value)
gnpy.core.utils.load_json(filename)
gnpy.core.utils.round2float(number, step)
gnpy.core.utils.rrc(ffs, baud_rate, alpha)

rrc(ffs, baud_rate, alpha): computes the root-raised cosine filter function.

Parameters:
  • ffs (numpy.ndarray) – A numpy array of frequencies
  • baud_rate (float) – The Baud Rate of the System
  • alpha (float) – The roll-off factor of the filter
Returns:

hf a numpy array of the filter shape

Return type:

numpy.ndarray

gnpy.core.utils.save_json(obj, filename)
gnpy.core.utils.snr_sum(snr, bw, snr_added, bw_added=12500000000.0)
gnpy.core.utils.write_csv(obj, filename)

convert dictionary items to a csv file the dictionary format :

{‘result category 1’:

[ # 1st line of results {‘header 1’ : value_xxx,

‘header 2’ : value_yyy}, # 2nd line of results: same headers, different results
{‘header 1’ : value_www,
‘header 2’ : value_zzz}

],

‘result_category 2’:
[ {},{} ]

}

the generated csv file will be: result_category 1 header 1 header 2 value_xxx value_yyy value_www value_zzz result_category 2 …

Module contents

gnpy route planning and optimization library

gnpy is a route planning and optimization library, written in Python, for operators of large-scale mesh optical networks.

copyright:© 2018, Telecom Infra Project
license:BSD 3-Clause, see LICENSE for more details.