From 5f0771b8fed70c4bc0fee344a4a9a1b177417284 Mon Sep 17 00:00:00 2001 From: Jonah Pearl Date: Thu, 7 Nov 2024 13:08:32 -0500 Subject: [PATCH] import scipy inside func --- src/spikeinterface/exporters/to_ibl.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/spikeinterface/exporters/to_ibl.py b/src/spikeinterface/exporters/to_ibl.py index 3515bfe0cf..2c4aec4cd2 100644 --- a/src/spikeinterface/exporters/to_ibl.py +++ b/src/spikeinterface/exporters/to_ibl.py @@ -7,7 +7,6 @@ import numpy as np import numpy.typing as npt -from scipy.signal import welch from tqdm.auto import tqdm from spikeinterface.core import ChannelSparsity, SortingAnalyzer @@ -82,6 +81,11 @@ def export_to_ibl( """ + try: + from scipy.signal import welch + except ImportError as e: + raise ImportError("Please install scipy to use the export_to_ibl function.") from e + # Output folder checks if isinstance(output_folder, str): output_folder = Path(output_folder)