Skip to content

Commit f1d1e4d

Browse files
committed
Format bench with ruff
1 parent 48724b9 commit f1d1e4d

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

bench/ndarray/concatenate.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,7 @@ def run_benchmark(num_arrays=10, size=500, aligned_chunks=False, axis=0):
4242
arrays = []
4343
for i, (shape, chunk_shape) in enumerate(zip(shapes, chunk_shapes)):
4444
arr = blosc2.arange(
45-
i * np.prod(shape),
46-
(i + 1) * np.prod(shape),
47-
1,
48-
dtype="i4",
49-
shape=shape,
50-
chunks=chunk_shape
45+
i * np.prod(shape), (i + 1) * np.prod(shape), 1, dtype="i4", shape=shape, chunks=chunk_shape
5146
)
5247
arrays.append(arr)
5348

@@ -56,9 +51,6 @@ def run_benchmark(num_arrays=10, size=500, aligned_chunks=False, axis=0):
5651
result = blosc2.concatenate(arrays, axis=axis)
5752
duration = time.time() - start_time
5853

59-
# Force evaluation by accessing a value
60-
#_ = result[0, 0]
61-
6254
return duration, result.shape
6355

6456

@@ -82,7 +74,7 @@ def main():
8274
aligned_time, shape2 = run_benchmark(num_arrays, size, aligned_chunks=True, axis=axis)
8375

8476
# Calculate speedup
85-
speedup = unaligned_time / aligned_time if aligned_time > 0 else float('inf')
77+
speedup = unaligned_time / aligned_time if aligned_time > 0 else float("inf")
8678

8779
# Print results
8880
print(f"{size:<10} {unaligned_time:<15.4f} {aligned_time:<15.4f} {speedup:<10.2f}x")
@@ -93,9 +85,13 @@ def main():
9385
else:
9486
expected_shape = (size, size) # After concatenation along axis 1
9587
if shape1 != expected_shape:
96-
print(f"Warning: result shape unaligned {shape1} does not match expected shape {expected_shape}")
88+
print(
89+
f"Warning: result shape unaligned {shape1} does not match expected shape {expected_shape}"
90+
)
9791
if shape2 != expected_shape:
98-
print(f"Warning: result shape aligned {shape2} does not match expected shape {expected_shape}")
92+
print(
93+
f"Warning: result shape aligned {shape2} does not match expected shape {expected_shape}"
94+
)
9995

10096
print(f"{'=' * 50}")
10197

0 commit comments

Comments
 (0)