From 5eb460ecb738687dec698eaa69ad874ce24eabd7 Mon Sep 17 00:00:00 2001 From: jan Date: Sun, 8 Mar 2026 22:43:58 -0700 Subject: [PATCH] [repetition.Grid] disallow b_vector=None (except when initializing) --- masque/repetition.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/masque/repetition.py b/masque/repetition.py index 0426c08..867adf7 100644 --- a/masque/repetition.py +++ b/masque/repetition.py @@ -64,7 +64,7 @@ class Grid(Repetition): _a_count: int """ Number of instances along the direction specified by the `a_vector` """ - _b_vector: NDArray[numpy.float64] | None + _b_vector: NDArray[numpy.float64] """ Vector `[x, y]` specifying a second lattice vector for the grid. Specifies center-to-center spacing between adjacent elements. Can be `None` for a 1D array. @@ -199,9 +199,6 @@ class Grid(Repetition): @property def displacements(self) -> NDArray[numpy.float64]: - if self.b_vector is None: - return numpy.arange(self.a_count)[:, None] * self.a_vector[None, :] - aa, bb = numpy.meshgrid(numpy.arange(self.a_count), numpy.arange(self.b_count), indexing='ij') return (aa.flatten()[:, None] * self.a_vector[None, :] + bb.flatten()[:, None] * self.b_vector[None, :]) # noqa