From b5950178efcec1e0904022196ac0b3d735cc46d5 Mon Sep 17 00:00:00 2001 From: darshanmandge Date: Thu, 28 Sep 2023 14:43:40 +0200 Subject: [PATCH 1/5] add None return for peak_times --- bluepyopt/ephys/efeatures.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bluepyopt/ephys/efeatures.py b/bluepyopt/ephys/efeatures.py index ab8c4fe1..250dc88b 100644 --- a/bluepyopt/ephys/efeatures.py +++ b/bluepyopt/ephys/efeatures.py @@ -426,6 +426,12 @@ def calculate_feature( from .extra_features_utils import calculate_features """Calculate feature value""" + if peak_times is None: + if return_waveforms: + return None, None + else: + return None + peak_times = self._get_peak_times( responses, raise_warnings=raise_warnings ) @@ -439,7 +445,10 @@ def calculate_feature( if responses[self.recording_names[""]] is not None: response = responses[self.recording_names[""]] else: - return None + if return_waveforms: + return None, None + else: + return None if np.std(np.diff(response["time"])) > 0.001 * np.mean( np.diff(response["time"]) From 98e39cf42f19c5a340f00167c0fac8fc28ebbaef Mon Sep 17 00:00:00 2001 From: darshanmandge Date: Thu, 28 Sep 2023 15:00:37 +0200 Subject: [PATCH 2/5] remove whitespace --- bluepyopt/ephys/efeatures.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bluepyopt/ephys/efeatures.py b/bluepyopt/ephys/efeatures.py index 250dc88b..90a8cb30 100644 --- a/bluepyopt/ephys/efeatures.py +++ b/bluepyopt/ephys/efeatures.py @@ -431,7 +431,7 @@ def calculate_feature( return None, None else: return None - + peak_times = self._get_peak_times( responses, raise_warnings=raise_warnings ) From 57e6007715bad73be7d516263791bbebe30af1eb Mon Sep 17 00:00:00 2001 From: darshanmandge Date: Thu, 28 Sep 2023 16:36:48 +0200 Subject: [PATCH 3/5] whitespace remove 2 --- bluepyopt/ephys/efeatures.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/bluepyopt/ephys/efeatures.py b/bluepyopt/ephys/efeatures.py index 90a8cb30..0ef22a95 100644 --- a/bluepyopt/ephys/efeatures.py +++ b/bluepyopt/ephys/efeatures.py @@ -431,7 +431,6 @@ def calculate_feature( return None, None else: return None - peak_times = self._get_peak_times( responses, raise_warnings=raise_warnings ) @@ -449,7 +448,6 @@ def calculate_feature( return None, None else: return None - if np.std(np.diff(response["time"])) > 0.001 * np.mean( np.diff(response["time"]) ): From 8d16297833fefd60a7f43f2384b848821a6dfacf Mon Sep 17 00:00:00 2001 From: darshanmandge Date: Fri, 29 Sep 2023 08:46:13 +0200 Subject: [PATCH 4/5] small_update --- bluepyopt/ephys/efeatures.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bluepyopt/ephys/efeatures.py b/bluepyopt/ephys/efeatures.py index 0ef22a95..479ecb61 100644 --- a/bluepyopt/ephys/efeatures.py +++ b/bluepyopt/ephys/efeatures.py @@ -426,15 +426,15 @@ def calculate_feature( from .extra_features_utils import calculate_features """Calculate feature value""" + peak_times = self._get_peak_times( + responses, raise_warnings=raise_warnings + ) if peak_times is None: if return_waveforms: return None, None else: return None - peak_times = self._get_peak_times( - responses, raise_warnings=raise_warnings - ) - + if len(peak_times) > 1 and self.skip_first_spike: peak_times = peak_times[1:] From 12a4df9be4a345749cbcc199bfdb13eb4d4b837f Mon Sep 17 00:00:00 2001 From: darshanmandge Date: Fri, 29 Sep 2023 14:15:08 +0200 Subject: [PATCH 5/5] editspace --- bluepyopt/ephys/efeatures.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bluepyopt/ephys/efeatures.py b/bluepyopt/ephys/efeatures.py index 479ecb61..edfa56cf 100644 --- a/bluepyopt/ephys/efeatures.py +++ b/bluepyopt/ephys/efeatures.py @@ -434,7 +434,7 @@ def calculate_feature( return None, None else: return None - + if len(peak_times) > 1 and self.skip_first_spike: peak_times = peak_times[1:] @@ -448,6 +448,7 @@ def calculate_feature( return None, None else: return None + if np.std(np.diff(response["time"])) > 0.001 * np.mean( np.diff(response["time"]) ):