diff --git a/caiman/base/movies.py b/caiman/base/movies.py index 0e0805dc1..f0a9a5796 100644 --- a/caiman/base/movies.py +++ b/caiman/base/movies.py @@ -2026,7 +2026,14 @@ def get_file_size(file_name, var_name_hdf5:str='mov') -> tuple[tuple, Union[int, raise Exception('Variable not found. Use one of the above') T, dims = siz[0], siz[1:] elif extension in ('.npy', ): - shape = np.load(file_name, allow_pickle=False).shape + with open(file_name, 'rb') as f: + version = np.lib.format.read_magic(f) + if version == (1, 0): + shape, _, _ = np.lib.format.read_array_header_1_0(f) + elif version == (2, 0): + shape, _, _ = np.lib.format.read_array_header_2_0(f) + else: + raise ValueError(f"Unsupported .npy file version: {version}. Update caiman.base.movies.get_file_size() to handle it.") T = shape[0] dims = shape[1:] elif extension in ('.sbx'):