|
4 | 4 |
|
5 | 5 | BaseFromRaw implement a bridge between the new neo.rawio API |
6 | 6 | and the neo.io legacy that give neo.core object. |
7 | | -The neo.rawio API is more restricted and limited and do not cover tricky |
| 7 | +The neo.rawio API is more restricted and limited and does not cover tricky |
8 | 8 | cases with asymetrical tree of neo object. |
9 | 9 | But if a format is done in neo.rawio the neo.io is done for free |
10 | 10 | by inheritance of this class. |
11 | | -Furthermore, IOs that inherits this BaseFromRaw also have the ability |
12 | | -of the lazy load with proxy objects. |
| 11 | +Furthermore, IOs that inherit this BaseFromRaw also have the ability |
| 12 | +to lazy load with proxy objects. |
13 | 13 |
|
14 | 14 |
|
15 | 15 | """ |
@@ -80,26 +80,34 @@ def read_block( |
80 | 80 | self, block_index=0, lazy=False, create_group_across_segment=None, signal_group_mode=None, load_waveforms=False |
81 | 81 | ): |
82 | 82 | """ |
83 | | - :param block_index: int default 0. In case of several block block_index can be specified. |
84 | | -
|
85 | | - :param lazy: False by default. |
86 | | -
|
87 | | - :param create_group_across_segment: bool or dict |
| 83 | + Reads one block of data from a file |
| 84 | +
|
| 85 | + Parameters |
| 86 | + ---------- |
| 87 | + block_index: int, default: 0 |
| 88 | + In the case of multiple blocks, the block_index specifies which block to read |
| 89 | + lazy: bool, default: False |
| 90 | + Whether to read the block lazily (True) or load into memory (False) |
| 91 | + create_group_across_segment: bool | dict | None, default: None |
88 | 92 | If True : |
89 | | - * Create a neo.Group to group AnalogSignal segments |
90 | | - * Create a neo.Group to group SpikeTrain across segments |
91 | | - * Create a neo.Group to group Event across segments |
92 | | - * Create a neo.Group to group Epoch across segments |
| 93 | + * Create a neo.Group to group AnalogSignal segments |
| 94 | + * Create a neo.Group to group SpikeTrain across segments |
| 95 | + * Create a neo.Group to group Event across segments |
| 96 | + * Create a neo.Group to group Epoch across segments |
93 | 97 | With a dict the behavior can be controlled more finely |
94 | | - create_group_across_segment = { 'AnalogSignal': True, 'SpikeTrain': False, ...} |
95 | | -
|
96 | | - :param signal_group_mode: 'split-all' or 'group-by-same-units' (default depend IO): |
97 | | - This control behavior for grouping channels in AnalogSignal. |
98 | | - * 'split-all': each channel will give an AnalogSignal |
99 | | - * 'group-by-same-units' all channel sharing the same quantity units ar grouped in |
100 | | - a 2D AnalogSignal |
101 | | -
|
102 | | - :param load_waveforms: False by default. Control SpikeTrains.waveforms is None or not. |
| 98 | + * for example: create_group_across_segment = { 'AnalogSignal': True, 'SpikeTrain': False, ...} |
| 99 | + signal_group_mode: 'split-all' | 'group-by-same-units' | None, default: None |
| 100 | + This control behavior for grouping channels in AnalogSignal. |
| 101 | + * 'split-all': each channel will be give an AnalogSignal |
| 102 | + * 'group-by-same-units' all channel sharing the same quantity units are grouped in a 2D AnalogSignal |
| 103 | + By default None since the default is dependant on the IO |
| 104 | + load_waveforms: bool, default: False |
| 105 | + Determines whether SpikeTrains.waveforms is created |
| 106 | + |
| 107 | + Returns |
| 108 | + ------- |
| 109 | + bl: neo.core.Block |
| 110 | + The block of data |
103 | 111 |
|
104 | 112 | """ |
105 | 113 |
|
@@ -200,31 +208,40 @@ def read_segment( |
200 | 208 | strict_slicing=True, |
201 | 209 | ): |
202 | 210 | """ |
203 | | - :param block_index: int default 0. In case of several blocks block_index can be specified. |
204 | | -
|
205 | | - :param seg_index: int default 0. Index of segment. |
206 | | -
|
207 | | - :param lazy: False by default. |
208 | | -
|
209 | | - :param signal_group_mode: 'split-all' or 'group-by-same-units' (default depend IO): |
210 | | - This control behavior for grouping channels in AnalogSignal. |
211 | | - * 'split-all': each channel will give an AnalogSignal |
212 | | - * 'group-by-same-units' all channel sharing the same quantity units ar grouped in |
213 | | - a 2D AnalogSignal |
214 | | -
|
215 | | - :param load_waveforms: False by default. Control SpikeTrains.waveforms is None or not. |
216 | | -
|
217 | | - :param time_slice: None by default means no limit. |
218 | | - A time slice is (t_start, t_stop) both are quantities. |
219 | | - All object AnalogSignal, SpikeTrain, Event, Epoch will load only in the slice. |
220 | | -
|
221 | | - :param strict_slicing: True by default. |
222 | | - Control if an error is raised or not when t_start or t_stop |
223 | | - is outside the real time range of the segment. |
| 211 | + Reads one segment of the data file |
| 212 | +
|
| 213 | + Parameters |
| 214 | + ---------- |
| 215 | + block_index: int, default: 0 |
| 216 | + In the case of a multiblock dataset, this specifies which block to read |
| 217 | + seg_index: int, default: 0 |
| 218 | + In the case of a multisegment block, this specifies which segmeent to read |
| 219 | + lazy: bool, default: False |
| 220 | + Whether to lazily load the segment (True) or to load the segment into memory (False) |
| 221 | + signal_group_mode: 'split-all' | 'group-by-same-units' | None, default: None |
| 222 | + This control behavior for grouping channels in AnalogSignal. |
| 223 | + * 'split-all': each channel will be give an AnalogSignal |
| 224 | + * 'group-by-same-units' all channel sharing the same quantity units are grouped in a 2D AnalogSignal |
| 225 | + load_waveforms: bool, default: False |
| 226 | + Determines whether SpikeTrains.waveforms is created |
| 227 | + time_slice: tuple[quantity.Quantities | None] | None, default: None |
| 228 | + Whether to take a time slice of the data |
| 229 | + * None: indicates from beginning of the segment to the end of the segment |
| 230 | + * tuple: (t_start, t_stop) with t_start and t_stop being quantities in seconds |
| 231 | + * tuple: (None, t_stop) indicates the beginning of the segment to t_stop |
| 232 | + * tuple: (t_start, None) indicates from t_start to the end of the segment |
| 233 | + strict_slicing: bool, default: True |
| 234 | + Control if an error is raised or not when t_start or t_stop |
| 235 | + is outside of the real time range of the segment. |
| 236 | +
|
| 237 | + Returns |
| 238 | + ------- |
| 239 | + seg: neo.core.Segment |
| 240 | + Returns the desired segment based on the parameters given |
224 | 241 | """ |
225 | 242 |
|
226 | 243 | if lazy: |
227 | | - assert time_slice is None, "For lazy=True you must specify time_slice when LazyObject.load(time_slice=...)" |
| 244 | + assert time_slice is None, "For lazy=True you must specify a time_slice when LazyObject.load(time_slice=...)" |
228 | 245 |
|
229 | 246 | assert ( |
230 | 247 | not load_waveforms |
@@ -317,7 +334,7 @@ def get_sub_signal_streams(self, signal_group_mode="group-by-same-units"): |
317 | 334 |
|
318 | 335 | if len(all_units) == 1: |
319 | 336 | # no substream |
320 | | - # None iwill be transform as slice later |
| 337 | + # None iwill be transform as slice later |
321 | 338 | inner_stream_channels = None |
322 | 339 | name = stream_name |
323 | 340 | sub_stream = (stream_index, inner_stream_channels, name) |
|
0 commit comments