From e583e0ea53595d846f5877228cdbf5c2db2a1147 Mon Sep 17 00:00:00 2001 From: Tom Pollard Date: Thu, 20 Apr 2023 15:48:21 -0400 Subject: [PATCH 1/5] bump version to v4.1.1. --- docs/changes.rst | 10 ++++++++++ pyproject.toml | 2 +- wfdb/version.py | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/changes.rst b/docs/changes.rst index ac4762af..df5a6f5a 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -5,6 +5,16 @@ This page lists recent changes in the `wfdb` package (since version 4.0.0) that .. _development repository: https://github.com/MIT-LCP/wfdb-python +Version 4.1.1 (April 2023) +----------------------------- + +**Remove upper bound on dependencies** + Previously, the package provided restrictive caps on version number of dependencies. These caps have been removed. + +**Miscellaneous style and typing fixes** + Various fixes were made to code style and handling of data types. + + Version 4.1.0 (December 2022) ----------------------------- diff --git a/pyproject.toml b/pyproject.toml index 735b64fb..2700d95e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "wfdb" -version = "4.1.0" +version = "4.1.1" description = "The WFDB Python package: tools for reading, writing, and processing physiologic signals and annotations." authors = ["The Laboratory for Computational Physiology "] readme = "README.md" diff --git a/wfdb/version.py b/wfdb/version.py index 70397087..72aa7583 100644 --- a/wfdb/version.py +++ b/wfdb/version.py @@ -1 +1 @@ -__version__ = "4.1.0" +__version__ = "4.1.1" From 5375b971df7a108854eb5c04829f3663760532b9 Mon Sep 17 00:00:00 2001 From: Benjamin Moody Date: Thu, 11 May 2023 12:39:33 -0400 Subject: [PATCH 2/5] _auto_signal_file_names: fix counting channels per group. Since the FLAC format has a hard limit of eight channels, we need to use multiple signal files if a record contains more than eight signals. Commit d1d26ba was meant to do this automatically (when Record.set_default or wfdb.wrsamp is used to generate the signal file names), but this was never tested. --- wfdb/io/_header.py | 1 + 1 file changed, 1 insertion(+) diff --git a/wfdb/io/_header.py b/wfdb/io/_header.py index dbcc0177..419fb1cf 100644 --- a/wfdb/io/_header.py +++ b/wfdb/io/_header.py @@ -384,6 +384,7 @@ def _auto_signal_file_names(self): num_groups += 1 channels_in_group = 0 group_number.append(num_groups) + channels_in_group += 1 prev_fmt = ch_fmt prev_spf = ch_spf From 19a34fd0fdd371fe81ddb40a6f19f57b3be81ec9 Mon Sep 17 00:00:00 2001 From: Alistair Johnson Date: Thu, 11 May 2023 14:25:06 -0400 Subject: [PATCH 3/5] Add a test to check if wrsamp can write more than 8 channels to fmt516 We should be able to read and write data with more than 8 channels to formats 508, 516, and 524. This test verifies that the digital signal generated when writing to format 516 is identical to the original signal loaded in from a sample record in format 16. --- tests/test_record.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/test_record.py b/tests/test_record.py index 9563ef11..8d09e39d 100644 --- a/tests/test_record.py +++ b/tests/test_record.py @@ -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. From f25f92b39c1413941a53ee1d42d03dd89f33825c Mon Sep 17 00:00:00 2001 From: Benjamin Moody Date: Thu, 25 May 2023 13:36:34 -0400 Subject: [PATCH 4/5] ann2rr: use data type int64 rather than int. The alias 'np.int' has been removed from recent versions of numpy, and there is no particular reason to want to use it here (as an array data type, 'int' refers to a particular platform-dependent type, which is not at all the same thing as an ordinary Python integer.) Use int64 here for inter-platform consistency and to keep it simple. --- wfdb/processing/hr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wfdb/processing/hr.py b/wfdb/processing/hr.py index 6d6502ad..5e6bfc36 100644 --- a/wfdb/processing/hr.py +++ b/wfdb/processing/hr.py @@ -227,7 +227,7 @@ def ann2rr( elif format == "h": out_interval = time_interval / (60 * 60) else: - out_interval = np.around(time_interval * ann.fs).astype(np.int) + out_interval = np.around(time_interval * ann.fs).astype(np.int64) if as_array: return out_interval From da089c537a81b01b462a54dd591c51b9c2efdc2e Mon Sep 17 00:00:00 2001 From: Tom Pollard Date: Fri, 16 Jun 2023 13:39:57 -0400 Subject: [PATCH 5/5] Bump version to 4.1.2. Add release notes to docs. --- docs/changes.rst | 9 +++++++++ pyproject.toml | 2 +- wfdb/version.py | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/changes.rst b/docs/changes.rst index df5a6f5a..061f4877 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -5,6 +5,15 @@ This page lists recent changes in the `wfdb` package (since version 4.0.0) that .. _development repository: https://github.com/MIT-LCP/wfdb-python +Version 4.1.2 (June 2023) +----------------------------- + +**Handle more than 8 compressed signals in wrsamp** + Previously, the package did not support writing of compressed records with more than 8 channels. + +**Use int64 instead of int for ann2rr** + Fixes 'np has no attribute np.int' error raised when running ann2rr. + Version 4.1.1 (April 2023) ----------------------------- diff --git a/pyproject.toml b/pyproject.toml index 2700d95e..406cf72f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "wfdb" -version = "4.1.1" +version = "4.1.2" description = "The WFDB Python package: tools for reading, writing, and processing physiologic signals and annotations." authors = ["The Laboratory for Computational Physiology "] readme = "README.md" diff --git a/wfdb/version.py b/wfdb/version.py index 72aa7583..13ffcf42 100644 --- a/wfdb/version.py +++ b/wfdb/version.py @@ -1 +1 @@ -__version__ = "4.1.1" +__version__ = "4.1.2"