From 2f5fbc408bedccc47c9f8e2ff39380bb4b098de5 Mon Sep 17 00:00:00 2001 From: arnaudon Date: Tue, 6 Feb 2024 10:43:19 +0100 Subject: [PATCH] bypass warning by default --- efel/pyfeatures/pyfeatures.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/efel/pyfeatures/pyfeatures.py b/efel/pyfeatures/pyfeatures.py index b4c4e671..31e7fd3e 100644 --- a/efel/pyfeatures/pyfeatures.py +++ b/efel/pyfeatures/pyfeatures.py @@ -141,7 +141,7 @@ def strict_burst_number() -> np.ndarray: return np.array([burst_mean_freq.size]) -def all_burst_number(): +def all_burst_number(raise_warnings: bool = False) -> np.ndarray: """The number of all the bursts, even if they have a single AP. Instead of relying on burst_mean_freq, we split the ISIs into two groups, @@ -170,11 +170,12 @@ def all_burst_number(): # here we check is the gap between the two group of ISIs is big enough # to be considered a burst behaviour, the 1.2 and 0.8 are fairly arbitrary if len(isis[(isis < 1.2 * thresh) & (isis > 0.8 * thresh)]) > 0: - warnings.warn( - """While calculating all_burst_number, - there are spike around the threshold, we return 0 bursts""", - RuntimeWarning - ) + if raise_warnings: + warnings.warn( + """While calculating all_burst_number, + there are spike around the threshold, we return 0 bursts""", + RuntimeWarning + ) return np.array([0]) return np.array([len(isis[isis > thresh])])