Skip to content

Commit d87355d

Browse files
committed
fix wfdb multi-segment reading and added new unit tests
1 parent a982a50 commit d87355d

File tree

96 files changed

+300130
-54
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+300130
-54
lines changed

README.rst

Lines changed: 1 addition & 1 deletion

demo.ipynb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
"cell_type": "markdown",
121121
"metadata": {},
122122
"source": [
123-
"### Matched waveform examples\n",
123+
"### Multisegment waveform examples\n",
124124
"\n",
125125
"The following sections load and plots waveforms from the MIMIC matched waveform database. These waveforms have been matched to clinical data in the MIMIC Clinical database. The input records are multi-segment (made up of multiple individual WFDB records) and relatively long.\n",
126126
"\n",
@@ -137,7 +137,9 @@
137137
"outputs": [],
138138
"source": [
139139
"# Demo 6 - Read the multi-segment record and plot waveforms from the MIMIC matched waveform database. \n",
140-
"record=wfdb.rdsamp('sampledata/matched/s25047/s25047-2704-05-04-10-44')\n",
140+
"import wfdb\n",
141+
"from IPython.display import display\n",
142+
"record=wfdb.rdsamp('sampledata/multisegment/s25047/s25047-2704-05-04-10-44')\n",
141143
"wfdb.plotrec(record, title='Record s25047-2704-05-04-10-44') \n",
142144
"display(record.__dict__)\n",
143145
"\n",
@@ -155,7 +157,7 @@
155157
"source": [
156158
"# Demo 7 - Read the multi-segment record and plot waveforms from the MIMIC matched waveform database.\n",
157159
"# Notice that some channels have no valid values to plot\n",
158-
"record = wfdb.rdsamp('sampledata/matched/s00001/s00001-2896-10-10-00-31', sampfrom = 3000000, sampto = 4000000)\n",
160+
"record = wfdb.rdsamp('sampledata/multisegment/s00001/s00001-2896-10-10-00-31', sampfrom = 3000000, sampto = 4000000)\n",
159161
"wfdb.plotrec(record, title='Record s00001/s00001-2896-10-10-00-31') \n",
160162
"display(record.__dict__)\n",
161163
"\n",
File renamed without changes.

devtests.ipynb

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
{
1313
"cell_type": "code",
14-
"execution_count": 1,
14+
"execution_count": 2,
1515
"metadata": {
1616
"collapsed": false
1717
},
@@ -20,22 +20,6 @@
2020
"import wfdb"
2121
]
2222
},
23-
{
24-
"cell_type": "code",
25-
"execution_count": 3,
26-
"metadata": {
27-
"collapsed": false,
28-
"scrolled": true
29-
},
30-
"outputs": [],
31-
"source": [
32-
"import wfdb\n",
33-
"# Read part of a record from Physiobank\n",
34-
"sig, fields = wfdb.srdsamp('a103l', sampfrom = 50000, channels = [0,1], pbdir = 'challenge/2015/training')\n",
35-
"# Write a local WFDB record (manually inserting fields)\n",
36-
"wfdb.wrsamp('ecgrecord', fs = 250, units = ['mV', 'mV'], signames = ['I', 'II'], p_signals = sig, fmt = ['16', '16'])"
37-
]
38-
},
3923
{
4024
"cell_type": "code",
4125
"execution_count": null,
439 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
v102s/3 4 250 225000
2+
v102s_1 75000
3+
v102s_2 75000
4+
v102s_3 75000
5+
# This is a fixed layout multi-segment record made by piecing together the same record from the 2015 challenge
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
v102s_1 4 250 75000
2+
v102s.dat 212 2281/mV 0 0 -26 -9286 0 II
3+
v102s.dat 212 1856/mV 0 0 340 2647 0 V
4+
v102s.dat 212 1250/NU 0 0 -46 -11021 0 PLETH
5+
v102s.dat 212 38880/NU 0 0 339 12236 0 RESP
6+
#Ventricular_Tachycardia
7+
#False alarm
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
v102s_2 4 250 75000
2+
v102s.dat 212 2281/mV 0 0 -26 -9286 0 II
3+
v102s.dat 212 1856/mV 0 0 340 2647 0 V
4+
v102s.dat 212 1250/NU 0 0 -46 -11021 0 PLETH
5+
v102s.dat 212 38880/NU 0 0 339 12236 0 RESP
6+
#Ventricular_Tachycardia
7+
#False alarm
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
v102s_3 4 250 75000
2+
v102s.dat 212 2281/mV 0 0 -26 -9286 0 II
3+
v102s.dat 212 1856/mV 0 0 340 2647 0 V
4+
v102s.dat 212 1250/NU 0 0 -46 -11021 0 PLETH
5+
v102s.dat 212 38880/NU 0 0 339 12236 0 RESP
6+
#Ventricular_Tachycardia
7+
#False alarm

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# Versions should comply with PEP440. For a discussion on single-sourcing
2121
# the version across setup.py and the project code, see
2222
# https://packaging.python.org/en/latest/single_source_version.html
23-
version='1.0.0',
23+
version='1.0.1',
2424

2525
description='The WFDB Python Toolbox',
2626
long_description=long_description,

tests/targetoutputdata/target15

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
0.00000000 0.05454545 - -72.00000000
2+
0.01204819 0.07272727 - -72.00000000
3+
0.00000000 0.05454545 - -72.00000000
4+
0.01204819 0.07272727 - -72.00000000
5+
0.02409639 0.05454545 - -24.00000000
6+
0.02409639 0.07272727 - -24.00000000
7+
0.01204819 0.05454545 - -24.00000000
8+
0.02409639 0.07272727 - -24.00000000
9+
0.01204819 0.05454545 - -72.00000000
10+
0.01204819 0.07272727 - -72.00000000

tests/targetoutputdata/target16

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
0.00000000 0.05454545 - -
2+
0.00000000 0.05454545 - -72.00000000
3+
0.01204819 0.07272727 - -72.00000000
4+
0.00000000 0.05454545 - -72.00000000
5+
0.01204819 0.07272727 - -72.00000000
6+
0.02409639 0.05454545 - -24.00000000
7+
0.02409639 0.07272727 - -24.00000000
8+
0.01204819 0.05454545 - -24.00000000
9+
0.02409639 0.07272727 - -24.00000000
10+
0.01204819 0.05454545 - -72.00000000
11+
0.01204819 0.07272727 - -72.00000000

0 commit comments

Comments
 (0)