Skip to content

Commit 9d76714

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 1e30da0 commit 9d76714

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
@@ -596,6 +596,34 @@ def test_multi_fixed_c(self):
596596
np.testing.assert_equal(sig_round, sig_target)
597597
assert record.__eq__(record_named)
598598

599+
def test_multi_fixed_d(self):
600+
"""
601+
Multi-segment, fixed layout, multi-frequency, selected channels
602+
603+
Target file created with:
604+
rdsamp -r sample-data/multi-segment/041s/ -s 3 2 1 -H |
605+
cut -f 2- | sed s/-32768/-2048/ |
606+
gzip -9 -n > tests/target-output/record-multi-fixed-d.gz
607+
"""
608+
record = wfdb.rdrecord('sample-data/multi-segment/041s/041s',
609+
channels=[3, 2, 1], physical=False,
610+
smooth_frames=False)
611+
612+
# Convert expanded to uniform array (high-resolution)
613+
sig = np.zeros((record.sig_len * 4, record.n_sig), dtype=int)
614+
for i, s in enumerate(record.e_d_signal):
615+
sig[:, i] = np.repeat(s, len(sig[:, i]) // len(s))
616+
617+
sig_target = np.genfromtxt(
618+
'tests/target-output/record-multi-fixed-d.gz')
619+
620+
record_named = wfdb.rdrecord('sample-data/multi-segment/041s/041s',
621+
channel_names=['ABP', 'V', 'I'],
622+
physical=False, smooth_frames=False)
623+
624+
np.testing.assert_array_equal(sig, sig_target)
625+
assert record.__eq__(record_named)
626+
599627
def test_multi_variable_a(self):
600628
"""
601629
Multi-segment, variable layout, selected duration, samples read

0 commit comments

Comments
 (0)