Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test to check if wrsamp can write more than 8 channels to format 516 #451

Merged
merged 1 commit into from
May 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions tests/test_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,33 @@ def test_read_write_flac_multifrequency(self):
)
assert record == record_write

def test_read_write_flac_many_channels(self):
"""
Check we can read and write to format 516 with more than 8 channels.
"""
# Read in a signal with 12 channels in format 16
record = wfdb.rdrecord("sample-data/s0010_re", physical=False)

# Test that we can write out the signal in format 516
wfdb.wrsamp(
record_name="s0010_re_fmt516",
fs=record.fs,
units=record.units,
sig_name=record.sig_name,
fmt=["516"] * record.n_sig,
d_signal=record.d_signal,
adc_gain=record.adc_gain,
baseline=record.baseline,
write_dir=self.temp_path,
)

# Check that signal matches the original
record_fmt516 = wfdb.rdrecord(
os.path.join(self.temp_path, "s0010_re_fmt516"),
physical=False,
)
assert (record.d_signal == record_fmt516.d_signal).all()

def test_read_flac_longduration(self):
"""
Three signals multiplexed in a FLAC file, over 2**24 samples.
Expand Down