name='my_population', source='acquisition', unit='second', timestamps=np.random.rand(5)) f = NWBFile(source='noone', session_description='my first synthetic recording', file_name='tmp.nwb', identifier='hi', experimenter='Dr. Bilbo Baggins', lab='Bag End Labatory', institution='University of Middle Earth at the Shire', experiment_description='empty', session_id='LONELYMTN', session_start_time=datetime.now()) f.add_raw_timeseries(fs) test_file_name = 'example.nwb' manager = get_build_manager() io = HDF5IO(test_file_name, manager, mode='w') io.write(f) io.close() io = HDF5IO(test_file_name, mode='r') read_data = io.read() pst = read_data.get_raw_timeseries('my_population') print pst.data[2:5] print pst.timestamps[2:5]
description="This 2D Brownian process generated with \ numpy.cumsum(numpy.random.normal(size=(2,len(spatial_timestamps))), axis=-1).T" ) # Create experimental epochs epoch_tags = ('test_example', ) ep1 = f.add_epoch('epoch1', ephys_timestamps[100], ephys_timestamps[200], tags=epoch_tags, description="the first test epoch") ep2 = f.add_epoch('epoch2', ephys_timestamps[600], ephys_timestamps[700], tags=epoch_tags, description="the second test epoch") # Add the time series data and include the epochs it is apart of f.add_raw_timeseries(ephys_ts, [ep1, ep2]) f.add_raw_timeseries(spatial_ts, [ep1, ep2]) # Write the NWB file manager = get_build_manager() io = HDF5IO(filename, manager, mode='w') io.write(f) io.close() io = HDF5IO(filename, manager, mode='r') io.read() io.close()