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

rename reflect_h to mirror_x and reflect_v to mirror_y #896

Merged
merged 1 commit into from Nov 20, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,7 @@
## [6.1.2](https://github.com/gdsfactory/gdsfactory/pull/895)

- mmi input waveguide width is optional and defaults to cross_section.width
- rename reflect_h to mirror_x and reflect_v to mirror_y

## 6.1.1

Expand Down
4 changes: 2 additions & 2 deletions gdsfactory/component.py
Expand Up @@ -606,10 +606,10 @@ def ref(

origin = self.ports[port_id].center if port_id else (0, 0)
if h_mirror:
_ref.reflect_h(port_id)
_ref.mirror_x(port_id)

if v_mirror:
_ref.reflect_v(port_id)
_ref.mirror_y(port_id)

if rotation != 0:
_ref.rotate(rotation, origin)
Expand Down
4 changes: 2 additions & 2 deletions gdsfactory/component_reference.py
Expand Up @@ -601,7 +601,7 @@ def rotate(
self._bb_valid = False
return self

def reflect_h(
def mirror_x(
self, port_name: Optional[str] = None, x0: Optional[Coordinate] = None
) -> "ComponentReference":
"""Perform horizontal mirror using x0 or port as axis (default, x0=0).
Expand All @@ -617,7 +617,7 @@ def reflect_h(
self.mirror((x0, 1), (x0, 0))
return self

def reflect_v(
def mirror_y(
self, port_name: Optional[str] = None, y0: Optional[float] = None
) -> "ComponentReference":
"""Perform vertical mirror using y0 as axis (default, y0=0)."""
Expand Down
4 changes: 2 additions & 2 deletions gdsfactory/components/component_sequence.py
Expand Up @@ -56,9 +56,9 @@ def parse_component_name(name: str) -> Tuple[str, bool]:
def _flip_ref(c_ref, port_name):
a = c_ref.ports[port_name].orientation
if a in [0, 180]:
c_ref.reflect_v(port_name)
c_ref.mirror_y(port_name)
else:
c_ref.reflect_h(port_name)
c_ref.mirror_x(port_name)
return c_ref


Expand Down
10 changes: 5 additions & 5 deletions gdsfactory/read/from_yaml.py
Expand Up @@ -259,18 +259,18 @@ def place(

if mirror:
if mirror is True and port:
ref.reflect_h(x0=_get_anchor_value_from_name(ref, port, "x"))
ref.mirror_x(x0=_get_anchor_value_from_name(ref, port, "x"))
elif mirror is True:
if x:
ref.reflect_h(x0=x)
ref.mirror_x(x0=x)
else:
ref.reflect_h()
ref.mirror_x()
elif mirror is False:
pass
elif isinstance(mirror, str):
ref.reflect_h(port_name=mirror)
ref.mirror_x(port_name=mirror)
elif isinstance(mirror, (int, float)):
ref.reflect_h(x0=mirror)
ref.mirror_x(x0=mirror)
else:
raise ValueError(
f"{mirror!r} can only be a port name {ref.ports.keys()}, "
Expand Down
2 changes: 1 addition & 1 deletion gdsfactory/routing/manhattan.py
Expand Up @@ -887,7 +887,7 @@ def round_corners(
wg_ref = wg.ref()
wg_ref.move(wg.ports[pname_west], (0, 0))
if mirror_straight:
wg_ref.reflect_v(list(wg_ref.ports.values())[0].name)
wg_ref.mirror_y(list(wg_ref.ports.values())[0].name)

wg_ref.rotate(angle)
wg_ref.move(straight_origin)
Expand Down