Skip to content

Commit

Permalink
adds data and unit arguments to spiketimes TimeSeries object (#405)
Browse files Browse the repository at this point in the history
* adds data and unit arguments to spiketimes TimeSeries object

* stores data as np.array to avoid errors when spike times is []
  • Loading branch information
MatthewAitken authored Apr 24, 2020
1 parent 630abee commit a68f354
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ipfx/nwb_append.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from hdmf.backends.hdf5.h5_utils import H5DataIO
from pynwb import TimeSeries
from pynwb import ProcessingModule
import numpy as np


PathLike = Union[
Expand Down Expand Up @@ -50,9 +51,11 @@ def append_spike_times(input_nwb_path: PathLike,
spike_module = ProcessingModule(name='spikes',
description='detected spikes')
for sweep_num, spike_times in sweep_spike_times.items():
wrapped_spike_times = H5DataIO(data=spike_times,
wrapped_spike_times = H5DataIO(data=np.asarray(spike_times),
compression=True)
ts = TimeSeries(timestamps=wrapped_spike_times,
unit='seconds',
data=wrapped_spike_times,
name=f"Sweep_{sweep_num}")
spike_module.add_data_interface(ts)

Expand Down

0 comments on commit a68f354

Please sign in to comment.