diff --git a/pysiology/__init__.py b/pysiology/__init__.py index fb75f18..2347f54 100755 --- a/pysiology/__init__.py +++ b/pysiology/__init__.py @@ -3,7 +3,7 @@ from . import electrodermalactivity from . import sampledata -__version__ = '0.0.9.4' #Version Control +__version__ = '0.0.9.5' #Version Control print("Thank you for using Pysiology. If you use it in your work, please cite:") print("Gabrieli G., Azhari A., Esposito G. (2020) PySiology: A Python Package for Physiological Feature Extraction. In: Esposito A., Faundez-Zanuy M., Morabito F., Pasero E. (eds) Neural Approaches to Dynamics of Signal Exchanges. Smart Innovation, Systems and Technologies, vol 151. Springer, Singapore") diff --git a/pysiology/electrocardiography.py b/pysiology/electrocardiography.py index 2b5d0c2..68a1cea 100755 --- a/pysiology/electrocardiography.py +++ b/pysiology/electrocardiography.py @@ -146,9 +146,12 @@ def getPNN50(peaks,samplerate): for i in range(1,len(delta)): differences.append(delta[i] - delta[i-1]) - NN50 = [x for x in differences if x > 50] - pNN50 = float(len(NN50)) / float(len(differences)) - return(pNN50) + if(len(differences)!=0): + NN50 = [x for x in differences if x > 50] + pNN50 = float(len(NN50)) / float(len(differences)) + return(pNN50) + else: + return(np.nan) def getPNN20(peaks,samplerate): """ This functions evaluate pNN20, the proportion of differences greater than 20ms. @@ -171,10 +174,13 @@ def getPNN20(peaks,samplerate): differences = [] for i in range(1,len(delta)): differences.append(delta[i] - delta[i-1]) - - NN20 = [x for x in differences if x > 20] - pNN20 = float(len(NN20)) / float(len(differences)) - return(pNN20) + + if(len(differences)!=0): + NN20 = [x for x in differences if x > 20] + pNN20 = float(len(NN20)) / float(len(differences)) + return(pNN20) + else: + return(np.nan) def getPSD(rawECGSignal, samplerate): frequencies, psd = scipy.signal.periodogram(rawECGSignal, fs=samplerate, scaling="spectrum") diff --git a/setup.py b/setup.py index 7503ef9..9a60fbe 100755 --- a/setup.py +++ b/setup.py @@ -2,11 +2,11 @@ import os setup(name='pysiology', - version='0.0.9.4', + version='0.0.9.5', description='Physiological signal processing in Python', long_description="A simple python package for physiological signal processing (ECG,EMG,GSR). Tutorial and documentation can be found on the Github Repository or at pysiology.rtfd.io. If you use this package in your work, please cite: Gabrieli G., Azhari A., Esposito G. (2020) PySiology: A Python Package for Physiological Feature Extraction. In: Esposito A., Faundez-Zanuy M., Morabito F., Pasero E. (eds) Neural Approaches to Dynamics of Signal Exchanges. Smart Innovation, Systems and Technologies, vol 151. Springer, Singapore", url='https://github.com/Gabrock94/Pysiology', - download_url='https://github.com/Gabrock94/Pysiology/archive/0.0.7.tar.gz', + download_url='https://github.com/Gabrock94/Pysiology/archive/0.9.5.tar.gz', author='Giulio Gabrieli', author_email='gack94@gmail.com', license='GPL-3.0',