mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-11-01 18:47:48 +00:00
Fix bug when calculating new coordinates in split_fiber
The current implementation based on scipy interp1d fails when predecessor and successor of the fiber to be split have the same longitude. In this case the new latitudes become NaN. This patch fixes the bug. Change-Id: I7c5dc4d410630a6b4b773d36cc192db8271a4346 Signed-off-by: Jonas Mårtensson <jonas.martensson@ri.se>
This commit is contained in:
@@ -8,7 +8,6 @@ gnpy.core.network
|
||||
Working with networks which consist of network elements
|
||||
'''
|
||||
|
||||
from scipy.interpolate import interp1d
|
||||
from operator import attrgetter
|
||||
from gnpy.core import ansi_escapes, elements
|
||||
from gnpy.core.exceptions import ConfigurationError, NetworkTopologyError
|
||||
@@ -380,9 +379,8 @@ def split_fiber(network, fiber, bounds, target_length, equipment):
|
||||
|
||||
fiber.params.length = new_length
|
||||
|
||||
f = interp1d([prev_node.lng, next_node.lng], [prev_node.lat, next_node.lat])
|
||||
xpos = [prev_node.lng + (next_node.lng - prev_node.lng) * (n + 1) / (n_spans + 1) for n in range(n_spans)]
|
||||
ypos = f(xpos)
|
||||
ypos = [prev_node.lat + (next_node.lat - prev_node.lat) * (n + 1) / (n_spans + 1) for n in range(n_spans)]
|
||||
for span, lng, lat in zip(range(n_spans), xpos, ypos):
|
||||
new_span = elements.Fiber(uid=f'{fiber.uid}_({span+1}/{n_spans})',
|
||||
type_variety=fiber.type_variety,
|
||||
|
||||
Reference in New Issue
Block a user