mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-10-30 17:47:50 +00:00
clean-up test files/locations
This commit is contained in:
@@ -15,14 +15,15 @@ from gnpy.core.network import build_network, load_network
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import filecmp
|
import filecmp
|
||||||
|
|
||||||
#network_file_name = 'tests/test_network.json'
|
TEST_DIR = Path(__file__).parent
|
||||||
network_file_name = Path(__file__).parent.parent / 'tests/test_network.json'
|
DATA_DIR = TEST_DIR / 'data'
|
||||||
#network_file_name = Path(__file__).parent.parent / 'examples/edfa_example_network.json'
|
test_network = DATA_DIR / 'test_network.json'
|
||||||
eqpt_library_name = Path(__file__).parent.parent / 'examples/eqpt_config.json'
|
eqpt_library = DATA_DIR / 'eqpt_config.json'
|
||||||
|
|
||||||
@pytest.fixture(params=[(96, 0.05e12), (60, 0.075e12), (45, 0.1e12), (2, 0.1e12)],
|
|
||||||
ids=['50GHz spacing', '75GHz spacing', '100GHz spacing', '2 channels'])
|
|
||||||
# TODO in elements.py code: pytests doesn't pass with 1 channel: interpolate fail
|
# TODO in elements.py code: pytests doesn't pass with 1 channel: interpolate fail
|
||||||
|
@pytest.fixture(
|
||||||
|
params=[(96, 0.05e12), (60, 0.075e12), (45, 0.1e12), (2, 0.1e12)],
|
||||||
|
ids=['50GHz spacing', '75GHz spacing', '100GHz spacing', '2 channels'])
|
||||||
def nch_and_spacing(request):
|
def nch_and_spacing(request):
|
||||||
"""parametrize channel count vs channel spacing (Hz)"""
|
"""parametrize channel count vs channel spacing (Hz)"""
|
||||||
yield request.param
|
yield request.param
|
||||||
@@ -37,8 +38,8 @@ def setup_edfa():
|
|||||||
"""init edfa class by reading test_network.json file
|
"""init edfa class by reading test_network.json file
|
||||||
remove all gain and nf ripple"""
|
remove all gain and nf ripple"""
|
||||||
# eqpt_library = pytest_eqpt_library()
|
# eqpt_library = pytest_eqpt_library()
|
||||||
equipment = load_equipment(eqpt_library_name)
|
equipment = load_equipment(eqpt_library)
|
||||||
network = load_network(network_file_name,equipment)
|
network = load_network(test_network, equipment)
|
||||||
build_network(network, equipment=equipment)
|
build_network(network, equipment=equipment)
|
||||||
edfa = [n for n in network.nodes() if isinstance(n, Edfa)][0]
|
edfa = [n for n in network.nodes() if isinstance(n, Edfa)][0]
|
||||||
|
|
||||||
@@ -52,8 +53,8 @@ def setup_edfa():
|
|||||||
@pytest.fixture()
|
@pytest.fixture()
|
||||||
def setup_trx():
|
def setup_trx():
|
||||||
"""init transceiver class to access snr and osnr calculations"""
|
"""init transceiver class to access snr and osnr calculations"""
|
||||||
equipment = load_equipment(eqpt_library_name)
|
equipment = load_equipment(eqpt_library)
|
||||||
network = load_network(network_file_name,equipment)
|
network = load_network(test_network, equipment)
|
||||||
build_network(network, equipment=equipment)
|
build_network(network, equipment=equipment)
|
||||||
trx = [n for n in network.nodes() if isinstance(n, Transceiver)][0]
|
trx = [n for n in network.nodes() if isinstance(n, Transceiver)][0]
|
||||||
return trx
|
return trx
|
||||||
|
|||||||
296
tests/data/default_edfa_config.json
Normal file
296
tests/data/default_edfa_config.json
Normal file
@@ -0,0 +1,296 @@
|
|||||||
|
{
|
||||||
|
"nf_ripple": [
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"gain_ripple": [
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"dgt": [
|
||||||
|
2.714526681131686,
|
||||||
|
2.705443819238505,
|
||||||
|
2.6947834587664494,
|
||||||
|
2.6841217449620203,
|
||||||
|
2.6681935771243177,
|
||||||
|
2.6521732021128046,
|
||||||
|
2.630396440815385,
|
||||||
|
2.602860350286428,
|
||||||
|
2.5696460593920065,
|
||||||
|
2.5364027376452056,
|
||||||
|
2.499446286796604,
|
||||||
|
2.4587748041127506,
|
||||||
|
2.414398437185221,
|
||||||
|
2.3699990328716107,
|
||||||
|
2.322373696229342,
|
||||||
|
2.271520771371253,
|
||||||
|
2.2174389328192197,
|
||||||
|
2.16337565384239,
|
||||||
|
2.1183028432496016,
|
||||||
|
2.082225099873648,
|
||||||
|
2.055100772005235,
|
||||||
|
2.0279625371819305,
|
||||||
|
2.0008103857988204,
|
||||||
|
1.9736443063300082,
|
||||||
|
1.9482128147680253,
|
||||||
|
1.9245345552113182,
|
||||||
|
1.9026104247588487,
|
||||||
|
1.8806927939516411,
|
||||||
|
1.862235672444246,
|
||||||
|
1.847275503201129,
|
||||||
|
1.835814081380705,
|
||||||
|
1.824381436842932,
|
||||||
|
1.8139629377087627,
|
||||||
|
1.8045606557581335,
|
||||||
|
1.7961751115773796,
|
||||||
|
1.7877868031023945,
|
||||||
|
1.7793941781790852,
|
||||||
|
1.7709972329654864,
|
||||||
|
1.7625959636196327,
|
||||||
|
1.7541903672600494,
|
||||||
|
1.7459181197626403,
|
||||||
|
1.737780757913635,
|
||||||
|
1.7297783508684146,
|
||||||
|
1.7217732861435076,
|
||||||
|
1.7137640932265894,
|
||||||
|
1.7057507692361864,
|
||||||
|
1.6918150918099673,
|
||||||
|
1.6719047669939942,
|
||||||
|
1.6460167077689267,
|
||||||
|
1.6201194134191075,
|
||||||
|
1.5986915141218316,
|
||||||
|
1.5817353179379183,
|
||||||
|
1.569199764184379,
|
||||||
|
1.5566577309558969,
|
||||||
|
1.545374152761467,
|
||||||
|
1.5353620432989845,
|
||||||
|
1.5266220576235803,
|
||||||
|
1.5178910621476225,
|
||||||
|
1.5097346239790443,
|
||||||
|
1.502153039909686,
|
||||||
|
1.495145456062699,
|
||||||
|
1.488134243479226,
|
||||||
|
1.48111939735681,
|
||||||
|
1.474100442252211,
|
||||||
|
1.4670307626366115,
|
||||||
|
1.4599103316162523,
|
||||||
|
1.45273959485914,
|
||||||
|
1.445565137158368,
|
||||||
|
1.4340878115214444,
|
||||||
|
1.418273806730323,
|
||||||
|
1.3981208704326855,
|
||||||
|
1.3779439775587023,
|
||||||
|
1.3598972673004606,
|
||||||
|
1.3439818461440451,
|
||||||
|
1.3301807335621048,
|
||||||
|
1.316383926863083,
|
||||||
|
1.3040618749785347,
|
||||||
|
1.2932153453410835,
|
||||||
|
1.2838336236692311,
|
||||||
|
1.2744470198196236,
|
||||||
|
1.2650555289898042,
|
||||||
|
1.2556591482982988,
|
||||||
|
1.2428104897182262,
|
||||||
|
1.2264996957264114,
|
||||||
|
1.2067249615595257,
|
||||||
|
1.1869318618366975,
|
||||||
|
1.1672278304018044,
|
||||||
|
1.1476135933863398,
|
||||||
|
1.1280891949729075,
|
||||||
|
1.108555289615659,
|
||||||
|
1.0895983485572227,
|
||||||
|
1.0712204022764056,
|
||||||
|
1.0534217504465226,
|
||||||
|
1.0356155337864215,
|
||||||
|
1.017807767853702,
|
||||||
|
1.0
|
||||||
|
]
|
||||||
|
}
|
||||||
95
tests/data/eqpt_config.json
Normal file
95
tests/data/eqpt_config.json
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
{ "Edfa":[{
|
||||||
|
"type_variety": "CienaDB_medium_gain",
|
||||||
|
"gain_flatmax": 25,
|
||||||
|
"gain_min": 15,
|
||||||
|
"p_max": 21,
|
||||||
|
"advanced_config_from_json": "std_medium_gain_advanced_config.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type_variety": "std_medium_gain",
|
||||||
|
"gain_flatmax": 26,
|
||||||
|
"gain_min": 15,
|
||||||
|
"p_max": 21,
|
||||||
|
"nf_min": 6,
|
||||||
|
"nf_max": 10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type_variety": "std_low_gain",
|
||||||
|
"gain_flatmax": 16,
|
||||||
|
"gain_min": 8,
|
||||||
|
"p_max": 21,
|
||||||
|
"nf_min": 7,
|
||||||
|
"nf_max": 11
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type_variety": "test",
|
||||||
|
"gain_flatmax": 25,
|
||||||
|
"gain_min": 15,
|
||||||
|
"p_max": 21,
|
||||||
|
"nf_min": 5.8,
|
||||||
|
"nf_max": 10
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Fiber":[{
|
||||||
|
"type_variety": "SSMF",
|
||||||
|
"dispersion": 1.67e-05,
|
||||||
|
"gamma": 0.00127
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Spans":[{
|
||||||
|
"max_length": 150,
|
||||||
|
"length_units": "km",
|
||||||
|
"max_loss": 28,
|
||||||
|
"padding": 10,
|
||||||
|
"EOL": 1,
|
||||||
|
"con_loss": 0.5
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"SI":[{
|
||||||
|
"f_min": 191.3e12,
|
||||||
|
"Nch": 80,
|
||||||
|
"baud_rate": 32e9,
|
||||||
|
"spacing": 75e9,
|
||||||
|
"roll_off": 0.15,
|
||||||
|
"power": 1.2589e-3
|
||||||
|
}],
|
||||||
|
"Transceiver":[
|
||||||
|
{
|
||||||
|
"type_variety": "vendorA_trx-type1",
|
||||||
|
"frequency":{
|
||||||
|
"min": 191.35e12,
|
||||||
|
"max": 196.1e12
|
||||||
|
},
|
||||||
|
"mode":[
|
||||||
|
{
|
||||||
|
"format": "PS_SP64_1",
|
||||||
|
"baudrate": 32e9,
|
||||||
|
"OSNR": 9,
|
||||||
|
"bit_rate": 100e9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "PS_SP64_2",
|
||||||
|
"baudrate": 66e9,
|
||||||
|
"OSNR": 10,
|
||||||
|
"bit_rate": 200e9
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type_variety": "Voyager_16QAM",
|
||||||
|
"frequency":{
|
||||||
|
"min": 191.35e12,
|
||||||
|
"max": 196.1e12
|
||||||
|
},
|
||||||
|
"mode":[
|
||||||
|
{
|
||||||
|
"format": "16QAM",
|
||||||
|
"baudrate": 32e9,
|
||||||
|
"OSNR": 15,
|
||||||
|
"bit_rate": 200e9
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
}
|
||||||
301
tests/data/std_medium_gain_advanced_config.json
Normal file
301
tests/data/std_medium_gain_advanced_config.json
Normal file
@@ -0,0 +1,301 @@
|
|||||||
|
{ "nf_fit_coeff": [
|
||||||
|
0.000168241,
|
||||||
|
0.0469961,
|
||||||
|
0.0359549,
|
||||||
|
5.82851
|
||||||
|
],
|
||||||
|
"nf_ripple": [
|
||||||
|
-0.3110761646066259,
|
||||||
|
-0.3110761646066259,
|
||||||
|
-0.31110274831665313,
|
||||||
|
-0.31419329378173544,
|
||||||
|
-0.3172854168606314,
|
||||||
|
-0.32037911876162584,
|
||||||
|
-0.3233255190215882,
|
||||||
|
-0.31624321721895354,
|
||||||
|
-0.30915729645781326,
|
||||||
|
-0.30206775396360075,
|
||||||
|
-0.2949045115165272,
|
||||||
|
-0.26632156113294336,
|
||||||
|
-0.23772399031437283,
|
||||||
|
-0.20911178784023846,
|
||||||
|
-0.18048410390821285,
|
||||||
|
-0.14379944379052215,
|
||||||
|
-0.10709599992470213,
|
||||||
|
-0.07037375788020579,
|
||||||
|
-0.03372858157230583,
|
||||||
|
-0.015660302006048,
|
||||||
|
0.0024172385953583004,
|
||||||
|
0.020504047353947653,
|
||||||
|
0.03860013139908377,
|
||||||
|
0.05670549786742816,
|
||||||
|
0.07482015390297145,
|
||||||
|
0.0838762040768461,
|
||||||
|
0.09284481475528361,
|
||||||
|
0.1018180306253394,
|
||||||
|
0.11079585523492333,
|
||||||
|
0.1020395478432815,
|
||||||
|
0.09310160456603413,
|
||||||
|
0.08415906712621996,
|
||||||
|
0.07521193198077789,
|
||||||
|
0.0676340601339394,
|
||||||
|
0.06005437964543287,
|
||||||
|
0.052470799141237305,
|
||||||
|
0.044883315610536455,
|
||||||
|
0.037679759069084225,
|
||||||
|
0.03047647598902483,
|
||||||
|
0.02326948274513522,
|
||||||
|
0.01605877647020772,
|
||||||
|
0.021248462316134083,
|
||||||
|
0.02657315875107553,
|
||||||
|
0.03190060058247842,
|
||||||
|
0.03723078993416436,
|
||||||
|
0.04256372893215024,
|
||||||
|
0.047899419704645264,
|
||||||
|
0.03915515813685565,
|
||||||
|
0.030289222542492025,
|
||||||
|
0.021418708618354456,
|
||||||
|
0.012573926129294415,
|
||||||
|
0.006240488799898697,
|
||||||
|
-9.622162373026585e-05,
|
||||||
|
-0.006436207679519103,
|
||||||
|
-0.012779471908040341,
|
||||||
|
-0.02038153550619876,
|
||||||
|
-0.027999803010447587,
|
||||||
|
-0.035622012697103154,
|
||||||
|
-0.043236398934156144,
|
||||||
|
-0.04493583574805963,
|
||||||
|
-0.04663615264317309,
|
||||||
|
-0.048337350303318156,
|
||||||
|
-0.050039429413028365,
|
||||||
|
-0.051742390657545205,
|
||||||
|
-0.05342028484370278,
|
||||||
|
-0.05254242298580185,
|
||||||
|
-0.05166410580536087,
|
||||||
|
-0.05078533294804249,
|
||||||
|
-0.04990610405914272,
|
||||||
|
-0.05409792133358102,
|
||||||
|
-0.05832916277634124,
|
||||||
|
-0.06256260169582961,
|
||||||
|
-0.06660356886269536,
|
||||||
|
-0.04779792991567815,
|
||||||
|
-0.028982516728038848,
|
||||||
|
-0.010157321677553965,
|
||||||
|
0.00861320615127981,
|
||||||
|
0.01913736978785662,
|
||||||
|
0.029667009055877668,
|
||||||
|
0.04020212822983975,
|
||||||
|
0.050742731588695494,
|
||||||
|
0.061288823415841555,
|
||||||
|
0.07184040799914815,
|
||||||
|
0.1043252636301016,
|
||||||
|
0.13687829834471027,
|
||||||
|
0.1694483010211072,
|
||||||
|
0.202035284929368,
|
||||||
|
0.23624619427167134,
|
||||||
|
0.27048596623174515,
|
||||||
|
0.30474360397422756,
|
||||||
|
0.3390191214858807,
|
||||||
|
0.36358851509924695,
|
||||||
|
0.38814205928193013,
|
||||||
|
0.41270842850729195,
|
||||||
|
0.4372876328262819,
|
||||||
|
0.4372876328262819
|
||||||
|
],
|
||||||
|
"dgt": [
|
||||||
|
2.714526681131686,
|
||||||
|
2.705443819238505,
|
||||||
|
2.6947834587664494,
|
||||||
|
2.6841217449620203,
|
||||||
|
2.6681935771243177,
|
||||||
|
2.6521732021128046,
|
||||||
|
2.630396440815385,
|
||||||
|
2.602860350286428,
|
||||||
|
2.5696460593920065,
|
||||||
|
2.5364027376452056,
|
||||||
|
2.499446286796604,
|
||||||
|
2.4587748041127506,
|
||||||
|
2.414398437185221,
|
||||||
|
2.3699990328716107,
|
||||||
|
2.322373696229342,
|
||||||
|
2.271520771371253,
|
||||||
|
2.2174389328192197,
|
||||||
|
2.16337565384239,
|
||||||
|
2.1183028432496016,
|
||||||
|
2.082225099873648,
|
||||||
|
2.055100772005235,
|
||||||
|
2.0279625371819305,
|
||||||
|
2.0008103857988204,
|
||||||
|
1.9736443063300082,
|
||||||
|
1.9482128147680253,
|
||||||
|
1.9245345552113182,
|
||||||
|
1.9026104247588487,
|
||||||
|
1.8806927939516411,
|
||||||
|
1.862235672444246,
|
||||||
|
1.847275503201129,
|
||||||
|
1.835814081380705,
|
||||||
|
1.824381436842932,
|
||||||
|
1.8139629377087627,
|
||||||
|
1.8045606557581335,
|
||||||
|
1.7961751115773796,
|
||||||
|
1.7877868031023945,
|
||||||
|
1.7793941781790852,
|
||||||
|
1.7709972329654864,
|
||||||
|
1.7625959636196327,
|
||||||
|
1.7541903672600494,
|
||||||
|
1.7459181197626403,
|
||||||
|
1.737780757913635,
|
||||||
|
1.7297783508684146,
|
||||||
|
1.7217732861435076,
|
||||||
|
1.7137640932265894,
|
||||||
|
1.7057507692361864,
|
||||||
|
1.6918150918099673,
|
||||||
|
1.6719047669939942,
|
||||||
|
1.6460167077689267,
|
||||||
|
1.6201194134191075,
|
||||||
|
1.5986915141218316,
|
||||||
|
1.5817353179379183,
|
||||||
|
1.569199764184379,
|
||||||
|
1.5566577309558969,
|
||||||
|
1.545374152761467,
|
||||||
|
1.5353620432989845,
|
||||||
|
1.5266220576235803,
|
||||||
|
1.5178910621476225,
|
||||||
|
1.5097346239790443,
|
||||||
|
1.502153039909686,
|
||||||
|
1.495145456062699,
|
||||||
|
1.488134243479226,
|
||||||
|
1.48111939735681,
|
||||||
|
1.474100442252211,
|
||||||
|
1.4670307626366115,
|
||||||
|
1.4599103316162523,
|
||||||
|
1.45273959485914,
|
||||||
|
1.445565137158368,
|
||||||
|
1.4340878115214444,
|
||||||
|
1.418273806730323,
|
||||||
|
1.3981208704326855,
|
||||||
|
1.3779439775587023,
|
||||||
|
1.3598972673004606,
|
||||||
|
1.3439818461440451,
|
||||||
|
1.3301807335621048,
|
||||||
|
1.316383926863083,
|
||||||
|
1.3040618749785347,
|
||||||
|
1.2932153453410835,
|
||||||
|
1.2838336236692311,
|
||||||
|
1.2744470198196236,
|
||||||
|
1.2650555289898042,
|
||||||
|
1.2556591482982988,
|
||||||
|
1.2428104897182262,
|
||||||
|
1.2264996957264114,
|
||||||
|
1.2067249615595257,
|
||||||
|
1.1869318618366975,
|
||||||
|
1.1672278304018044,
|
||||||
|
1.1476135933863398,
|
||||||
|
1.1280891949729075,
|
||||||
|
1.108555289615659,
|
||||||
|
1.0895983485572227,
|
||||||
|
1.0712204022764056,
|
||||||
|
1.0534217504465226,
|
||||||
|
1.0356155337864215,
|
||||||
|
1.017807767853702,
|
||||||
|
1.0
|
||||||
|
],
|
||||||
|
"gain_ripple": [
|
||||||
|
0.1359703369791596,
|
||||||
|
0.11822862697916037,
|
||||||
|
0.09542181697916163,
|
||||||
|
0.06245819697916133,
|
||||||
|
0.02602813697916062,
|
||||||
|
-0.0036199830208403228,
|
||||||
|
-0.018326963020840026,
|
||||||
|
-0.0246928330208398,
|
||||||
|
-0.016792253020838643,
|
||||||
|
-0.0028138630208403015,
|
||||||
|
0.017572956979162058,
|
||||||
|
0.038328296979159404,
|
||||||
|
0.054956336979159914,
|
||||||
|
0.0670723869791594,
|
||||||
|
0.07091459697916136,
|
||||||
|
0.07094413697916124,
|
||||||
|
0.07114372697916238,
|
||||||
|
0.07533675697916209,
|
||||||
|
0.08731066697916035,
|
||||||
|
0.10313984697916112,
|
||||||
|
0.12276252697916235,
|
||||||
|
0.14239527697916188,
|
||||||
|
0.15945681697916214,
|
||||||
|
0.1739275269791598,
|
||||||
|
0.1767381569791624,
|
||||||
|
0.17037189697916233,
|
||||||
|
0.15216302697916007,
|
||||||
|
0.13114358697916018,
|
||||||
|
0.10802383697916085,
|
||||||
|
0.08548825697916129,
|
||||||
|
0.06916723697916183,
|
||||||
|
0.05848224697916038,
|
||||||
|
0.05447361697916264,
|
||||||
|
0.05154489697916276,
|
||||||
|
0.04946107697915991,
|
||||||
|
0.04717897697916129,
|
||||||
|
0.04551704697916037,
|
||||||
|
0.04467697697916151,
|
||||||
|
0.04072968697916224,
|
||||||
|
0.03285456697916089,
|
||||||
|
0.023488786979161347,
|
||||||
|
0.01659282697915998,
|
||||||
|
0.013321846979160057,
|
||||||
|
0.011234826979162449,
|
||||||
|
0.01030063697916006,
|
||||||
|
0.00936596697916059,
|
||||||
|
0.00874012697916271,
|
||||||
|
0.00842583697916055,
|
||||||
|
0.006965146979162284,
|
||||||
|
0.0040435869791615175,
|
||||||
|
0.0007104669791608842,
|
||||||
|
-0.0015763130208377163,
|
||||||
|
-0.006936193020838033,
|
||||||
|
-0.016475303020840215,
|
||||||
|
-0.028748483020837767,
|
||||||
|
-0.039618433020837784,
|
||||||
|
-0.051112303020840244,
|
||||||
|
-0.06468462302083822,
|
||||||
|
-0.07868024302083754,
|
||||||
|
-0.09101254302083817,
|
||||||
|
-0.10103437302083762,
|
||||||
|
-0.11041488302083735,
|
||||||
|
-0.11916081302083725,
|
||||||
|
-0.12789859302083784,
|
||||||
|
-0.1353792530208402,
|
||||||
|
-0.14160178302083892,
|
||||||
|
-0.1455411330208385,
|
||||||
|
-0.1484450830208388,
|
||||||
|
-0.14823350302084037,
|
||||||
|
-0.14591937302083835,
|
||||||
|
-0.1409032730208395,
|
||||||
|
-0.13525493302083902,
|
||||||
|
-0.1279646530208396,
|
||||||
|
-0.11963431302083904,
|
||||||
|
-0.11089282302084058,
|
||||||
|
-0.1027863830208382,
|
||||||
|
-0.09717347302083823,
|
||||||
|
-0.09343261302083761,
|
||||||
|
-0.0913487130208388,
|
||||||
|
-0.08906007302083907,
|
||||||
|
-0.0865687230208394,
|
||||||
|
-0.08407607302083875,
|
||||||
|
-0.07844600302084004,
|
||||||
|
-0.06968090302083851,
|
||||||
|
-0.05947139302083926,
|
||||||
|
-0.05095282302083959,
|
||||||
|
-0.042428283020839785,
|
||||||
|
-0.03218106302083967,
|
||||||
|
-0.01819858302084043,
|
||||||
|
-0.0021726530208390216,
|
||||||
|
0.01393231697916164,
|
||||||
|
0.028098946979159933,
|
||||||
|
0.040326236979161934,
|
||||||
|
0.05257029697916238,
|
||||||
|
0.06479749697916048,
|
||||||
|
0.07704745697916238
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -18,55 +18,40 @@ from pathlib import Path
|
|||||||
import filecmp
|
import filecmp
|
||||||
from os import unlink
|
from os import unlink
|
||||||
|
|
||||||
|
TEST_DIR = Path(__file__).parent
|
||||||
network_file_name = 'tests/test_network.json'
|
DATA_DIR = TEST_DIR / 'data'
|
||||||
eqpt_library_name = 'examples/eqpt_config.json'
|
eqpt_filename = DATA_DIR / 'eqpt_config.json'
|
||||||
|
|
||||||
# adding tests to check the parser non regression
|
# adding tests to check the parser non regression
|
||||||
# convention of naming of test files:
|
# convention of naming of test files:
|
||||||
#
|
#
|
||||||
# - ..._expected.json for the reference output
|
# - ..._expected.json for the reference output
|
||||||
|
|
||||||
excel_filename = ['tests/excelTestFile.xls',
|
@pytest.mark.parametrize('xls_input,expected_json_output', {
|
||||||
'tests/CORONET_Global_Topology.xls',
|
DATA_DIR / 'excelTestFile.xls': DATA_DIR / 'excelTestFile_expected.json',
|
||||||
'tests/meshTopologyExampleV2.xls',
|
DATA_DIR / 'CORONET_Global_Topology.xls': DATA_DIR / 'CORONET_Global_Topology_expected.json',
|
||||||
'tests/meshTopologyExampleV2Eqpt.xls']
|
DATA_DIR / 'meshTopologyExampleV2.xls': DATA_DIR / 'meshTopologyExampleV2_expected.json',
|
||||||
network_test_filenames = {
|
DATA_DIR / 'meshTopologyExampleV2Eqpt.xls': DATA_DIR / 'meshTopologyExampleV2Eqpt_expected.json',
|
||||||
'tests/excelTestFile.xls' : 'tests/excelTestFile_expected.json',
|
}.items())
|
||||||
'tests/CORONET_Global_Topology.xls' : 'tests/CORONET_Global_Topology_expected.json',
|
def test_excel_json_generation(xls_input, expected_json_output):
|
||||||
'tests/meshTopologyExampleV2.xls' : 'tests/meshTopologyExampleV2_expected.json',
|
convert_file(xls_input)
|
||||||
'tests/meshTopologyExampleV2Eqpt.xls' : 'tests/meshTopologyExampleV2Eqpt_expected.json'}
|
actual_json_output = xls_input.with_suffix('.json')
|
||||||
@pytest.mark.parametrize("inputfile",excel_filename)
|
result, _ = compare_network_file(expected_json_output, actual_json_output)
|
||||||
def test_excel_json_generation(inputfile) :
|
unlink(actual_json_output)
|
||||||
convert_file(Path(inputfile))
|
|
||||||
# actual
|
|
||||||
json_filename = f'{inputfile[:-3]}json'
|
|
||||||
# expected
|
|
||||||
expected_filename = network_test_filenames[inputfile]
|
|
||||||
|
|
||||||
result, _ = compare_network_file(expected_filename, json_filename)
|
|
||||||
unlink(json_filename)
|
|
||||||
assert result
|
assert result
|
||||||
|
|
||||||
# assume json entries
|
# assume json entries
|
||||||
# test that the build network gives correct results
|
# test that the build network gives correct results
|
||||||
# TODO !!
|
# TODO !!
|
||||||
|
|
||||||
excel_filename = ['tests/excelTestFile.xls',
|
@pytest.mark.parametrize('xls_input,expected_json_output', {
|
||||||
'tests/meshTopologyExampleV2.xls',
|
DATA_DIR / 'excelTestFile.xls': DATA_DIR / 'excelTestFile_services_expected.json',
|
||||||
'tests/meshTopologyExampleV2Eqpt.xls']
|
DATA_DIR / 'meshTopologyExampleV2.xls': DATA_DIR / 'meshTopologyExampleV2_services_expected.json',
|
||||||
service_test_filenames = {
|
DATA_DIR / 'meshTopologyExampleV2Eqpt.xls': DATA_DIR / 'meshTopologyExampleV2Eqpt_services_expected.json',
|
||||||
'tests/excelTestFile.xls' : 'tests/excelTestFile_services_expected.json',
|
}.items())
|
||||||
'tests/meshTopologyExampleV2.xls' : 'tests/meshTopologyExampleV2_services_expected.json',
|
def test_excel_service_json_generation(xls_input, expected_json_output):
|
||||||
'tests/meshTopologyExampleV2Eqpt.xls' : 'tests/meshTopologyExampleV2Eqpt_services_expected.json'}
|
convert_service_sheet(xls_input, eqpt_filename)
|
||||||
@pytest.mark.parametrize("inputfile",excel_filename)
|
actual_json_output = f'{str(xls_input)[:-4]}_services.json'
|
||||||
def test_excel_service_json_generation(inputfile) :
|
result, _ = compare_service_file(expected_json_output, actual_json_output)
|
||||||
convert_service_sheet(Path(inputfile),eqpt_library_name)
|
unlink(actual_json_output)
|
||||||
# actual
|
|
||||||
json_filename = f'{inputfile[:-4]}_services.json'
|
|
||||||
# expected
|
|
||||||
test_filename = service_test_filenames[inputfile]
|
|
||||||
|
|
||||||
result, _ = compare_service_file(test_filename, json_filename)
|
|
||||||
unlink(json_filename)
|
|
||||||
assert result
|
assert result
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from gnpy.core.utils import db2lin
|
from gnpy.core.utils import db2lin
|
||||||
def test_db2lin():
|
|
||||||
assert pytest.approx(10.0)==db2lin(10.0)
|
|
||||||
|
|
||||||
|
def test_db2lin():
|
||||||
|
assert pytest.approx(10.0) == db2lin(10.0)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from logging import getLogger, basicConfig, INFO
|
from logging import getLogger, basicConfig, INFO
|
||||||
@@ -13,4 +13,3 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
logger.info(f'Running {test}')
|
logger.info(f'Running {test}')
|
||||||
test_db2lin()
|
test_db2lin()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user