Skip to content

ufunc 'isnan' not supported for the input types (bio_eventrelated.ipnb) #113

@wildan-mahmud

Description

@wildan-mahmud

Dear neuro-kit experts,

I really happy that there is a python package for psychophysiological data!

I am trying to run the tutorial (https://neuropsychology.github.io/NeuroKit/examples/bio_eventrelated/bio_eventrelated.html) :

# Process the signal

data_clean, info = nk.bio_process(ecg=data['ECG'],
rsp=data['RSP'],
eda=['EDA'],
keep=data['Photosensor'],
sampling_rate=100)

but encountered this error :
ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

and this is tracebak from jetbrains dataspell :
TypeError Traceback (most recent call last)
Cell In[10], line 2
1 # Process the signal
----> 2 data_clean, info = nk.bio_process(ecg=data['ECG'],
3 rsp=data['RSP'],
4 eda=['EDA'],
5 keep=data['Photosensor'],
6 sampling_rate=100)

File D:\Lab-Neurokit2\venv\lib\site-packages\neurokit2\bio\bio_process.py:187, in bio_process(ecg, rsp, eda, emg, ppg, eog, keep, sampling_rate)
185 if eda is not None:
186 eda = as_vector(eda)
--> 187 eda_signals, eda_info = eda_process(eda, sampling_rate=sampling_rate)
188 bio_info.update(eda_info)
189 bio_df = pd.concat([bio_df, eda_signals], axis=1)

File D:\Lab-Neurokit2\venv\lib\site-packages\neurokit2\eda\eda_process.py:86, in eda_process(eda_signal, sampling_rate, method, report, **kwargs)
82 methods = eda_methods(sampling_rate=sampling_rate, method=method, **kwargs)
84 # Preprocess
85 # Clean signal
---> 86 eda_cleaned = eda_clean(
87 eda_signal,
88 sampling_rate=sampling_rate,
89 method=methods["method_cleaning"],
90 **methods["kwargs_cleaning"],
91 )
92 if methods["method_phasic"] is None or methods["method_phasic"].lower() == "none":
93 eda_decomposed = pd.DataFrame({"EDA_Phasic": eda_cleaned})

File D:\Lab-Neurokit2\venv\lib\site-packages\neurokit2\eda\eda_clean.py:67, in eda_clean(eda_signal, sampling_rate, method)
64 eda_signal = as_vector(eda_signal)
66 # Missing data
---> 67 n_missing = np.sum(np.isnan(eda_signal))
68 if n_missing > 0:
69 warn(
70 "There are " + str(n_missing) + " missing data points in your signal."
71 " Filling missing values by using the forward filling method.",
72 category=NeuroKitWarning,
73 )

Here is information about my settings:
OS: Win 11

Packages:
Python 3.10.0
Neurokit 0.2.10
pandas 2.2.3
Numpy 2.1.2
seaborn 0.13.2
sklearn 1.5.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions