-
Notifications
You must be signed in to change notification settings - Fork 88
Open
Labels
category: enhancementimprovements of code or code behaviorimprovements of code or code behaviorpriority: lowalternative solution already working and/or relevant to only specific user(s)alternative solution already working and/or relevant to only specific user(s)
Milestone
Description
Hello everyone.
I've been using your API to develop my GSoC project and one of my tasks was to find a way to programmatically find all the time series present in any NWB 2.x file.
I've tried to develop this as follows:
def _get_data_interfaces(self, node):
"""Given a NWBHDF5IO returns all the data_interfaces objects presents on it."""
data_interfaces_list = []
for child in node.children:
if isinstance(child, NWBDataInterface):
data_interfaces_list.append(child)
data_interfaces_list += self._get_data_interfaces(child)
return data_interfaces_list
def _get_timeseries(self):
"""Given all the nwb_data_interfaces returns all of those that are timeseries objects."""
time_series_list = []
for data_interface in self.nwb_data_interfaces_list:
if isinstance(data_interface, TimeSeries):
time_series_list.append(data_interface)
return time_series_list
I believe this returns all the TimeSeries objects, then I simply run over each one of them to get mono dimensional time series easily plottable:
def get_mono_dimensional_timeseries(self, values):
"""Given a timeseries object returns all mono dimensional timeseries presents on it."""
mono_time_series_list = []
if isinstance(values, collections.Iterable):
try:
data = [float(i) for i in values]
mono_time_series_list.append(data)
except:
for inner_list in values:
mono_time_series_list += self.get_mono_dimensional_timeseries(inner_list)
return mono_time_series_list
I would like to get your opinion on this.
I wasn't able to find this feature in your API. Do you think it has any value? Would you do this any other way?
I understand that this is not a typical issue, so apologies in advance if it should be asked elsewhere. 🙏
Metadata
Metadata
Assignees
Labels
category: enhancementimprovements of code or code behaviorimprovements of code or code behaviorpriority: lowalternative solution already working and/or relevant to only specific user(s)alternative solution already working and/or relevant to only specific user(s)