Skip to content

Commit b5e9a50

Browse files
authored
Merge pull request MIT-LCP#120 from MIT-LCP/digitalfix
load signals as digital for multisegment if requested
2 parents ede9729 + 75ba2e7 commit b5e9a50

29 files changed

+517965
-373
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/target-output/io-5e

Lines changed: 517500 additions & 0 deletions
Large diffs are not rendered by default.

tests/test_annotation.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
class test_annotation():
66

77
# Test 1 - Annotation file 100.atr
8-
# Target file created with: rdann -r sample-data/100 -a atr > anntarget1
8+
# Target file created with: rdann -r sample-data/100 -a atr > ann-1
99
def test_1(self):
1010

1111
# Read data using WFDB python package
1212
annotation = wfdb.rdann('sample-data/100', 'atr')
1313

14-
14+
1515
# This is not the fault of the script. The annotation file specifies a
1616
# length 3
1717
annotation.aux_note[0] = '(N'
@@ -20,7 +20,7 @@ def test_1(self):
2020
# no null to detect in the output text file of rdann.
2121

2222
# Target data from WFDB software package
23-
lines = tuple(open('tests/target-output/anntarget1', 'r'))
23+
lines = tuple(open('tests/target-output/ann-1', 'r'))
2424
nannot = len(lines)
2525

2626
target_time = [None] * nannot
@@ -45,18 +45,18 @@ def test_1(self):
4545
target_chan = target_chan.astype('int')
4646

4747
# Compare
48-
comp = [np.array_equal(annotation.sample, target_sample),
49-
np.array_equal(annotation.symbol, target_symbol),
50-
np.array_equal(annotation.subtype, target_subtype),
51-
np.array_equal(annotation.chan, target_chan),
52-
np.array_equal(annotation.num, target_num),
48+
comp = [np.array_equal(annotation.sample, target_sample),
49+
np.array_equal(annotation.symbol, target_symbol),
50+
np.array_equal(annotation.subtype, target_subtype),
51+
np.array_equal(annotation.chan, target_chan),
52+
np.array_equal(annotation.num, target_num),
5353
annotation.aux_note == target_aux_note]
5454

5555
# Test file streaming
5656
pbannotation = wfdb.rdann('100', 'atr', pb_dir='mitdb', return_label_elements=['label_store', 'symbol'])
5757
pbannotation.aux_note[0] = '(N'
5858
pbannotation.create_label_map()
59-
59+
6060
# Test file writing
6161
annotation.wrann(write_fs=True)
6262
writeannotation = wfdb.rdann('100', 'atr', return_label_elements=['label_store', 'symbol'])
@@ -67,14 +67,14 @@ def test_1(self):
6767
assert annotation.__eq__(writeannotation)
6868

6969
# Test 2 - Annotation file 12726.anI with many aux_note strings.
70-
# Target file created with: rdann -r sample-data/100 -a atr > anntarget2
70+
# Target file created with: rdann -r sample-data/100 -a atr > ann-2
7171
def test_2(self):
7272

7373
# Read data from WFDB python package
7474
annotation = wfdb.rdann('sample-data/12726', 'anI')
7575

7676
# Target data from WFDB software package
77-
lines = tuple(open('tests/target-output/anntarget2', 'r'))
77+
lines = tuple(open('tests/target-output/ann-2', 'r'))
7878
nannot = len(lines)
7979

8080
target_time = [None] * nannot
@@ -99,11 +99,11 @@ def test_2(self):
9999
target_chan = target_chan.astype('int')
100100

101101
# Compare
102-
comp = [np.array_equal(annotation.sample, target_sample),
103-
np.array_equal(annotation.symbol, target_symbol),
104-
np.array_equal(annotation.subtype, target_subtype),
105-
np.array_equal(annotation.chan, target_chan),
106-
np.array_equal(annotation.num, target_num),
102+
comp = [np.array_equal(annotation.sample, target_sample),
103+
np.array_equal(annotation.symbol, target_symbol),
104+
np.array_equal(annotation.subtype, target_subtype),
105+
np.array_equal(annotation.chan, target_chan),
106+
np.array_equal(annotation.num, target_num),
107107
annotation.aux_note == target_aux_note]
108108
# Test file streaming
109109
pbannotation = wfdb.rdann('12726', 'anI', pb_dir='prcp', return_label_elements=['label_store', 'symbol'])
@@ -119,14 +119,14 @@ def test_2(self):
119119
assert annotation.__eq__(writeannotation)
120120

121121
# Test 3 - Annotation file 1003.atr with custom annotation types
122-
# Target file created with: rdann -r sample-data/1003 -a atr > anntarget3
122+
# Target file created with: rdann -r sample-data/1003 -a atr > ann-3
123123
def test_3(self):
124124

125125
# Read data using WFDB python package
126126
annotation = wfdb.rdann('sample-data/1003', 'atr')
127127

128128
# Target data from WFDB software package
129-
lines = tuple(open('tests/target-output/anntarget3', 'r'))
129+
lines = tuple(open('tests/target-output/ann-3', 'r'))
130130
nannot = len(lines)
131131

132132
target_time = [None] * nannot
@@ -151,11 +151,11 @@ def test_3(self):
151151
target_chan = target_chan.astype('int')
152152

153153
# Compare
154-
comp = [np.array_equal(annotation.sample, target_sample),
155-
np.array_equal(annotation.symbol, target_symbol),
156-
np.array_equal(annotation.subtype, target_subtype),
157-
np.array_equal(annotation.chan, target_chan),
158-
np.array_equal(annotation.num, target_num),
154+
comp = [np.array_equal(annotation.sample, target_sample),
155+
np.array_equal(annotation.symbol, target_symbol),
156+
np.array_equal(annotation.subtype, target_subtype),
157+
np.array_equal(annotation.chan, target_chan),
158+
np.array_equal(annotation.num, target_num),
159159
annotation.aux_note == target_aux_note]
160160

161161
# Test file streaming

0 commit comments

Comments
 (0)