Skip to content

Commit

Permalink
Instantiate chunk wiht np.full and parameters in docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
alejoe91 committed Feb 2, 2024
1 parent 2f76309 commit 4864c3c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions neo/rawio/openephysrawio.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ class OpenEphysRawIO(BaseRawIO):
Theses gaps are checked channel per channel which make the parse_header() slow.
If gaps are detected then they are filled with zeros but the the reading will be much slower for getting signals.
Parameters
----------
dirname: str
The directory where the files are stored.
ignore_timestamps_errors: bool
(deprecated) This parameter is not used anymore.
fill_gap_value: int
When gaps are detected in continuous files, the gap is filled with this value.
Default is 0.
"""
# file formats used by openephys
extensions = ['continuous', 'openephys', 'spikes', 'events', 'xml']
Expand Down Expand Up @@ -314,9 +324,8 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop,
channel_indexes = slice(None)
global_channel_indexes = global_channel_indexes[channel_indexes]

sigs_chunk = np.ones((i_stop - i_start, len(global_channel_indexes)), dtype='int16') * self.fill_gap_value

if not self._gap_mode:
sigs_chunk = np.zeros((i_stop - i_start, len(global_channel_indexes)), dtype='int16')
# previous behavior block index are linear
block_start = i_start // RECORD_SIZE
block_stop = i_stop // RECORD_SIZE + 1
Expand All @@ -328,6 +337,9 @@ def _get_analogsignal_chunk(self, block_index, seg_index, i_start, i_stop,
sub = data[block_start:block_stop]
sigs_chunk[:, i] = sub['samples'].flatten()[sl0:sl1]
else:
sigs_chunk = np.full(shape=(i_stop - i_start, len(global_channel_indexes)),
fill_value=self.fill_gap_value,
dtype='int16')
# slow mode
for i, global_chan_index in enumerate(global_channel_indexes):
data = self._sigs_memmap[seg_index][global_chan_index]
Expand Down

0 comments on commit 4864c3c

Please sign in to comment.