Skip to content

Commit 3927195

Browse files
committed
ENH improve error message for wrong number of voxels
1 parent a3db4b7 commit 3927195

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

voxelwise_tutorials/viz.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,11 @@ def map_voxels_to_flatmap(voxels, mapper_file):
171171

172172
# dimensions
173173
width, height = flatmap_mask.shape
174-
n_voxels, n_channels = voxels.shape
175-
n_pixels_used, n_voxels = voxel_to_flatmap.shape
174+
n_voxels_0, n_channels = voxels.shape
175+
n_pixels_used, n_voxels_1 = voxel_to_flatmap.shape
176+
if n_voxels_0 != n_voxels_1:
177+
raise ValueError(f"Dimension mismatch, {n_voxels_0} voxels given "
178+
f"while the mapper expects {n_voxels_1} voxels.")
176179

177180
# create image with nans, and array with used pixels
178181
img = np.full(shape=(width, height, n_channels), fill_value=np.nan)

0 commit comments

Comments
 (0)