Appending timestamps? #48
-
Hi NWB community, I'm trying to write timestamped data iteratively by modifying the example found here: I can add the timestamps when writing the first chunk of data (the portion before export() ), but how do I iteratively write timestamps for chunks 2 through 4? I imagined it would be something like But nwb.acquisition.get('time_series').timestamps doesn't have an append() function of course. Thanks for pointing me the right direction, |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
|
Beta Was this translation helpful? Give feedback.
-
Thank you Ben, Below is how I've tried to modify your example. Gratefully, ` % create an nwb structure with required fields % sample rate and timestamp vector for first portion of data % compress the data %Set the compressed data as a time series fdataNWB = types.core.TimeSeries( ... nwb.acquisition.set('time_series', fdataNWB); nwbExport(nwb, 'DataPipeTutorial_iterate.nwb'); nwb = nwbRead('DataPipeTutorial_iterate.nwb'); %load the nwb file with partial data % check that the timestamps and data load and can be plotted % load each of the remaining 1/4ths of the large dataset
end |
Beta Was this translation helpful? Give feedback.
-
Yes, something like this: replace timestamp_vec = (1:10000)./fs; % seconds with: timestamp_vec = types.untyped.DataPipe( ...
'data', (1:10000)./fs; % seconds, ...
'maxSize', fullDataSize, ...
'axis', 1); However, I would add that if you timestamps are truly regular, you are better off defining your TimeSeries with a sampling rate and starting time like this: fdataNWB = types.core.TimeSeries( ...
'data', fData_use, ...
'data_unit', 'mV',...
'starting_time', 0.0, ...
'starting_time_rate', fs, ...
); which would avoid this problem altogether. |
Beta Was this translation helpful? Give feedback.
Yes, something like this:
replace
with:
However, I would add that if you timestamps are truly regular, you are better off defining your TimeSeries with a sampling rate and starting time like this:
which would avoid this problem altogether.