Skip to content

Commit d698e0e

Browse files
author
Benjamin Moody
committed
Test reading fixed-layout multi-frequency signals.
This test case uses an excerpt of record mimicdb/041/, which is a fixed-layout record with three signals at 500 Hz (four samples per frame) and four signals at 125 Hz (one sample per frame).
1 parent 09945bd commit d698e0e

File tree

7 files changed

+49
-0
lines changed

7 files changed

+49
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
041s/2 7 125 2000 8:26:04 26/10/1994
2+
041s01 1000
3+
041s02 1000
23.4 KB
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
041s01 7 125 1000 8:26:04 26/10/1994
2+
041s01.dat 212x4 2000 12 0 168 -2716 0 III
3+
041s01.dat 212x4 2000 12 0 2 -25019 0 I
4+
041s01.dat 212x4 2000 12 0 155 -12467 0 V
5+
041s01.dat 212 20(-1600)/mmHg 12 0 -242 -18875 0 ABP
6+
041s01.dat 212 80(-1600)/mmHg 12 0 706 -5338 0 PAP
7+
041s01.dat 212 2000 12 0 -841 30145 0 PLETH
8+
041s01.dat 212 2000 12 0 401 3712 0 RESP
9+
#Produced by xform from record mimicdb/041/04100001, beginning at s74000
23.4 KB
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
041s02 7 125 1000 8:26:12 26/10/1994
2+
041s02.dat 212x4 2000 12 0 -103 -862 0 III
3+
041s02.dat 212x4 2000 12 0 -64 14967 0 I
4+
041s02.dat 212x4 2000 12 0 89 13162 0 V
5+
041s02.dat 212 20(-1600)/mmHg 12 0 -715 -21117 0 ABP
6+
041s02.dat 212 80(-1600)/mmHg 12 0 -583 -31770 0 PAP
7+
041s02.dat 212 2000 12 0 -840 -31041 0 PLETH
8+
041s02.dat 212 2000 12 0 -861 -31272 0 RESP
9+
#Produced by xform from record mimicdb/041/04100002, beginning at 0:0
26.3 KB
Binary file not shown.

tests/test_record.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,34 @@ def test_multi_fixed_c(self):
630630
np.testing.assert_equal(sig_round, sig_target)
631631
assert record.__eq__(record_named)
632632

633+
def test_multi_fixed_d(self):
634+
"""
635+
Multi-segment, fixed layout, multi-frequency, selected channels
636+
637+
Target file created with:
638+
rdsamp -r sample-data/multi-segment/041s/ -s 3 2 1 -H |
639+
cut -f 2- | sed s/-32768/-2048/ |
640+
gzip -9 -n > tests/target-output/record-multi-fixed-d.gz
641+
"""
642+
record = wfdb.rdrecord('sample-data/multi-segment/041s/041s',
643+
channels=[3, 2, 1], physical=False,
644+
smooth_frames=False)
645+
646+
# Convert expanded to uniform array (high-resolution)
647+
sig = np.zeros((record.sig_len * 4, record.n_sig), dtype=int)
648+
for i, s in enumerate(record.e_d_signal):
649+
sig[:, i] = np.repeat(s, len(sig[:, i]) // len(s))
650+
651+
sig_target = np.genfromtxt(
652+
'tests/target-output/record-multi-fixed-d.gz')
653+
654+
record_named = wfdb.rdrecord('sample-data/multi-segment/041s/041s',
655+
channel_names=['ABP', 'V', 'I'],
656+
physical=False, smooth_frames=False)
657+
658+
np.testing.assert_array_equal(sig, sig_target)
659+
assert record.__eq__(record_named)
660+
633661
def test_multi_variable_a(self):
634662
"""
635663
Multi-segment, variable layout, selected duration, samples read

0 commit comments

Comments
 (0)