From 01fe53dc796c65ef56a2d1959425441f852f798a Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Sun, 28 Jul 2024 19:37:20 -0700 Subject: [PATCH] fix final assignment and clarify what's going --- masque/shapes/shape.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/masque/shapes/shape.py b/masque/shapes/shape.py index acdd266..9f5dd19 100644 --- a/masque/shapes/shape.py +++ b/masque/shapes/shape.py @@ -266,11 +266,12 @@ class Shape(PositionableImpl, Rotatable, Mirrorable, Copyable, Scalable, mins, maxs = bounds keep_x = numpy.logical_and(grx > mins[0], grx < maxs[0]) keep_y = numpy.logical_and(gry > mins[1], gry < maxs[1]) - for k in (keep_x, keep_y): - for s in (1, 2): - k[s:] += k[:-s] - k[:-s] += k[s:] - k = k > 0 + # Flood left & rightwards by 2 cells + for kk in (keep_x, keep_y): + for ss in (1, 2): + kk[ss:] += kk[:-ss] + kk[:-ss] += kk[ss:] + kk[:] = kk > 0 gx = grx[keep_x] gy = gry[keep_y]