This commit is contained in:
Jan Petykiewicz 2024-10-05 14:27:12 -07:00
parent 73193473df
commit 33a1e2eb85

View File

@ -467,7 +467,7 @@ class PortList(metaclass=ABCMeta):
specifying port connections, find the transform which will correctly specifying port connections, find the transform which will correctly
align the specified o_ports onto their respective s_ports. align the specified o_ports onto their respective s_ports.
Args:t Args:
s_ports: A list of stationary ports s_ports: A list of stationary ports
o_ports: A list of ports which are to be moved/mirrored. o_ports: A list of ports which are to be moved/mirrored.
map_in: dict of `{'s_port': 'o_port'}` mappings, specifying map_in: dict of `{'s_port': 'o_port'}` mappings, specifying
@ -523,8 +523,8 @@ class PortList(metaclass=ABCMeta):
if not numpy.allclose(rotations[:1], rotations): if not numpy.allclose(rotations[:1], rotations):
rot_deg = numpy.rad2deg(rotations) rot_deg = numpy.rad2deg(rotations)
msg = 'Port orientations do not match:\n' msg = 'Port orientations do not match:\n'
for nn, (k, v) in enumerate(map_in.items()): for nn, (kk, vv) in enumerate(map_in.items()):
msg += f'{k} | {rot_deg[nn]:g} | {v}\n' msg += f'{kk} | {rot_deg[nn]:g} | {vv}\n'
raise PortError(msg) raise PortError(msg)
pivot = o_offsets[0].copy() pivot = o_offsets[0].copy()
@ -532,8 +532,8 @@ class PortList(metaclass=ABCMeta):
translations = s_offsets - o_offsets translations = s_offsets - o_offsets
if not numpy.allclose(translations[:1], translations): if not numpy.allclose(translations[:1], translations):
msg = 'Port translations do not match:\n' msg = 'Port translations do not match:\n'
for nn, (k, v) in enumerate(map_in.items()): for nn, (kk, vv) in enumerate(map_in.items()):
msg += f'{k} | {translations[nn]} | {v}\n' msg += f'{kk} | {translations[nn]} | {vv}\n'
raise PortError(msg) raise PortError(msg)
return translations[0], rotations[0], o_offsets[0] return translations[0], rotations[0], o_offsets[0]