From 859e952c6a2d0e80d2c146d5914571111d741895 Mon Sep 17 00:00:00 2001 From: Chen Xie Date: Wed, 7 Sep 2016 13:49:10 -0400 Subject: [PATCH] pip installable through pypi --- MANIFEST.in | 3 ++ devtests.ipynb | 85 +++++++++++++++++++++++++++++-------------------- setup.py | 4 +-- wfdb/_rdsamp.py | 2 +- 4 files changed, 56 insertions(+), 38 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index fea17f2d..3759a060 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,9 @@ # Include the license file include LICENSE +# Include readme file +include README.md + # Include the data files # recursive-include data * diff --git a/devtests.ipynb b/devtests.ipynb index 28ea6623..5e33f0ce 100644 --- a/devtests.ipynb +++ b/devtests.ipynb @@ -959,7 +959,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 4, "metadata": { "collapsed": false }, @@ -968,44 +968,59 @@ "name": "stdout", "output_type": "stream", "text": [ - "Help on function rdann in module wfdb._rdann:\n", - "\n", - "rdann(recordname, annot, sampfrom=0, sampto=[], anndisp=1)\n", - " Read a WFDB annotation file recordname.annot and return the fields as lists or arrays\n", - " \n", - " Usage: annsamp, anntype, num, subtype, chan, aux, annfs = rdann(recordname, annot, \n", - " sampfrom=0, sampto=[], \n", - " anndisp=1)\n", - " \n", - " Input arguments:\n", - " - recordname (required): The record name of the WFDB annotation file. ie. for \n", - " file '100.atr', recordname='100'\n", - " - annot (required): The annotator extension of the annotation file. ie. for \n", - " file '100.atr', annot='atr'\n", - " - sampfrom (default=0): The minimum sample number for annotations to be returned.\n", - " - sampto (default=the final annotation sample): The maximum sample number for \n", - " annotations to be returned.\n", - " - anndisp (default = 1): The annotation display flag that controls the data type \n", - " of the 'anntype' output parameter. 'anntype' will either be an integer key(0), \n", - " a shorthand display symbol(1), or a longer annotation code.\n", - " \n", - " Output arguments:\n", - " - annsamp: The annotation location in samples relative to the beginning of the record.\n", - " - anntype: The annotation type according the the standard WFDB keys.\n", - " - subtype: The marked class/category of the annotation.\n", - " - chan: The signal channel associated with the annotations.\n", - " - num: The marked annotation number. This is not equal to the index of the current annotation.\n", - " - aux: The auxiliary information string for the annotation.\n", - " - annfs: The sampling frequency written in the beginning of the annotation file if present.\n", - " \n", - " *NOTE: Every annotation contains the 'annsamp' and 'anntype' field. All \n", - " other fields default to 0 or empty if not present.\n", - "\n" + "\n", + "Downloading missing file(s) into directory: /home/cx1111/PhysionetProjects/wfdb-python\n", + "Downloaded all missing files for record.\n" ] + }, + { + "data": { + "text/plain": [ + "(array([[ 1.00000000e-01, -3.05110000e+02, -2.87190000e+02,\n", + " -2.66720000e+02],\n", + " [ -2.87190000e+02, -2.71830000e+02, -2.87190000e+02,\n", + " 1.10000000e-01],\n", + " [ -2.99990000e+02, -2.87190000e+02, -2.64160000e+02,\n", + " -2.87190000e+02],\n", + " ..., \n", + " [ -2.79520000e+02, -2.87190000e+02, -2.66710000e+02,\n", + " -2.87190000e+02],\n", + " [ 1.20000000e-01, -2.00160000e+02, -2.87190000e+02,\n", + " -2.79520000e+02],\n", + " [ -2.87190000e+02, -2.84640000e+02, -2.87190000e+02,\n", + " 1.20000000e-01]]),\n", + " {'basedate': '',\n", + " 'baseline': [0, 0, 0, 0],\n", + " 'basetime': '',\n", + " 'byteoffset': [0, 0, 0, 0],\n", + " 'comments': [' : 25 : M : (none) : (none)'],\n", + " 'filename': ['test01_00s.dat',\n", + " 'test01_00s.dat',\n", + " 'test01_00s.dat',\n", + " 'test01_00s.dat'],\n", + " 'fmt': ['16', '16', '16', '16'],\n", + " 'fs': 500.0,\n", + " 'gain': [100.0, 100.0, 100.0, 100.0],\n", + " 'initvalue': [10, -8, -57, -66],\n", + " 'nsamp': 4000,\n", + " 'nsampseg': [],\n", + " 'nseg': 1,\n", + " 'nsig': 4,\n", + " 'sampsperframe': [1, 1, 1, 1],\n", + " 'signame': ['ECG', 'ECG', 'ECG', 'ECG'],\n", + " 'skew': [0, 0, 0, 0],\n", + " 'units': ['mV', 'mV', 'mV', 'mV']})" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "help(wfdb.rdann)" + "import wfdb\n", + "\n", + "wfdb.rdsamp('macecgdb/test01_00s', pbdl=1)\n" ] }, { diff --git a/setup.py b/setup.py index 7114ca9a..5f1ef002 100644 --- a/setup.py +++ b/setup.py @@ -17,10 +17,10 @@ setup( name='wfdb', - # Versions should comply with PEP440. For a discussion on single-sourcing + # Versions should comply with PEP440. For a discussion on single-sourcing # the version across setup.py and the project code, see # https://packaging.python.org/en/latest/single_source_version.html - version='0.1.0', + version='0.1.1', description='The WFDB Python Toolbox', long_description=long_description, diff --git a/wfdb/_rdsamp.py b/wfdb/_rdsamp.py index 9877df8b..81d37a25 100644 --- a/wfdb/_rdsamp.py +++ b/wfdb/_rdsamp.py @@ -1022,7 +1022,7 @@ def rdsamp( Example: sig, fields = wfdb.rdsamp('macecgdb/test01_00s', sampfrom=800, pbdl=1, dldir='/home/username/Downloads/wfdb') """ - + if sampfrom < 0: sys.exit("sampfrom must be non-negative") if channels and min(channels) < 0: