Skip to content

Commit 4864c3c

Browse files
committed
Instantiate chunk wiht np.full and parameters in docstring
1 parent 2f76309 commit 4864c3c

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

neo/rawio/openephysrawio.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ class OpenEphysRawIO(BaseRawIO):
5757
Theses gaps are checked channel per channel which make the parse_header() slow.
5858
If gaps are detected then they are filled with zeros but the the reading will be much slower for getting signals.
5959
60+
Parameters
61+
----------
62+
dirname: str
63+
The directory where the files are stored.
64+
ignore_timestamps_errors: bool
65+
(deprecated) This parameter is not used anymore.
66+
fill_gap_value: int
67+
When gaps are detected in continuous files, the gap is filled with this value.
68+
Default is 0.
69+
6070
"""
6171
# file formats used by openephys
6272
extensions = ['continuous', 'openephys', 'spikes', 'events', 'xml']
@@ -314,9 +324,8 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop,
314324
channel_indexes = slice(None)
315325
global_channel_indexes = global_channel_indexes[channel_indexes]
316326

317-
sigs_chunk = np.ones((i_stop - i_start, len(global_channel_indexes)), dtype='int16') * self.fill_gap_value
318-
319327
if not self._gap_mode:
328+
sigs_chunk = np.zeros((i_stop - i_start, len(global_channel_indexes)), dtype='int16')
320329
# previous behavior block index are linear
321330
block_start = i_start // RECORD_SIZE
322331
block_stop = i_stop // RECORD_SIZE + 1
@@ -328,6 +337,9 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop,
328337
sub = data[block_start:block_stop]
329338
sigs_chunk[:, i] = sub['samples'].flatten()[sl0:sl1]
330339
else:
340+
sigs_chunk = np.full(shape=(i_stop - i_start, len(global_channel_indexes)),
341+
fill_value=self.fill_gap_value,
342+
dtype='int16')
331343
# slow mode
332344
for i, global_chan_index in enumerate(global_channel_indexes):
333345
data = self._sigs_memmap[seg_index][global_chan_index]

0 commit comments

Comments
 (0)