|
5 | 5 | import logging |
6 | 6 | from warnings import warn |
7 | 7 |
|
| 8 | +import numpy as np |
8 | 9 | from hdmf.backends.hdf5 import H5DataIO |
9 | 10 | from hdmf.data_utils import GenericDataChunkIterator |
10 | | -import numpy as np |
11 | 11 | from pynwb import NWBFile |
12 | 12 | from pynwb.ecephys import ElectricalSeries |
13 | 13 |
|
@@ -97,8 +97,7 @@ def __init__( |
97 | 97 | assert all(neo_io.block_count() == 1 for neo_io in self.neo_io) |
98 | 98 | assert all(neo_io.segment_count(0) == 1 for neo_io in self.neo_io) |
99 | 99 | assert all( |
100 | | - neo_io.signal_streams_count() == 4 - behavior_only |
101 | | - for neo_io in self.neo_io |
| 100 | + neo_io.signal_streams_count() == 4 - behavior_only for neo_io in self.neo_io |
102 | 101 | ), ( |
103 | 102 | "Unexpected number of signal streams. " |
104 | 103 | + "Confirm whether behavior_only is set correctly for this recording" |
@@ -132,10 +131,8 @@ def __init__( |
132 | 131 | if ( |
133 | 132 | len( |
134 | 133 | { |
135 | | - |
136 | | - neo_io.signal_channels_count(stream_index=self.stream_index) |
137 | | - for neo_io in self.neo_io |
138 | | - |
| 134 | + neo_io.signal_channels_count(stream_index=self.stream_index) |
| 135 | + for neo_io in self.neo_io |
139 | 136 | } |
140 | 137 | ) |
141 | 138 | > 1 |
@@ -222,7 +219,8 @@ def __init__( |
222 | 219 | is_timestamps_sequential = np.all(np.diff(self.timestamps)) |
223 | 220 | if not is_timestamps_sequential: |
224 | 221 | warn( |
225 | | - "Timestamps are not sequential. This may cause problems with some software or data analysis.", stacklevel=2 |
| 222 | + "Timestamps are not sequential. This may cause problems with some software or data analysis.", |
| 223 | + stacklevel=2, |
226 | 224 | ) |
227 | 225 |
|
228 | 226 | self.n_time = [ |
@@ -265,22 +263,20 @@ def _get_data(self, selection: tuple[slice]) -> np.ndarray: |
265 | 263 | io_stream = np.argmin(i >= file_start_ind) - 1 |
266 | 264 | # get the data from that stream |
267 | 265 | data.append( |
268 | | - |
269 | | - self.neo_io[io_stream].get_analogsignal_chunk( |
270 | | - block_index=self.block_index, |
271 | | - seg_index=self.seg_index, |
272 | | - i_start=int(i - file_start_ind[io_stream]), |
273 | | - i_stop=int( |
274 | | - min( |
275 | | - time_index[-1] - file_start_ind[io_stream], |
276 | | - self.n_time[io_stream], |
277 | | - ) |
| 266 | + self.neo_io[io_stream].get_analogsignal_chunk( |
| 267 | + block_index=self.block_index, |
| 268 | + seg_index=self.seg_index, |
| 269 | + i_start=int(i - file_start_ind[io_stream]), |
| 270 | + i_stop=int( |
| 271 | + min( |
| 272 | + time_index[-1] - file_start_ind[io_stream], |
| 273 | + self.n_time[io_stream], |
278 | 274 | ) |
279 | | - + 1, |
280 | | - stream_index=self.stream_index, |
281 | | - channel_ids=channel_ids, |
282 | 275 | ) |
283 | | - |
| 276 | + + 1, |
| 277 | + stream_index=self.stream_index, |
| 278 | + channel_ids=channel_ids, |
| 279 | + ) |
284 | 280 | ) |
285 | 281 | i += min( |
286 | 282 | self.n_time[io_stream] |
|
0 commit comments