From 9c010a21406a85162bbf98dbce8844d2c2aefdda Mon Sep 17 00:00:00 2001 From: rly Date: Fri, 4 Aug 2023 11:31:33 -0700 Subject: [PATCH] Allow setting data and timestamps on TimeSeries --- src/pynwb/base.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/pynwb/base.py b/src/pynwb/base.py index bec8903d5..7db67cbbd 100644 --- a/src/pynwb/base.py +++ b/src/pynwb/base.py @@ -167,7 +167,7 @@ def __init__(self, **kwargs): setattr(self, key, val) data = args_to_process['data'] - self.fields['data'] = data + self.data = data if isinstance(data, TimeSeries): data.__add_link('data_link', self) @@ -177,7 +177,7 @@ def __init__(self, **kwargs): raise ValueError('Specifying rate and timestamps is not supported.') if self.starting_time is not None: raise ValueError('Specifying starting_time and timestamps is not supported.') - self.fields['timestamps'] = timestamps + self.timestamps = timestamps self.timestamps_unit = self.__time_unit self.interval = 1 if isinstance(timestamps, TimeSeries): @@ -252,6 +252,10 @@ def data(self): else: return self.fields['data'] + @data.setter + def data(self, val): + self.fields['data'] = val + @property def data_link(self): return self.__get_links('data_link') @@ -265,6 +269,10 @@ def timestamps(self): else: return self.fields['timestamps'] + @timestamps.setter + def timestamps(self, val): + self.fields['timestamps'] = val + @property def timestamp_link(self): return self.__get_links('timestamp_link')