PIA-Group / BioSPPy

Biosignal Processing in Python
Other
573 stars 274 forks source link

ValueError was happend in respiration methods. #12

Closed YutaForLab closed 7 years ago

YutaForLab commented 7 years ago

I'm trying to run resp() method in Python 2.7.11 with measured respiration data. But I got an error "v cannot be empty" at convolve method in smoother method line 548 in tools.py. I also checked my data with ecg.ecg method. Then program ran correctly. Do you have any idea to solve this problem? Python, numpy, scipy version, or any.

capcarr commented 7 years ago

Hi, could you please specify the version of biosppy that you are using (biosppy.__version__)? Also, could you provide access to the resp signal that causes the error?

YutaForLab commented 7 years ago

The version is 0.2.2, and the path of resp signal is as follow: https://app.box.com/s/e3xaxtpn64bksq3rlik2azl0upm0r16t thank you for your quick reply.

capcarr commented 7 years ago

What's the sampling rate of the signal?

YutaForLab commented 7 years ago

1kHz it is.

capcarr commented 7 years ago

Hi @YutaForLab The function biosppy.signals.resp.resp seems to be working with the signal you provided. Could you please send the complete stack trace, and the versions of numpy and scipy that you have installed?

YutaForLab commented 7 years ago

Sorry for late to replying. numpy version is 1.11.1 and scipy version is 0.18.0rc2. And traceback is as below:

Traceback (most recent call last): File "ecgProcessing.py", line 30, in [ts, filtered, zeros, resp_rate_ts, resp_rate] = resp.resp(signal=signal, sa mpling_rate=1000, show=False) File "C:\Python27\lib\site-packages\biosppy\signals\resp.py", line 88, in resp

mirror=True)

File "C:\Python27\lib\site-packages\biosppy\signals\tools.py", line 539, in sm oother smoothed = np.convolve(w, aux, mode='same') File "C:\Python27\lib\site-packages\numpy\core\numeric.py", line 1011, in conv olve raise ValueError('v cannot be empty') ValueError: v cannot be empty

thanks a lot.

capcarr commented 7 years ago

Hi @YutaForLab This bug does not happen with the latest version in the GitHub repo (as of commit cae32b06e019dfb0284fddc6544ab62aabbca23d). The code in PyPI does not yet have these updates. I would recommend reinstalling with the GitHub version.