diff --git a/masque/builder/builder.py b/masque/builder/builder.py index 243891d..68de9e6 100644 --- a/masque/builder/builder.py +++ b/masque/builder/builder.py @@ -1,17 +1,15 @@ """ Simplified Pattern assembly (`Builder`) """ -from typing import Self, Sequence, Mapping, Literal, overload +from typing import Self, Sequence, Mapping import copy import logging -from numpy import pi from numpy.typing import ArrayLike from ..pattern import Pattern -from ..ref import Ref from ..library import ILibrary -from ..error import PortError, BuildError +from ..error import BuildError from ..ports import PortList, Port from ..abstract import Abstract diff --git a/masque/builder/pather.py b/masque/builder/pather.py index b115f65..b1c8d47 100644 --- a/masque/builder/pather.py +++ b/masque/builder/pather.py @@ -399,12 +399,12 @@ class Pather(Builder): is_horizontal = numpy.isclose(port.rotation % pi, 0) if is_horizontal: if y is not None: - raise BuildError(f'Asked to path to y-coordinate, but port is horizontal') + raise BuildError('Asked to path to y-coordinate, but port is horizontal') if position is None: position = x else: if x is not None: - raise BuildError(f'Asked to path to x-coordinate, but port is vertical') + raise BuildError('Asked to path to x-coordinate, but port is vertical') if position is None: position = y diff --git a/masque/builder/renderpather.py b/masque/builder/renderpather.py index 9b8ba96..e35a672 100644 --- a/masque/builder/renderpather.py +++ b/masque/builder/renderpather.py @@ -12,15 +12,13 @@ from numpy import pi from numpy.typing import ArrayLike from ..pattern import Pattern -from ..ref import Ref -from ..library import ILibrary, Library +from ..library import ILibrary from ..error import PortError, BuildError from ..ports import PortList, Port from ..abstract import Abstract from ..utils import SupportsBool from .tools import Tool, RenderStep from .utils import ell -from .builder import Builder logger = logging.getLogger(__name__) @@ -491,12 +489,12 @@ class RenderPather(PortList): is_horizontal = numpy.isclose(port.rotation % pi, 0) if is_horizontal: if y is not None: - raise BuildError(f'Asked to path to y-coordinate, but port is horizontal') + raise BuildError('Asked to path to y-coordinate, but port is horizontal') if position is None: position = x else: if x is not None: - raise BuildError(f'Asked to path to x-coordinate, but port is vertical') + raise BuildError('Asked to path to x-coordinate, but port is vertical') if position is None: position = y diff --git a/masque/builder/tools.py b/masque/builder/tools.py index 1185185..bc49c56 100644 --- a/masque/builder/tools.py +++ b/masque/builder/tools.py @@ -262,7 +262,6 @@ class BasicTool(Tool, metaclass=ABCMeta): default_out_ptype: str """ Default value for out_ptype """ - @dataclass(frozen=True, slots=True) class LData: """ Data for planL """ diff --git a/masque/builder/utils.py b/masque/builder/utils.py index b3d200d..f23e8d2 100644 --- a/masque/builder/utils.py +++ b/masque/builder/utils.py @@ -122,6 +122,8 @@ def ell( orig_offsets = numpy.array([p.offset for p in ports.values()]) rot_offsets = (rot_matrix @ orig_offsets.T).T +# ordering_base = rot_offsets.T * [[1], [-1 if ccw else 1]] # could work, but this is actually a more complex routing problem +# y_order = numpy.lexsort(ordering_base) # (need to make sure we don't collide with the next input port @ same y) y_order = ((-1 if ccw else 1) * rot_offsets[:, 1]).argsort(kind='stable') y_ind = numpy.empty_like(y_order, dtype=int) y_ind[y_order] = numpy.arange(y_ind.shape[0]) diff --git a/masque/shapes/arc.py b/masque/shapes/arc.py index e6ce411..1841aed 100644 --- a/masque/shapes/arc.py +++ b/masque/shapes/arc.py @@ -1,6 +1,5 @@ from typing import Any import copy -import math import numpy from numpy import pi @@ -231,7 +230,7 @@ class Arc(Shape): def get_thetas(inner: bool) -> NDArray[numpy.float64]: """ Figure out the parameter values at which we should place vertices to meet the arclength constraint""" - dr = -self.width / 2.0 * (-1 if inner else 1) + #dr = -self.width / 2.0 * (-1 if inner else 1) n_pts = numpy.ceil(2 * pi * max(self.radii) / max_arclen).astype(int) arc_lengths, thetas = get_arclens(n_pts, *a_ranges[0 if inner else 1])