Skip to content

Commit aed6763

Browse files
committed
Fix not accounting for Nones in slice
1 parent 9326f19 commit aed6763

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

caiman/motion_correction.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,12 @@ def apply_shifts_movie(self, fname, rigid_shifts: Optional[bool] = None, save_me
466466
shifts_opencv=self.shifts_opencv, upsample_factor_grid=self.upsample_factor_grid)
467467

468468
# if only a portion of the original image was used, offset/multiply patch centers to now apply to the whole movie
469-
patch_centers = tuple([
470-
list(dim_inds.start + dim_inds.step * np.array(dim_centers_orig))
471-
for dim_inds, dim_centers_orig in zip(self.indices, patch_centers_orig)
472-
])
469+
# compute one dimension at a time.
470+
patch_centers = tuple([] for _ in patch_centers_orig)
471+
for dim_inds, dim_centers_orig, dim_centers in zip(self.indices, patch_centers_orig, patch_centers):
472+
start = dim_inds.start if dim_inds.start is not None else 0
473+
step = dim_inds.step if dim_inds.step is not None else 1
474+
dim_centers.extend([start + step * center for center in dim_centers_orig])
473475

474476
# force shifts_interpolate if there was any cropping - easier than making a special-case path that
475477
# resizes the shifts and extrapolates to the border but doesn't fully take patch centers into account

0 commit comments

Comments
 (0)