From 33dbd9db48464555ae92215dbf08094f2c98df8a Mon Sep 17 00:00:00 2001 From: Nabil Alibou <63203348+nabilalibou@users.noreply.github.com> Date: Tue, 13 Feb 2024 22:28:47 +0100 Subject: [PATCH] Replace Error raised by less than 5 minutes of data by a Warning (#160) --- yasa/staging.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/yasa/staging.py b/yasa/staging.py index aeca3be..6a0b0b0 100644 --- a/yasa/staging.py +++ b/yasa/staging.py @@ -201,7 +201,12 @@ def __init__(self, raw, eeg_name, *, eog_name=None, emg_name=None, metadata=None # Extract duration of recording in minutes duration_minutes = data.shape[1] / sf / 60 - assert duration_minutes >= 5, "At least 5 minutes of data is required." + if duration_minutes < 5: + msg = ( + "Insufficient data. A minimum of 5 minutes of data is recommended " + "otherwise results may be unreliable." + ) + logger.warning(msg) # Add to self self.sf = sf