Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable all angle router tests #1721

Merged
merged 3 commits into from Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Expand Up @@ -2,6 +2,10 @@

## [Unreleased](https://github.com/gdsfactory/gdsfactory/compare/v6.101.1...main)

## [6.102.0](https://github.com/gdsfactory/gdsfactory/compare/v6.102.0...v6.101.1)

- fix snapping references [PR](https://github.com/gdsfactory/gdsfactory/pull/1719)

## [6.101.1](https://github.com/gdsfactory/gdsfactory/compare/v6.101.1...v6.101.0)

- fix kfactory dependency [PR](https://github.com/gdsfactory/gdsfactory/pull/1714)
Expand Down
29 changes: 16 additions & 13 deletions gdsfactory/routing/all_angle.py
Expand Up @@ -3,6 +3,7 @@

import numpy as np
import shapely.geometry as sg
from gdsfactory.components.straight import straight
from gdsfactory.component import Port, ComponentReference, Component
from gdsfactory.path import Path
from gdsfactory.generic_tech.layer_map import LAYER
Expand All @@ -28,7 +29,7 @@ def get_connector(name: str) -> Connector:
Gets a connector function by name.

Args:
name: the name of the connector function to retrieve
name: the name of the connector function to retrieve.

Returns:
The specified connector function.
Expand Down Expand Up @@ -208,11 +209,12 @@ def straight_connector(
Connects between the two ports with a straight of the given cross-section.

Args:
port1: the starting port
port2: the ending port
cross_section: the cross-section to use
port1: the starting port.
port2: the ending port.
cross_section: the cross-section to use.

Returns:
A list of component references comprising the connection
A list of component references comprising the connection.
"""
if np.array_equal(port1.center, port2.center):
return []
Expand All @@ -225,10 +227,10 @@ def straight_connector(
message=f"Not enough room to route between ports: {port1} and {port2}",
)

straight_component = extrude(path, cross_section=cross_section)
# straight_component = get_component(straight, length=distance, cross_section=cross_section)
length = np.linalg.norm(port1.center - port2.center)
straight_component = straight(length=length, cross_section=cross_section)
straight_ref = ComponentReference(straight_component)
# straight_ref.connect('in0', port1)
straight_ref.connect(list(straight_component.ports.keys())[0], port1)
return [straight_ref]


Expand All @@ -242,12 +244,13 @@ def auto_taper_connector(
Connects the two ports with a straight in the specified cross_section, adding tapers at either end if necessary.

Args:
port1: the first port
port2: the final port
cross_section: the primary cross section to use for the route
inner_connector: the connector to use after attaching tapers
port1: the first port.
port2: the final port.
cross_section: the primary cross section to use for the route.
inner_connector: the connector to use after attaching tapers.

Returns:
A list of references comprising the connection
A list of references comprising the connection.
"""
taper1 = taper_to_cross_section(port1, cross_section)
taper2 = taper_to_cross_section(port2, cross_section)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_get_bundle_all_angle.py
Expand Up @@ -27,7 +27,7 @@ def test_get_bundle_all_angle(
lengths = {}
for i, route in enumerate(routes):
c.add(route.references)
lengths[i] = route.length
lengths[i] = float(route.length)

if check:
data_regression.check(lengths)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_get_bundle_all_angle/test_get_bundle_all_angle.yml
@@ -1,2 +1,2 @@
0: 78.60499999999999
1: 80.381
0: 78.60523731675374
1: 80.38148170516394