Skip to content

Commit 45f8399

Browse files
author
sprenger
committed
[neuralynx] improve array handling and ensure t_starts is float
1 parent e910801 commit 45f8399

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

neo/rawio/edfrawio.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def _get_stream_channels(self, stream_index):
153153

154154
def _segment_t_start(self, block_index, seg_index):
155155
# no time offset provided by EDF format
156-
return 0 # in seconds
156+
return 0. # in seconds
157157

158158
def _segment_t_stop(self, block_index, seg_index):
159159
t_stop = self.edf_reader.datarecord_duration * self.edf_reader.datarecords_in_file
@@ -166,7 +166,7 @@ def _get_signal_size(self, block_index, seg_index, stream_index):
166166
return self.edf_reader.getNSamples()[chidx]
167167

168168
def _get_signal_t_start(self, block_index, seg_index, stream_index):
169-
return 0 # EDF does not provide temporal offset information
169+
return 0. # EDF does not provide temporal offset information
170170

171171
def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop,
172172
stream_index, channel_indexes):
@@ -197,10 +197,13 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop,
197197
self.edf_reader.read_digital_signal(channel_idx, i_start, n, buffer)
198198
data.append(buffer)
199199

200+
# use dimensions (time, channel)
201+
data = data.T
202+
200203
# downgrade to int16 as this is what is used in the edf file format
201204
data = np.asarray(data, dtype=np.int16)
202205

203-
return data.T # use dimensions (time, channel)
206+
return data
204207

205208
def _spike_count(self, block_index, seg_index, spike_channel_index):
206209
return None

0 commit comments

Comments
 (0)