Skip to content

Commit 1aa482c

Browse files
author
Chen Xie
committed
doc
1 parent 651039b commit 1aa482c

File tree

5 files changed

+23
-39
lines changed

5 files changed

+23
-39
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<ul>
1313
<li>15 July 2016 - <code>rdsamp</code> (for reading WFDB signals) is ready for beta usage.</li>
1414
<li>27 July 2016 - <code>rdann</code> (for reading WFDB annotations) is ready for beta usage.</li>
15-
<li>27 July 2016 - <code>plotsigs</code> is able to plot signals and annotations output by <em>rdsamp</em> and <em>rdann</em></li>
15+
<li>27 July 2016 - <code>plotwfdb</code> is able to plot signals and annotations output by <em>rdsamp</em> and <em>rdann</em></li>
1616
</ul>
1717

1818

@@ -87,14 +87,13 @@ Output arguments:
8787

8888
### Plotting Data
8989

90-
<strong>plotsigs</strong> - Subplot and label each channel of an nxm signal on a graph. Also subplot annotation locations on selected channels if present.
90+
<strong>plotwfdb</strong> - Subplot and label each channel of an nxm signal on a graph. Also subplot annotation locations on selected channels if present.
9191

9292
```
9393
import wfdb
94-
from wfdb import plotwfdb
9594
sig, fields = wfdb.rdsamp(recordname)
9695
annsamp=wfdb.rdann('recordname', 'annot')[0]
97-
plotwfdb.plotsigs(sig, fields, annsamp, annch, title, plottime):
96+
wfdb.plotwfdb(sig, fields, annsamp, annch, title, plottime):
9897
9998
```
10099

sampledata/README.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

wfdb/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
from ._rdsamp import rdsamp
2-
from ._rdann import rdann
2+
from ._rdann import rdann
3+
from ._plotwfdb import plotwfdb

wfdb/plotwfdb.py renamed to wfdb/_plotwfdb.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import matplotlib.pyplot as plt
33

44

5-
def plotsigs(sig, fields, annsamp=[], annch=[0], title=[], plottime=1):
5+
def plotwfdb(sig, fields, annsamp=[], annch=[0], title=[], plottime=1):
66
""" Subplot and label each channel of a WFDB signal. Also subplot annotation locations on selected channels if present.
77
88
Usage: plotsigs(sig, fields, annsamp=[], annch=[0], title=[], plottime=1):
@@ -58,4 +58,6 @@ def plotsigs(sig, fields, annsamp=[], annch=[0], title=[], plottime=1):
5858
plt.ylabel(chanlabel+"/"+unitlabel)
5959

6060
plt.show(f1)
61-
61+
62+
if __name__ == '__main__':
63+
plotwfdb(sys.argv)

wfdbdemo.ipynb

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
},
1616
"outputs": [],
1717
"source": [
18-
"import numpy as np\n",
19-
"from wfdb import readsignal\n",
20-
"from wfdb import readannot\n",
21-
"from wfdb import plotwfdb\n",
18+
"import wfdb\n",
2219
"%matplotlib inline"
2320
]
2421
},
@@ -32,8 +29,8 @@
3229
"source": [
3330
"# Demo 1 - Read the wfdb file, plot the last part of the signals, and print the metadata\n",
3431
"\n",
35-
"sig, fields=readsignal.rdsamp('sampledata/a103l') \n",
36-
"plotwfdb.plotsigs(sig[80000:,:], fields, title='Record a103l from Physionet Challenge 2015') \n",
32+
"sig, fields=wfdb.rdsamp('sampledata/a103l') \n",
33+
"wfdb.plotwfdb(sig[80000:,:], fields, title='Record a103l from Physionet Challenge 2015') \n",
3734
"fields"
3835
]
3936
},
@@ -47,8 +44,8 @@
4744
"source": [
4845
"# Demo 2 - Read certain channels and sections of the WFDB file and plot them. \n",
4946
"\n",
50-
"sig, fields=readsignal.rdsamp('sampledata/s0010_re', channels=[14, 0, 5, 10, 11], sampfrom=100, sampto=15000)\n",
51-
"plotwfdb.plotsigs(sig, fields)"
47+
"sig, fields=wfdb.rdsamp('sampledata/s0010_re', channels=[14, 0, 5, 10, 11], sampfrom=100, sampto=15000)\n",
48+
"wfdb.plotwfdb(sig, fields)"
5249
]
5350
},
5451
{
@@ -61,9 +58,9 @@
6158
"source": [
6259
"# Demo 3 - Read the WFDB signal and annotation file and plot them together.\n",
6360
"\n",
64-
"sig, fields=readsignal.rdsamp('sampledata/100')\n",
65-
"annsamp=readannot.rdann('sampledata/100', 'atr')[0]\n",
66-
"plotwfdb.plotsigs(sig, fields, annsamp=annsamp, annch=[0], title='Record 100 from MIT-BIH Arrhythmia Database')"
61+
"sig, fields=wfdb.rdsamp('sampledata/100')\n",
62+
"annsamp=wfdb.rdann('sampledata/100', 'atr')[0]\n",
63+
"wfdb.plotwfdb(sig, fields, annsamp=annsamp, annch=[0], title='Record 100 from MIT-BIH Arrhythmia Database')"
6764
]
6865
},
6966
{
@@ -74,7 +71,7 @@
7471
"\n",
7572
"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",
7673
"\n",
77-
"Note that in these kinds of records there are segments in which certain channels are missing. <strong>matplotlib</strong> automatically zooms in on sections without Nans in individual channels but the entire durations of the signals input into <strong>plotsigs</strong> are actually plotted. \n",
74+
"Note that these kinds of records contain segments in which certain channels are missing. <strong>matplotlib</strong> automatically zooms in on sections without Nans in individual channels but the entire durations of the signals input into <strong>plotwfdb</strong> are actually plotted. \n",
7875
"\n"
7976
]
8077
},
@@ -87,8 +84,8 @@
8784
"outputs": [],
8885
"source": [
8986
"# Demo 4 - Read the multi-segment signal and plot waveforms from the MIMIC matched waveform database. \n",
90-
"sig, fields=readsignal.rdsamp('sampledata/matched/s25047/s25047-2704-05-04-10-44')\n",
91-
"plotwfdb.plotsigs(sig, fields, title='s25047/s25047-2704-05-04-10-44') \n",
87+
"sig, fields=wfdb.rdsamp('sampledata/matched/s25047/s25047-2704-05-04-10-44')\n",
88+
"wfdb.plotwfdb(sig, fields, title='s25047/s25047-2704-05-04-10-44') \n",
9289
"fields"
9390
]
9491
},
@@ -101,9 +98,9 @@
10198
"outputs": [],
10299
"source": [
103100
"# Demo 5 - Read the multi-segment signal and plot waveforms from the MIMIC matched waveform database. \n",
104-
"sig, fields=readsignal.rdsamp('sampledata/matched/s00001/s00001-2896-10-10-00-31')\n",
101+
"sig, fields=wfdb.rdsamp('sampledata/matched/s00001/s00001-2896-10-10-00-31')\n",
105102
"# Note, very long record to plot. \n",
106-
"plotwfdb.plotsigs(sig[240000:, :], fields, title='s00001/s00001-2896-10-10-00-31') \n",
103+
"wfdb.plotwfdb(sig[240000:, :], fields, title='s00001/s00001-2896-10-10-00-31') \n",
107104
"fields"
108105
]
109106
},
@@ -133,7 +130,7 @@
133130
"name": "python",
134131
"nbconvert_exporter": "python",
135132
"pygments_lexer": "ipython3",
136-
"version": "3.5.1"
133+
"version": "3.5.2"
137134
}
138135
},
139136
"nbformat": 4,

0 commit comments

Comments
 (0)