From 868535ae874f678c02aa752d97d14c50414b0add Mon Sep 17 00:00:00 2001 From: Roy Smart Date: Mon, 16 Oct 2023 16:48:38 -0600 Subject: [PATCH] Added `optika.apertures.RegularPolygonalAperture`. --- optika/_tests/test_apertures.py | 25 +++++++++++++++++++++++++ optika/apertures.py | 13 +++++++++++++ 2 files changed, 38 insertions(+) diff --git a/optika/_tests/test_apertures.py b/optika/_tests/test_apertures.py index e190715..8077a52 100644 --- a/optika/_tests/test_apertures.py +++ b/optika/_tests/test_apertures.py @@ -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, ): diff --git a/optika/apertures.py b/optika/apertures.py index ddae5ad..359e0a9 100644 --- a/optika/apertures.py +++ b/optika/apertures.py @@ -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,