Skip to content

Commit affea87

Browse files
committed
remove mask_2d_via_shape_native_and_native_for_slim
1 parent 744e2ed commit affea87

2 files changed

Lines changed: 1 addition & 82 deletions

File tree

autoarray/mask/mask_2d_util.py

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -496,50 +496,7 @@ def blurring_mask_2d_from(
496496
~mask_2d + result_mask
497497
)
498498

499-
return blurring_mask
500-
501-
502-
@numba_util.jit()
503-
def mask_2d_via_shape_native_and_native_for_slim(
504-
shape_native: Tuple[int, int], native_for_slim: np.ndarray
505-
) -> np.ndarray:
506-
"""
507-
For a slimmed set of data that was computed by mapping unmasked values from a native 2D array of shape
508-
(total_y_pixels, total_x_pixels), map its slimmed indexes back to the original 2D array to create the
509-
native 2D mask.
510-
511-
This uses an array 'native_for_slim' of shape [total_masked_pixels[ where each index gives the native 2D pixel
512-
indexes of the slimmed array's unmasked pixels, for example:
513-
514-
- If native_for_slim[0] = [0,0], the first value of the slimmed array maps to the pixel [0,0] of the native 2D array.
515-
- If native_for_slim[1] = [0,1], the second value of the slimmed array maps to the pixel [0,1] of the native 2D array.
516-
- If native_for_slim[4] = [1,1], the fifth value of the slimmed array maps to the pixel [1,1] of the native 2D array.
517-
518-
Parameters
519-
----------
520-
shape_native
521-
The shape of the 2D array which the pixels are defined on.
522-
native_for_slim
523-
An array describing the native 2D array index that every slimmed array index maps too.
524-
525-
Returns
526-
-------
527-
ndarray
528-
A 2D mask array where unmasked values are `False`.
529-
530-
Examples
531-
--------
532-
native_for_slim = np.array([[0,1], [1,0], [1,1], [1,2], [2,1]])
533-
534-
mask = mask_from(shape=(3,3), native_for_slim=native_for_slim)
535-
"""
536-
537-
mask = np.ones(shape_native)
538-
539-
for index in range(len(native_for_slim)):
540-
mask[native_for_slim[index, 0], native_for_slim[index, 1]] = False
541-
542-
return mask
499+
return blurring_mask
543500

544501

545502
@numba_util.jit()

test_autoarray/mask/test_mask_2d_util.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -668,44 +668,6 @@ def test__blurring_mask_2d_from__mask_extends_beyond_edge_so_raises_mask_excepti
668668
util.mask_2d.blurring_mask_2d_from(mask, kernel_shape_native=(5, 5))
669669

670670

671-
def test__mask_2d_via_shape_native_and_native_for_slim():
672-
slim_to_native = np.array([[0, 0], [0, 1], [1, 0], [1, 1]])
673-
shape = (2, 2)
674-
675-
mask = util.mask_2d.mask_2d_via_shape_native_and_native_for_slim(
676-
shape_native=shape, native_for_slim=slim_to_native
677-
)
678-
679-
assert (mask == np.array([[False, False], [False, False]])).all()
680-
681-
slim_to_native = np.array([[0, 0], [0, 1], [1, 0]])
682-
shape = (2, 2)
683-
684-
mask = util.mask_2d.mask_2d_via_shape_native_and_native_for_slim(
685-
shape_native=shape, native_for_slim=slim_to_native
686-
)
687-
688-
assert (mask == np.array([[False, False], [False, True]])).all()
689-
690-
slim_to_native = np.array([[0, 0], [0, 1], [1, 0], [2, 0], [2, 1], [2, 3]])
691-
shape = (3, 4)
692-
693-
mask = util.mask_2d.mask_2d_via_shape_native_and_native_for_slim(
694-
shape_native=shape, native_for_slim=slim_to_native
695-
)
696-
697-
assert (
698-
mask
699-
== np.array(
700-
[
701-
[False, False, True, True],
702-
[False, True, True, True],
703-
[False, False, True, False],
704-
]
705-
)
706-
).all()
707-
708-
709671
def test__mask_1d_indexes_from():
710672
mask = np.array(
711673
[

0 commit comments

Comments
 (0)