From b93ba56288ff2ef17eb74328bacc620493429d76 Mon Sep 17 00:00:00 2001 From: Mayo Faulkner Date: Thu, 22 Dec 2022 10:12:01 +0000 Subject: [PATCH 1/2] change assert to warning --- phylib/io/traces.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phylib/io/traces.py b/phylib/io/traces.py index 5b79e8d..59bae7b 100644 --- a/phylib/io/traces.py +++ b/phylib/io/traces.py @@ -158,8 +158,8 @@ def _memmap_flat(path, dtype=None, n_channels=None, offset=0, mode='r+'): assert n_channels > 0 fsize = path.stat().st_size item_size = np.dtype(dtype).itemsize - assert (fsize - offset) % (item_size * n_channels) == 0,\ - 'Inconsistent number of channels between the params file and the binary dat file' + if (fsize - offset) % (item_size * n_channels) != 0: + logger.warning('Inconsistent number of channels between the params file and the binary dat file') n_samples = (fsize - offset) // (item_size * n_channels) shape = (n_samples, n_channels) return np.memmap(path, dtype=dtype, offset=offset, shape=shape, mode=mode) From 53fe1620015ca37ea9752f3f18655f2bd65fda20 Mon Sep 17 00:00:00 2001 From: Mayo Faulkner Date: Thu, 22 Dec 2022 10:18:16 +0000 Subject: [PATCH 2/2] flake --- phylib/io/traces.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phylib/io/traces.py b/phylib/io/traces.py index 59bae7b..cb0f117 100644 --- a/phylib/io/traces.py +++ b/phylib/io/traces.py @@ -159,7 +159,8 @@ def _memmap_flat(path, dtype=None, n_channels=None, offset=0, mode='r+'): fsize = path.stat().st_size item_size = np.dtype(dtype).itemsize if (fsize - offset) % (item_size * n_channels) != 0: - logger.warning('Inconsistent number of channels between the params file and the binary dat file') + logger.warning('Inconsistent number of channels between the ' + 'params file and the binary dat file') n_samples = (fsize - offset) // (item_size * n_channels) shape = (n_samples, n_channels) return np.memmap(path, dtype=dtype, offset=offset, shape=shape, mode=mode)