NeuroKit: ecg_process() function ValueError: NeuroKit error: we expect the user to provide a vector, i.e., a one-dimensional array (such as a list of values). Current input of shape: ()

Hi, In the python 3.7 - 32 bits environment i have run the following sample code given for ecg_process function.

>>> import neurokit2 as nk
>>>
>>> ecg = nk.ecg_simulate(duration=15, sampling_rate=1000, heart_rate=80)
>>> signals, info = nk.ecg_process(ecg, sampling_rate=1000)

When i run the nk.ecg_process() statement (signals, info = nk.ecg_process(ecg, sampling_rate=1000)) i received the following error.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\charl\anaconda3\envs\py37_32\lib\site-packages\neurokit2\ecg\ecg_process.py", line 106, in ecg_process
    ecg_cleaned=ecg_cleaned, rpeaks=rpeaks, sampling_rate=sampling_rate
  File "C:\Users\charl\anaconda3\envs\py37_32\lib\site-packages\neurokit2\ecg\ecg_delineate.py", line 119, in ecg_delineate
    waves = _ecg_delineator_peak(ecg_cleaned, rpeaks=rpeaks, sampling_rate=sampling_rate)
  File "C:\Users\charl\anaconda3\envs\py37_32\lib\site-packages\neurokit2\ecg\ecg_delineate.py", line 683, in _ecg_delineator_peak
    Q_index, Q = _ecg_delineator_peak_Q(rpeak, heartbeat, R)
  File "C:\Users\charl\anaconda3\envs\py37_32\lib\site-packages\neurokit2\ecg\ecg_delineate.py", line 720, in _ecg_delineator_peak_Q
    Q = signal_findpeaks(-1 * segment["Signal"], height_min=0.05 * (segment["Signal"].max() - segment["Signal"].min()))
  File "C:\Users\charl\anaconda3\envs\py37_32\lib\site-packages\neurokit2\signal\signal_findpeaks.py", line 120, in signal_findpeaks
    info["Onsets"] = _signal_findpeaks_findbase(info["Peaks"], signal, what="onset")
  File "C:\Users\charl\anaconda3\envs\py37_32\lib\site-packages\neurokit2\signal\signal_findpeaks.py", line 191, in _signal_findpeaks_findbase
    bases = as_vector(bases)
  File "C:\Users\charl\anaconda3\envs\py37_32\lib\site-packages\neurokit2\misc\type_converters.py", line 44, in as_vector
    "list of values). Current input of shape: " + str(shape)
ValueError: NeuroKit error: we expect the user to provide a vector, i.e., a one-dimensional array (such as a list of values). Current input of shape: ()

when i run in 64 bit python environment this statement is working fine. Why it is giving error in 32_bit environment ecg_process_function_error

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (8 by maintainers)

Most upvoted comments

@solomonmanuelraj, thanks for the detailled instructions. I was able to replicate your issue and fixed it. Once version 0.0.39 is on PyPI you can update and ecg_process() should (hopefully) no longer break in your 32 bit environment.