From 6e545cf03425e212a04e3d653aabac7c25c32347 Mon Sep 17 00:00:00 2001 From: lamam Date: Fri, 9 Jun 2023 15:25:09 -0400 Subject: [PATCH 1/3] fixing rounding erros in to_dataframe --- wfdb/io/record.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wfdb/io/record.py b/wfdb/io/record.py index 75ac1927..4347c699 100644 --- a/wfdb/io/record.py +++ b/wfdb/io/record.py @@ -1014,13 +1014,13 @@ def to_dataframe(self) -> pd.DataFrame: index = pd.date_range( start=self.base_datetime, periods=self.sig_len, - freq=pd.Timedelta(seconds=1 / self.fs), + end= self.get_absolute_time(self.sig_len - 1), ) else: index = pd.timedelta_range( start=pd.Timedelta(0), periods=self.sig_len, - freq=pd.Timedelta(seconds=1 / self.fs), + end= self.get_absolute_time(self.sig_len - 1), ) if self.p_signal is not None: From f71c8b65476dcacf0320910899d954bc7468459d Mon Sep 17 00:00:00 2001 From: lamam Date: Tue, 13 Jun 2023 14:44:31 -0400 Subject: [PATCH 2/3] adds the timedelta if no base time is provided --- wfdb/io/record.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wfdb/io/record.py b/wfdb/io/record.py index 4347c699..6638412b 100644 --- a/wfdb/io/record.py +++ b/wfdb/io/record.py @@ -1020,7 +1020,7 @@ def to_dataframe(self) -> pd.DataFrame: index = pd.timedelta_range( start=pd.Timedelta(0), periods=self.sig_len, - end= self.get_absolute_time(self.sig_len - 1), + end= self.get_elapsed_time(self.sig_len - 1), ) if self.p_signal is not None: From b9d343f15b46c780566c97cf88f9cc7e43b40498 Mon Sep 17 00:00:00 2001 From: lamam Date: Tue, 13 Jun 2023 14:52:37 -0400 Subject: [PATCH 3/3] updates code format --- wfdb/io/record.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wfdb/io/record.py b/wfdb/io/record.py index 6638412b..012a7b8a 100644 --- a/wfdb/io/record.py +++ b/wfdb/io/record.py @@ -1014,13 +1014,13 @@ def to_dataframe(self) -> pd.DataFrame: index = pd.date_range( start=self.base_datetime, periods=self.sig_len, - end= self.get_absolute_time(self.sig_len - 1), + end=self.get_absolute_time(self.sig_len - 1), ) else: index = pd.timedelta_range( start=pd.Timedelta(0), periods=self.sig_len, - end= self.get_elapsed_time(self.sig_len - 1), + end=self.get_elapsed_time(self.sig_len - 1), ) if self.p_signal is not None: