From f045ef271ccba00752700ded8c35bb2b244d387e Mon Sep 17 00:00:00 2001 From: zm711 <92116279+zm711@users.noreply.github.com> Date: Wed, 20 Sep 2023 16:33:10 -0400 Subject: [PATCH 1/4] fix numpy deprecations --- src/MEArec/generators/recordinggenerator.py | 4 ++-- src/MEArec/simulate_cells.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MEArec/generators/recordinggenerator.py b/src/MEArec/generators/recordinggenerator.py index 1d7305d..8bc5c17 100644 --- a/src/MEArec/generators/recordinggenerator.py +++ b/src/MEArec/generators/recordinggenerator.py @@ -1410,9 +1410,9 @@ def generate_recordings( # compute pad samples as 3 times the low-cutoff period if cutoff.size == 1: - pad_samples_filt = 3 * int((1.0 / cutoff * fs).magnitude) + pad_samples_filt = 3 * int((1.0 / cutoff * fs).magnitude[0]) elif cutoff.size == 2: - pad_samples_filt = 3 * int((1.0 / cutoff[0] * fs).magnitude) + pad_samples_filt = 3 * int((1.0 / cutoff[0] * fs).magnitude[0]) # call the loop on chunks args = ( diff --git a/src/MEArec/simulate_cells.py b/src/MEArec/simulate_cells.py index 0de7ddc..03f8d71 100644 --- a/src/MEArec/simulate_cells.py +++ b/src/MEArec/simulate_cells.py @@ -1107,7 +1107,7 @@ def get_rnd_rot_Arvo(): random rotation matrix """ gamma = np.random.uniform(0, 2.0 * np.pi) - rotation_z = np.matrix([[np.cos(gamma), -np.sin(gamma), 0], [np.sin(gamma), np.cos(gamma), 0], [0, 0, 1]]) + rotation_z = np.array([[np.cos(gamma), -np.sin(gamma), 0], [np.sin(gamma), np.cos(gamma), 0], [0, 0, 1]]) x = np.random.uniform(size=2) v = np.array( [np.cos(2.0 * np.pi * x[0]) * np.sqrt(x[1]), np.sin(2.0 * np.pi * x[0]) * np.sqrt(x[1]), np.sqrt(1 - x[1])] From 4225da9acb144de59ba163d3003ff81ed3a05341 Mon Sep 17 00:00:00 2001 From: Zach McKenzie <92116279+zm711@users.noreply.github.com> Date: Fri, 22 Sep 2023 08:02:38 -0400 Subject: [PATCH 2/4] 1415 is already scalar-> revert --- src/MEArec/generators/recordinggenerator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MEArec/generators/recordinggenerator.py b/src/MEArec/generators/recordinggenerator.py index 8bc5c17..ceaa5cb 100644 --- a/src/MEArec/generators/recordinggenerator.py +++ b/src/MEArec/generators/recordinggenerator.py @@ -1412,7 +1412,7 @@ def generate_recordings( if cutoff.size == 1: pad_samples_filt = 3 * int((1.0 / cutoff * fs).magnitude[0]) elif cutoff.size == 2: - pad_samples_filt = 3 * int((1.0 / cutoff[0] * fs).magnitude[0]) + pad_samples_filt = 3 * int((1.0 / cutoff[0] * fs).magnitude) # call the loop on chunks args = ( From 955db76165be09653e7796bac4fcede2886a8b16 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Fri, 22 Sep 2023 15:10:41 +0200 Subject: [PATCH 3/4] Fix deprecation in CLI in case of high-pass filter --- src/MEArec/cli.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/MEArec/cli.py b/src/MEArec/cli.py index 988c690..fa4e7bc 100644 --- a/src/MEArec/cli.py +++ b/src/MEArec/cli.py @@ -405,6 +405,9 @@ def gen_recordings(params, **kwargs): if kwargs["filt_cutoff"] is not None: if isinstance(kwargs["filt_cutoff"], tuple): kwargs["filt_cutoff"] = list(kwargs["filt_cutoff"]) + # for high-pass filter, make a scalar + if len(kwargs["filt_cutoff"]) == 1: + kwargs["filt_cutoff"] = kwargs["filt_cutoff"][0] params_dict["recordings"]["filter_cutoff"] = kwargs["filt_cutoff"] if kwargs["filt_order"] is not None: params_dict["recordings"]["filt_order"] = kwargs["filt_order"] From 2874db8456a4d25b01f1786cfe88c5e91c52c9c7 Mon Sep 17 00:00:00 2001 From: Zach McKenzie <92116279+zm711@users.noreply.github.com> Date: Fri, 22 Sep 2023 09:33:54 -0400 Subject: [PATCH 4/4] revert since cli has been updated Co-authored-by: Alessio Buccino --- src/MEArec/generators/recordinggenerator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MEArec/generators/recordinggenerator.py b/src/MEArec/generators/recordinggenerator.py index ceaa5cb..1d7305d 100644 --- a/src/MEArec/generators/recordinggenerator.py +++ b/src/MEArec/generators/recordinggenerator.py @@ -1410,7 +1410,7 @@ def generate_recordings( # compute pad samples as 3 times the low-cutoff period if cutoff.size == 1: - pad_samples_filt = 3 * int((1.0 / cutoff * fs).magnitude[0]) + pad_samples_filt = 3 * int((1.0 / cutoff * fs).magnitude) elif cutoff.size == 2: pad_samples_filt = 3 * int((1.0 / cutoff[0] * fs).magnitude)