Skip to content

Commit 761490f

Browse files
committed
use oindex instead of double loop
1 parent 557b136 commit 761490f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

iohub/ngff/nodes.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,11 +1460,8 @@ def _coord_unit(dim, default):
14601460
t_coords = data_array.coords["t"].values
14611461
t_indices = np.round((t_coords - translation[0]) / scale[0]).astype(int)
14621462

1463-
# Write each (T, C) slice into the zarr array
1464-
img = self[image]
1465-
for xa_t, zarr_t in enumerate(t_indices):
1466-
for xa_c, zarr_c in enumerate(c_indices):
1467-
img[zarr_t, zarr_c] = np_data[xa_t, xa_c]
1463+
arr = self[image]
1464+
arr.oindex[t_indices, c_indices] = np_data
14681465

14691466
# Persist DataArray attrs to zarr for round-tripping
14701467
if data_array.attrs:

0 commit comments

Comments
 (0)