Skip to content

Commit 4a22789

Browse files
authored
Merge pull request #1534 from proektlab/save-memmap-addtomov-consistency
Set default add_to_movie = 0.0001
2 parents 47a6690 + 4b33557 commit 4a22789

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

caiman/mmapping.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def save_memmap_each(fnames: list[str],
177177
return fnames_new
178178

179179
def save_memmap_join(mmap_fnames:list[str], base_name: str = None, n_chunks: int = 20, dview=None,
180-
add_to_mov=0) -> str:
180+
add_to_mov: float = 0.0) -> str:
181181
"""
182182
Makes a large file memmap from a number of smaller files
183183
@@ -190,7 +190,7 @@ def save_memmap_join(mmap_fnames:list[str], base_name: str = None, n_chunks: int
190190
191191
dview: cluster handle
192192
193-
add_to_mov: (undocumented)
193+
add_to_mov: constant to add to the entire movie
194194
195195
"""
196196
logger = logging.getLogger("caiman")
@@ -363,7 +363,7 @@ def save_memmap(filenames:list[str],
363363
var_name_hdf5: str = 'mov',
364364
xy_shifts: Optional[list] = None,
365365
is_3D: bool = False,
366-
add_to_movie: float = 0,
366+
add_to_movie: float = 0.0001,
367367
border_to_0=0,
368368
dview=None,
369369
n_chunks: int = 100,
@@ -449,7 +449,7 @@ def save_memmap(filenames:list[str],
449449
xy_shifts=xy_shifts,
450450
is_3D=is_3D,
451451
slices=slices,
452-
add_to_movie=add_to_movie)
452+
add_to_movie=0.0) # applied below in save_memmap_join
453453
else:
454454
fname_parts = filenames
455455

@@ -458,7 +458,7 @@ def save_memmap(filenames:list[str],
458458
raise Exception('You cannot merge files in F order, they must be in C order')
459459

460460
fname_new = caiman.save_memmap_join(fname_parts, base_name=base_name,
461-
dview=dview, n_chunks=n_chunks)
461+
dview=dview, n_chunks=n_chunks, add_to_mov=add_to_movie)
462462

463463
else:
464464
# TODO: can be done online
@@ -505,7 +505,7 @@ def save_memmap(filenames:list[str],
505505
if slices is not None:
506506
if isinstance(slices, list):
507507
raise Exception(
508-
'You cannot slice in x and y and then use add_to_movie: if you only want to slice in time do not pass in a list but just a slice object'
508+
'You cannot slice in x and y and then use border_to_0: if you only want to slice in time do not pass in a list but just a slice object'
509509
)
510510

511511
min_mov = Yr.calc_min()
@@ -523,7 +523,7 @@ def save_memmap(filenames:list[str],
523523
T, dims = Yr.shape[0], Yr.shape[1:]
524524
Yr = np.transpose(Yr, list(range(1, len(dims) + 1)) + [0])
525525
Yr = np.reshape(Yr, (np.prod(dims), T), order='F')
526-
Yr = np.ascontiguousarray(Yr, dtype=np.float32) + np.float32(0.0001) + np.float32(add_to_movie)
526+
Yr = np.ascontiguousarray(Yr, dtype=np.float32) + np.float32(add_to_movie)
527527

528528
if idx == 0:
529529
fname_tot = caiman.paths.generate_fname_tot(base_name, dims, order)

0 commit comments

Comments
 (0)