Skip to content

Commit 1460984

Browse files
committed
remove anti annular
1 parent ed60fda commit 1460984

4 files changed

Lines changed: 0 additions & 254 deletions

File tree

autoarray/mask/mask_2d.py

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -380,65 +380,6 @@ def circular_annular(
380380
invert=invert,
381381
)
382382

383-
@classmethod
384-
def circular_anti_annular(
385-
cls,
386-
shape_native: Tuple[int, int],
387-
inner_radius: float,
388-
outer_radius: float,
389-
outer_radius_2: float,
390-
pixel_scales: ty.PixelScales,
391-
origin: Tuple[float, float] = (0.0, 0.0),
392-
centre: Tuple[float, float] = (0.0, 0.0),
393-
invert: bool = False,
394-
) -> "Mask2D":
395-
"""
396-
Returns a Mask2D (see *Mask2D.__new__*) where all `False` entries are within an inner circle and second
397-
outer circle, forming an inverse annulus.
398-
399-
The `inner_radius`, `outer_radius`, `outer_radius_2` and `centre` are all input in scaled units.
400-
401-
Parameters
402-
----------
403-
shape_native
404-
The (y,x) shape of the mask in units of pixels.
405-
inner_radius
406-
The inner radius in scaled units of the annulus within which pixels are `False` and unmasked.
407-
outer_radius
408-
The first outer radius in scaled units of the annulus within which pixels are `True` and masked.
409-
outer_radius_2
410-
The second outer radius in scaled units of the annulus within which pixels are `False` and unmasked and
411-
outside of which all entries are `True` and masked.
412-
pixel_scales
413-
The (y,x) scaled units to pixel units conversion factors of every pixel. If this is input as a `float`,
414-
it is converted to a (float, float) structure.
415-
origin
416-
The (y,x) scaled units origin of the mask's coordinate system.
417-
centre
418-
The (y,x) scaled units centre of the anti-annulus used to mask pixels.
419-
invert
420-
If `True`, the `bool`'s of the input `mask` are inverted, for example `False`'s become `True`
421-
and visa versa.
422-
"""
423-
424-
pixel_scales = geometry_util.convert_pixel_scales_2d(pixel_scales=pixel_scales)
425-
426-
mask = mask_2d_util.mask_2d_circular_anti_annular_from(
427-
shape_native=shape_native,
428-
pixel_scales=pixel_scales,
429-
inner_radius=inner_radius,
430-
outer_radius=outer_radius,
431-
outer_radius_2_scaled=outer_radius_2,
432-
centre=centre,
433-
)
434-
435-
return cls(
436-
mask=mask,
437-
pixel_scales=pixel_scales,
438-
origin=origin,
439-
invert=invert,
440-
)
441-
442383
@classmethod
443384
def elliptical(
444385
cls,

autoarray/mask/mask_2d_util.py

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -128,71 +128,6 @@ def mask_2d_circular_annular_from(
128128
return ~((distances_squared >= inner_radius**2) & (distances_squared <= outer_radius**2))
129129

130130

131-
@numba_util.jit()
132-
def mask_2d_circular_anti_annular_from(
133-
shape_native: Tuple[int, int],
134-
pixel_scales: ty.PixelScales,
135-
inner_radius: float,
136-
outer_radius: float,
137-
outer_radius_2_scaled: float,
138-
centre: Tuple[float, float] = (0.0, 0.0),
139-
) -> np.ndarray:
140-
"""
141-
Returns an anti-annular mask from an input inner and outer mask radius and shape. The anti-annular is analogous to
142-
the annular mask but inverted, whereby its unmasked values are those inside the annulus.
143-
144-
This creates a 2D array where all values outside the inner and outer radii are unmasked and therefore `False`.
145-
146-
Parameters
147-
----------
148-
shape_native
149-
The (y,x) shape of the mask in units of pixels.
150-
pixel_scales
151-
The scaled units to pixel units conversion factor of each pixel.
152-
inner_radius
153-
The inner radius in scaled units of the annulus within which pixels are `False` and unmasked.
154-
outer_radius
155-
The first outer radius in scaled units of the annulus within which pixels are `True` and masked.
156-
outer_radius_2
157-
The second outer radius in scaled units of the annulus within which pixels are `False` and unmasked and
158-
outside of which all entries are `True` and masked.
159-
centre
160-
The centre of the annulus used to mask pixels.
161-
162-
Returns
163-
-------
164-
ndarray
165-
The 2D mask array whose central pixels are masked as a annulus.
166-
167-
Examples
168-
--------
169-
mask = mask_annnular_from(
170-
shape=(10, 10), pixel_scales=0.1, inner_radius=0.5, outer_radius=1.5, centre=(0.0, 0.0))
171-
172-
"""
173-
174-
mask_2d = np.full(shape_native, True)
175-
176-
centres_scaled = mask_2d_centres_from(
177-
shape_native=mask_2d.shape, pixel_scales=pixel_scales, centre=centre
178-
)
179-
180-
for y in range(mask_2d.shape[0]):
181-
for x in range(mask_2d.shape[1]):
182-
y_scaled = (y - centres_scaled[0]) * pixel_scales[0]
183-
x_scaled = (x - centres_scaled[1]) * pixel_scales[1]
184-
185-
r_scaled = np.sqrt(x_scaled**2 + y_scaled**2)
186-
187-
if (
188-
inner_radius >= r_scaled
189-
or outer_radius_2_scaled >= r_scaled >= outer_radius
190-
):
191-
mask_2d[y, x] = False
192-
193-
return mask_2d
194-
195-
196131
def mask_2d_via_pixel_coordinates_from(
197132
shape_native: Tuple[int, int], pixel_coordinates: [list], buffer: int = 0
198133
) -> np.ndarray:

test_autoarray/mask/test_mask_2d.py

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -141,45 +141,6 @@ def test__circular_annular():
141141
assert mask.origin == (0.0, 0.0)
142142
assert mask.mask_centre == (0.0, 0.0)
143143

144-
145-
def test__circular_anti_annular():
146-
mask_via_util = aa.util.mask_2d.mask_2d_circular_anti_annular_from(
147-
shape_native=(9, 9),
148-
pixel_scales=(1.2, 1.2),
149-
inner_radius=0.8,
150-
outer_radius=2.2,
151-
outer_radius_2_scaled=3.0,
152-
centre=(0.0, 0.0),
153-
)
154-
155-
mask = aa.Mask2D.circular_anti_annular(
156-
shape_native=(9, 9),
157-
pixel_scales=(1.2, 1.2),
158-
inner_radius=0.8,
159-
outer_radius=2.2,
160-
outer_radius_2=3.0,
161-
centre=(0.0, 0.0),
162-
)
163-
164-
assert (mask == mask_via_util).all()
165-
assert mask.origin == (0.0, 0.0)
166-
assert mask.mask_centre == (0.0, 0.0)
167-
168-
mask = aa.Mask2D.circular_anti_annular(
169-
shape_native=(9, 9),
170-
pixel_scales=(1.2, 1.2),
171-
inner_radius=0.8,
172-
outer_radius=2.2,
173-
outer_radius_2=3.0,
174-
centre=(0.0, 0.0),
175-
invert=True,
176-
)
177-
178-
assert (mask == np.invert(mask_via_util)).all()
179-
assert mask.origin == (0.0, 0.0)
180-
assert mask.mask_centre == (0.0, 0.0)
181-
182-
183144
def test__elliptical():
184145
mask_via_util = aa.util.mask_2d.mask_2d_elliptical_from(
185146
shape_native=(8, 5),

test_autoarray/mask/test_mask_2d_util.py

Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -234,97 +234,6 @@ def test__mask_2d_circular_annular_from__input_centre():
234234
).all()
235235

236236

237-
def test__mask_2d_circular_anti_annular_from():
238-
mask = util.mask_2d.mask_2d_circular_anti_annular_from(
239-
shape_native=(5, 5),
240-
pixel_scales=(1.0, 1.0),
241-
inner_radius=0.5,
242-
outer_radius=10.0,
243-
outer_radius_2_scaled=20.0,
244-
)
245-
246-
assert (
247-
mask
248-
== np.array(
249-
[
250-
[True, True, True, True, True],
251-
[True, True, True, True, True],
252-
[True, True, False, True, True],
253-
[True, True, True, True, True],
254-
[True, True, True, True, True],
255-
]
256-
)
257-
).all()
258-
259-
mask = util.mask_2d.mask_2d_circular_anti_annular_from(
260-
shape_native=(5, 5),
261-
pixel_scales=(0.1, 1.0),
262-
inner_radius=1.5,
263-
outer_radius=10.0,
264-
outer_radius_2_scaled=20.0,
265-
)
266-
267-
assert (
268-
mask
269-
== np.array(
270-
[
271-
[True, False, False, False, True],
272-
[True, False, False, False, True],
273-
[True, False, False, False, True],
274-
[True, False, False, False, True],
275-
[True, False, False, False, True],
276-
]
277-
)
278-
).all()
279-
280-
mask = util.mask_2d.mask_2d_circular_anti_annular_from(
281-
shape_native=(5, 5),
282-
pixel_scales=(1.0, 1.0),
283-
inner_radius=0.5,
284-
outer_radius=1.5,
285-
outer_radius_2_scaled=20.0,
286-
)
287-
288-
assert (
289-
mask
290-
== np.array(
291-
[
292-
[False, False, False, False, False],
293-
[False, True, True, True, False],
294-
[False, True, False, True, False],
295-
[False, True, True, True, False],
296-
[False, False, False, False, False],
297-
]
298-
)
299-
).all()
300-
301-
302-
def test__mask_2d_circular_anti_annular_from__include_centre():
303-
mask = util.mask_2d.mask_2d_circular_anti_annular_from(
304-
shape_native=(7, 7),
305-
pixel_scales=(3.0, 3.0),
306-
inner_radius=1.5,
307-
outer_radius=4.5,
308-
outer_radius_2_scaled=8.7,
309-
centre=(-3.0, 3.0),
310-
)
311-
312-
assert (
313-
mask
314-
== np.array(
315-
[
316-
[True, True, True, True, True, True, True],
317-
[True, True, True, True, True, True, True],
318-
[True, True, False, False, False, False, False],
319-
[True, True, False, True, True, True, False],
320-
[True, True, False, True, False, True, False],
321-
[True, True, False, True, True, True, False],
322-
[True, True, False, False, False, False, False],
323-
]
324-
)
325-
).all()
326-
327-
328237
def test__mask_2d_elliptical_from():
329238
mask = util.mask_2d.mask_2d_elliptical_from(
330239
shape_native=(3, 3),

0 commit comments

Comments
 (0)