Skip to content

Commit

Permalink
replce np.all to alltrue
Browse files Browse the repository at this point in the history
  • Loading branch information
xiuliren committed Nov 27, 2024
1 parent 48c4397 commit de411fd
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion chunkflow/chunk/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(self, array: np.ndarray,
self.voxel_size = voxel_size
if voxel_size is not None:
assert len(voxel_size) == 3
assert np.alltrue([vs > 0 for vs in voxel_size])
assert np.all([vs > 0 for vs in voxel_size])

if layer_type is not None:
self.layer_type = layer_type
Expand Down
2 changes: 1 addition & 1 deletion chunkflow/flow/downsample_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self,
self.start_mip = start_mip
self.stop_mip = stop_mip
assert len(factor) == 3
assert np.alltrue([f>=1 for f in factor])
assert np.all([f>=1 for f in factor])
assert stop_mip > start_mip
assert start_mip > chunk_mip

Expand Down
2 changes: 1 addition & 1 deletion chunkflow/flow/load_precomputed.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,4 @@ def _validate_chunk(self, chunk):
validate_input = np.squeeze(validate_input, axis=3)

# use the validate input to check the downloaded input
assert np.alltrue(validate_input == clamped_input)
assert np.all(validate_input == clamped_input)
4 changes: 2 additions & 2 deletions chunkflow/flow/mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __call__(self, chunks: list):

mask_in_high_mip = self._read_mask_in_high_mip(chunks[0].bbox, factor)

if np.alltrue(mask_in_high_mip == 0):
if np.all(mask_in_high_mip == 0):
print('the mask is all black, mask all the voxels directly')
for chunk in chunks:
np.multiply(chunk, 0, out=chunk)
Expand Down Expand Up @@ -100,7 +100,7 @@ def _read_mask_in_high_mip(self, chunk_bbox, factor):
# the slices did not contain the channel dimension
mask = self.mask_vol[mask_slices[::-1]]
# this is a cloudvolume VolumeCutout rather than a normal numpy array
# which will make np.alltrue(mask_in_high_mip == 0) to be
# which will make np.all(mask_in_high_mip == 0) to be
# VolumeCutout(False) rather than False, so we need to transform it
# to numpy
mask = mask.astype(bool)
Expand Down
4 changes: 2 additions & 2 deletions tests/flow/divid_conquer/test_inferencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_test_time_augmentation():
output = output * 255
output.astype(np.uint8)

assert np.alltrue(np.isclose(image, output, atol=1))
assert np.all(np.isclose(image, output, atol=1))

def test_aligned_input_size():
print('\ntest block inference with aligned input size...')
Expand All @@ -55,7 +55,7 @@ def test_aligned_input_size():
output = output * 255
output.astype(np.uint8)

assert np.alltrue(np.isclose(image, output, atol=1))
assert np.all(np.isclose(image, output, atol=1))

def test_aligned_patch_num():
print('\ntest block inference with patch number...')
Expand Down

0 comments on commit de411fd

Please sign in to comment.