Skip to content

Commit

Permalink
Added optika.apertures.RegularPolygonalAperture.
Browse files Browse the repository at this point in the history
  • Loading branch information
byrdie committed Oct 16, 2023
1 parent f069d6f commit 868535a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
25 changes: 25 additions & 0 deletions optika/_tests/test_apertures.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,31 @@ def test_num_vertices(self, a: optika.apertures.AbstractRegularPolygonalAperture
assert isinstance(a.num_vertices, int)


@pytest.mark.parametrize(
argnames="a",
argvalues=[
optika.apertures.RegularPolygonalAperture(
radius=radius,
num_vertices=6,
samples_wire=21,
active=active,
inverted=inverted,
transformation=transformation,
kwargs_plot=kwargs_plot,
)
for radius in radius_parameterization
for active in active_parameterization
for inverted in inverted_parameterization
for transformation in transform_parameterization
for kwargs_plot in test_plotting.kwargs_plot_parameterization
],
)
class TestRegularPolygonalAperture(
AbstractTestAbstractRegularPolygonalAperture,
):
pass


class AbstractTestAbstractOctagonalAperture(
AbstractTestAbstractRegularPolygonalAperture,
):
Expand Down
13 changes: 13 additions & 0 deletions optika/apertures.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,19 @@ def vertices(self) -> na.AbstractCartesian3dVectorArray:
return result


@dataclasses.dataclass(eq=False, repr=False)
class RegularPolygonalAperture(
AbstractRegularPolygonalAperture,
):
radius: float | u.Quantity | na.AbstractScalar = 0 * u.mm
num_vertices: int = 0
samples_wire: int = 101
active: bool | na.AbstractScalar = True
inverted: bool | na.AbstractScalar = False
transformation: None | na.transformations.AbstractTransformation = None
kwargs_plot: None | dict = None


@dataclasses.dataclass(eq=False, repr=False)
class AbstractOctagonalAperture(
AbstractRegularPolygonalAperture,
Expand Down

0 comments on commit 868535a

Please sign in to comment.