From f833457c7aa7abba4541aa5c69797d98c2d23d10 Mon Sep 17 00:00:00 2001 From: EstherLerouzic Date: Fri, 25 Oct 2024 10:50:26 +0200 Subject: [PATCH] fix: do not assume 0 dB default value for tilt-target Instead keep the None value, it user has not stated anything Signed-off-by: EstherLerouzic Change-Id: I45fcff92caabbfbe514fbe30deac60426b7eb16b --- gnpy/core/elements.py | 3 +- gnpy/tools/convert.py | 6 +- ...rdegreemeshTopologyExampleV2_expected.json | 42 +++--- tests/data/testTopology_expected.json | 130 +++++++++--------- 4 files changed, 91 insertions(+), 90 deletions(-) diff --git a/gnpy/core/elements.py b/gnpy/core/elements.py index c58d602ea..921911793 100644 --- a/gnpy/core/elements.py +++ b/gnpy/core/elements.py @@ -988,7 +988,8 @@ def __str__(self): f' type_variety: {self.params.type_variety}', f' effective gain(dB): {self.effective_gain:.2f}', ' (before att_in and before output VOA)', - f' tilt-target(dB) {self.tilt_target:.2f}', + f' tilt-target(dB) {self.tilt_target if self.tilt_target else 0:.2f}', + # avoids -0.00 value for tilt_target f' noise figure (dB): {nf:.2f}', f' (including att_in)', f' pad att_in (dB): {self.att_in:.2f}', diff --git a/gnpy/tools/convert.py b/gnpy/tools/convert.py index fb4e5d455..6b0e70709 100755 --- a/gnpy/tools/convert.py +++ b/gnpy/tools/convert.py @@ -130,7 +130,7 @@ def update_attr(self, kwargs): 'east_amp_type': '', 'east_amp_gain': None, 'east_amp_dp': None, - 'east_tilt_vs_wavelength': 0, + 'east_tilt_vs_wavelength': None, 'east_att_out': None } @@ -518,7 +518,7 @@ def xls_to_json_data(input_filename: Path, filter_region: List[str] = None) -> D 'longitude': x.longitude}}, 'type': 'Edfa', 'operational': {'gain_target': None, - 'tilt_target': 0} + 'tilt_target': None} } for x in nodes_by_city.values() if x.node_type.lower() == 'ila' and x.city not in eqpts_by_city] + [{'uid': f'east edfa in {x.city}', 'metadata': {'location': {'city': x.city, @@ -527,7 +527,7 @@ def xls_to_json_data(input_filename: Path, filter_region: List[str] = None) -> D 'longitude': x.longitude}}, 'type': 'Edfa', 'operational': {'gain_target': None, - 'tilt_target': 0} + 'tilt_target': None} } for x in nodes_by_city.values() if x.node_type.lower() == 'ila' and x.city not in eqpts_by_city] + [create_east_eqpt_element(e, nodes_by_city) for e in eqpts] + [create_west_eqpt_element(e, nodes_by_city) for e in eqpts], diff --git a/tests/data/perdegreemeshTopologyExampleV2_expected.json b/tests/data/perdegreemeshTopologyExampleV2_expected.json index ac1ea9aa7..843a7adb0 100644 --- a/tests/data/perdegreemeshTopologyExampleV2_expected.json +++ b/tests/data/perdegreemeshTopologyExampleV2_expected.json @@ -666,7 +666,7 @@ "type": "Edfa", "operational": { "gain_target": null, - "tilt_target": 0 + "tilt_target": null } }, { @@ -682,7 +682,7 @@ "type": "Edfa", "operational": { "gain_target": null, - "tilt_target": 0 + "tilt_target": null } }, { @@ -698,7 +698,7 @@ "type": "Edfa", "operational": { "gain_target": null, - "tilt_target": 0 + "tilt_target": null } }, { @@ -714,7 +714,7 @@ "type": "Edfa", "operational": { "gain_target": null, - "tilt_target": 0 + "tilt_target": null } }, { @@ -732,7 +732,7 @@ "operational": { "gain_target": 20.0, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -766,7 +766,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -784,7 +784,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -802,7 +802,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -820,7 +820,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -838,7 +838,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -856,7 +856,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -874,7 +874,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -892,7 +892,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -910,7 +910,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -928,7 +928,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -946,7 +946,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -964,7 +964,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -983,7 +983,7 @@ "operational": { "gain_target": 18.0, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1001,7 +1001,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1019,7 +1019,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1037,7 +1037,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } } diff --git a/tests/data/testTopology_expected.json b/tests/data/testTopology_expected.json index 0df200ede..5a740c8fe 100644 --- a/tests/data/testTopology_expected.json +++ b/tests/data/testTopology_expected.json @@ -1171,7 +1171,7 @@ "operational": { "gain_target": 19.0, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1190,7 +1190,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1209,7 +1209,7 @@ "operational": { "gain_target": 18.0, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": 0.5 } }, @@ -1227,7 +1227,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1245,7 +1245,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1263,7 +1263,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1281,7 +1281,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1299,7 +1299,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1318,7 +1318,7 @@ "operational": { "gain_target": 18.5, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1336,7 +1336,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1354,7 +1354,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1372,7 +1372,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1391,7 +1391,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1409,7 +1409,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1428,7 +1428,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1446,7 +1446,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1464,7 +1464,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1482,7 +1482,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1500,7 +1500,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1518,7 +1518,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1551,7 +1551,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1569,7 +1569,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1587,7 +1587,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1605,7 +1605,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1623,7 +1623,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1641,7 +1641,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1659,7 +1659,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1677,7 +1677,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1695,7 +1695,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1713,7 +1713,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1731,7 +1731,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1749,7 +1749,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1768,7 +1768,7 @@ "operational": { "gain_target": 18.0, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1786,7 +1786,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1805,7 +1805,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1823,7 +1823,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1841,7 +1841,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1859,7 +1859,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1877,7 +1877,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1895,7 +1895,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1913,7 +1913,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1931,7 +1931,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1949,7 +1949,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1967,7 +1967,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -1985,7 +1985,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2003,7 +2003,7 @@ "operational": { "gain_target": 19.0, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2021,7 +2021,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2039,7 +2039,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2057,7 +2057,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2075,7 +2075,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2093,7 +2093,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2111,7 +2111,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2129,7 +2129,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2147,7 +2147,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2165,7 +2165,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2183,7 +2183,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2201,7 +2201,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2219,7 +2219,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2237,7 +2237,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2255,7 +2255,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2273,7 +2273,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2291,7 +2291,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2309,7 +2309,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2327,7 +2327,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }, @@ -2345,7 +2345,7 @@ "operational": { "gain_target": null, "delta_p": null, - "tilt_target": 0, + "tilt_target": null, "out_voa": null } }