Skip to content

Commit a618e15

Browse files
committed
doc
1 parent e9285f3 commit a618e15

File tree

1 file changed

+50
-25
lines changed

1 file changed

+50
-25
lines changed

README.rst

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Objects
3333
As of version 1.0.0, wfdb records are stored in **Record** or **MultiRecord** objects, and annotations are stored in **Annotation** objects. To see all attributes of an object, call `object.__dict__`
3434

3535

36-
**record** - The class representing WFDB headers, and single segment WFDB records.
36+
**Record** - The class representing WFDB headers, and single segment WFDB records.
3737

3838
Record objects can be created using the constructor, by reading a WFDB header
3939
with 'rdheader', or a WFDB record (header and associated dat files) with rdsamp'
@@ -48,20 +48,21 @@ signals of WFDB records with at least one channel.
4848
Contructor function:
4949
::
5050

51-
def __init__(self, p_signals=None, d_signals=None,
52-
recordname=None, nsig=None,
53-
fs=None, counterfreq=None, basecounter=None,
54-
siglen=None, basetime=None, basedate=None,
55-
filename=None, fmt=None, sampsperframe=None,
56-
skew=None, byteoffset=None, adcgain=None,
57-
baseline=None, units=None, adcres=None,
58-
adczero=None, initvalue=None, checksum=None,
59-
blocksize=None, signame=None, comments=None)
51+
def __init__(self, p_signals=None, d_signals=None,
52+
recordname=None, nsig=None,
53+
fs=None, counterfreq=None, basecounter=None,
54+
siglen=None, basetime=None, basedate=None,
55+
filename=None, fmt=None, sampsperframe=None,
56+
skew=None, byteoffset=None, adcgain=None,
57+
baseline=None, units=None, adcres=None,
58+
adczero=None, initvalue=None, checksum=None,
59+
blocksize=None, signame=None, comments=None)
6060

6161
Example Usage:
6262
::
63-
import wfdb
64-
record1 = wfdb.Record(recordname='r1', fs=250, nsig=2, siglen=1000, filename=['r1.dat','r1.dat'])
63+
64+
import wfdb
65+
record1 = wfdb.Record(recordname='r1', fs=250, nsig=2, siglen=1000, filename=['r1.dat','r1.dat'])
6566

6667

6768
**MultiRecord** - The class representing multi-segment WFDB records.
@@ -81,6 +82,7 @@ of the record as a Record object. The resulting Record object will have its 'p_s
8182

8283
Contructor function:
8384
::
85+
8486
def __init__(self, segments = None, layout = None,
8587
recordname=None, nsig=None, fs=None,
8688
counterfreq=None, basecounter=None,
@@ -89,6 +91,7 @@ Contructor function:
8991

9092
Example Usage:
9193
::
94+
9295
import wfdb
9396
recordM = wfdb.MultiRecord(recordname='rm', fs=50, nsig=8, siglen=9999, segname=['rm_1', '~', rm_2'], seglen=[800, 200, 900])
9497

@@ -103,23 +106,25 @@ file with 'rdann'.
103106

104107
The attributes of the Annotation object give information about the annotation as specified
105108
by https://www.physionet.org/physiotools/wag/annot-5.htm:
106-
- annsamp: The annotation location in samples relative to the beginning of the record.
107-
- anntype: The annotation type according the the standard WFDB codes.
108-
- subtype: The marked class/category of the annotation.
109-
- chan: The signal channel associated with the annotations.
110-
- num: The labelled annotation number.
111-
- aux: The auxiliary information string for the annotation.
112-
- fs: The sampling frequency of the record if contained in the annotation file.
113-
114-
Constructor function:
109+
- ``annsamp``: The annotation location in samples relative to the beginning of the record.
110+
- ``anntype``: The annotation type according the the standard WFDB codes.
111+
- ``subtype``: The marked class/category of the annotation.
112+
- ``chan``: The signal channel associated with the annotations.
113+
- ``num``: The labelled annotation number.
114+
- ``aux``: The auxiliary information string for the annotation.
115+
- ``fs``: The sampling frequency of the record if contained in the annotation file.
116+
117+
Constructor function:
118+
::
119+
115120
def __init__(self, recordname, annotator, annsamp, anntype, subtype = None,
116121
chan = None, num = None, aux = None, fs = None)
117122

118-
Call 'showanncodes()' to see the list of standard annotation codes. Any text used to label
119-
annotations that are not one of these codes should go in the 'aux' field rather than the
120-
'anntype' field.
123+
Call 'showanncodes()' to see the list of standard annotation codes. Any text used to label annotations that are not one of these codes should go in the 'aux' field rather than the 'anntype' field.
124+
125+
Example usage:
126+
::
121127

122-
Example usage:
123128
import wfdb
124129
ann1 = wfdb.Annotation(recordname='ann1', annotator='atr', annsamp=[10,20,400],
125130
anntype = ['N','N','['], aux=[None, None, 'Serious Vfib'])
@@ -131,11 +136,13 @@ Reading Signals
131136
**rdsamp** - Read a WFDB record and return the signal and record descriptors as attributes in a Record or MultiRecord object.
132137

133138
::
139+
134140
record = rdsamp(recordname, sampfrom=0, sampto=None, channels=None, physical=True, pbdir = None, m2s=True)
135141

136142
Example Usage:
137143

138144
::
145+
139146
import wfdb
140147
ecgrecord = wfdb.rdsamp('sampledata/test01_00s', sampfrom=800, channels = [1,3])
141148

@@ -156,11 +163,13 @@ Output Arguments:
156163
**srdsamp** - A simplified wrapper function around rdsamp. Read a WFDB record and return the physical signal and a few important descriptor fields.
157164

158165
::
166+
159167
signals, fields = srdsamp(recordname, sampfrom=0, sampto=None, channels=None, pbdir=None)
160168

161169
Example Usage:
162170

163171
::
172+
164173
import wfdb
165174
sig, fields = wfdb.srdsamp('sampledata/test01_00s', sampfrom=800, channels = [1,3])
166175

@@ -190,6 +199,7 @@ The Record class has a **wrsamp** instance method for writing wfdb record files.
190199
**wrsamp** - Write a single segment WFDB record, creating a WFDB header file and any associated dat files.
191200

192201
::
202+
193203
wrsamp(recordname, fs, units, signames, p_signals = None, d_signals=None, fmt = None, gain = None, baseline = None, comments = None)
194204

195205
Example Usage:
@@ -229,10 +239,12 @@ Reading Annotations
229239
**rdann** - Read a WFDB annotation file ``recordname.annot`` and return an Annotation object.
230240

231241
::
242+
232243
annotation = rdann(recordname, annotator, sampfrom=0, sampto=None, pbdir=None)
233244

234245
Example Usage:
235246
::
247+
236248
import wfdb
237249
ann = wfdb.rdann('sampledata/100', 'atr', sampto = 300000)
238250

@@ -261,6 +273,7 @@ Output arguments:
261273
**showanncodes** - Display the annotation symbols and the codes they represent according to the standard WFDB library 10.5.24
262274

263275
::
276+
264277
showanncodes()
265278

266279
Writing Annotations
@@ -273,11 +286,13 @@ The Annotation class has a **wrann** instance method for writing wfdb annotation
273286
**wrann** - Write a WFDB annotation file.
274287

275288
::
289+
276290
wrann(recordname, annotator, annsamp, anntype, num = None, subtype = None, chan = None, aux = None, fs = None)
277291

278292
Example Usage:
279293

280294
::
295+
281296
import wfdb
282297
annotation = wfdb.rdann('b001', 'atr', pbdir='cebsdb')
283298
wfdb.wrann('b001', 'cpy', annotation.annsamp, annotation.anntype)
@@ -303,11 +318,13 @@ Plotting Data
303318
**plotrec** - Subplot and label each channel of a WFDB Record. Optionally, subplot annotation locations over selected channels.
304319

305320
::
321+
306322
plotrec(record=None, title = None, annotation = None, annch = [0], timeunits='samples', returnfig=False)
307323

308324
Example Usage:
309325

310326
::
327+
311328
import wfdb
312329
record = wfdb.rdsamp('sampledata/100', sampto = 15000)
313330
annotation = wfdb.rdann('sampledata/100', 'atr', sampto = 15000)
@@ -331,11 +348,13 @@ Output argument:
331348
**plotann** - Plot sample locations of an Annotation object.
332349

333350
::
351+
334352
plotann(annotation, title = None, timeunits = 'samples', returnfig = False)
335353

336354
Example Usage:
337355

338356
::
357+
339358
import wfdb
340359
record = wfdb.rdsamp('sampledata/100', sampto = 15000)
341360
annotation = wfdb.rdann('sampledata/100', 'atr', sampto = 15000)
@@ -363,22 +382,26 @@ Download files from various Physiobank databases. The Physiobank index page list
363382
**getdblist** - Return a list of all the physiobank databases available.
364383

365384
::
385+
366386
dblist = wfdb.getdblist()
367387
368388
Example Usage:
369389

370390
::
391+
371392
import wfdb
372393
dblist = wfdb.getdblist()
373394

374395
**dldatabase** - Download WFDB record (and optionally annotation) files from a Physiobank database. The database must contain a 'RECORDS' file in its base directory which lists its WFDB records.
375396

376397
::
398+
377399
dldatabase(pbdb, dlbasedir, records = 'all', annotators = 'all' , keepsubdirs = True, overwrite = False)
378400

379401
Example Usage:
380402

381403
::
404+
382405
import wfdb
383406
wfdb.dldatabase('ahadb', os.getcwd())
384407
@@ -396,11 +419,13 @@ Input arguments:
396419
**dldatabasefiles** - Download specified files from a Physiobank database.
397420

398421
::
422+
399423
dldatabasefiles(pbdb, dlbasedir, files, keepsubdirs = True, overwrite = False)
400424
401425
Example Usage:
402426

403427
::
428+
404429
import wfdb
405430
wfdb.dldatabasefiles('ahadb', os.getcwd(), ['STAFF-Studies-bibliography-2016.pdf', 'data/001a.hea', 'data/001a.dat'])
406431

0 commit comments

Comments
 (0)