Skip to content

Commit ec718c5

Browse files
committed
bug fix in downsampling function
1 parent a2533f4 commit ec718c5

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

fimpy/pipeline/general.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,13 @@ def downsample(
161161
shape_block=proc_block_shape if proc_block_shape else dataset.shape_block,
162162
)
163163

164-
shape_downsampled = tuple(
165-
sc // ds for sc, ds in zip(old_dataset.shape_cropped, downsampling)
166-
)
167-
block_size_downsampled = tuple(
168-
sb // ds for (sb, ds) in zip(old_dataset.shape_block, downsampling)
169-
)
164+
size_array = np.ones(old_dataset.shape_cropped[2:])
165+
size = block_reduce(size_array, downsampling[2:], method).shape
166+
shape_downsampled = old_dataset.shape_cropped[:2] + size
167+
168+
size_array = np.ones(old_dataset.shape_block[2:])
169+
size = block_reduce(size_array, downsampling[2:], method).shape
170+
block_size_downsampled = old_dataset.shape_block[:2] + size
170171

171172
new_dataset = EmptySplitDataset(
172173
root=output_dir or dataset.root.parent,

0 commit comments

Comments
 (0)