@@ -59,7 +59,7 @@ you can replace :class:`MyFormatIO` by any implemented class, see :ref:`list_of_
5959Modes
6060======
6161
62- IO can be based on a single file, a directory containing files, or a database.
62+ An IO module can be based on a single file, a directory containing files, or a database.
6363This is described in the :attr: `mode ` attribute of the IO class.
6464
6565 >>> from neo.io import MyFormatIO
@@ -108,84 +108,81 @@ All IOs have a read() method that returns a list of :class:`Block` objects (repr
108108 >>> print bl[0].segments[0]
109109 neo.core.Segment
110110
111-
111+
112112Read a time slice of Segment
113113============================
114114
115- Some object support ``time_slice `` arguments in ``read_segment() ``.
116- This is usefull to read only a subset of a dataset clipped in time.
115+ Some objects support the ``time_slice `` argument in ``read_segment() ``.
116+ This is useful to read only a subset of a dataset clipped in time.
117117By default ``time_slice=None `` meaning load eveything.
118118
119- This read everything::
119+ This reads everything::
120120
121- seg = reader.load_segment(time_slice=None)
122- shape0 = seg.analogsignals[0].shape # total shape
123- shape1 = seg.spiketrains[0].shape # total shape
121+ seg = reader.read_segment(time_slice=None)
124122
125-
126- This read only the first 5 seconds::
123+ This reads only the first 5 seconds::
127124
128- seg = reader.load_segment(time_slice=(0*pq.s, 5.*pq.s))
129- shape0 = seg.analogsignals[0].shape # more small shape
130- shape1 = seg.spiketrains[0].shape # more small shape
125+ seg = reader.read_segment(time_slice=(0*pq.s, 5.*pq.s))
131126
132127
133- Lazy option and proxy object
134- ============================
128+ .. _section-lazy :
129+
130+ Lazy option and proxy objects
131+ =============================
135132
136133In some cases you may not want to load everything in memory because it could be too big.
137- For this scenario, some IOs implement ``lazy=True/False ``.
138- Since neo 0.7, a new lazy sytem have been added for some IOs (all IOs that inherits rawio).
134+ For this scenario, some IOs implement ``lazy=True/False ``.
135+ Since neo 0.7, a new lazy sytem have been added for some IO modules (all IO classes that inherit from rawio).
139136To know if a class supports lazy mode use ``ClassIO.support_lazy ``.
140137
141- With ``lazy=True `` all data object (AnalogSignal/SpikeTrain/Event/Epoch) are replace by
142- ProxyObjects (AnalogSignalProxy/SpikeTrainProxy/EventProxy/EpochProxy).
143-
138+ With ``lazy=True `` all data objects (AnalogSignal/SpikeTrain/Event/Epoch) are replaced by
139+ proxy objects (AnalogSignalProxy/SpikeTrainProxy/EventProxy/EpochProxy).
144140
145141By default (if not specified), ``lazy=False ``, i.e. all data is loaded.
146142
147- Theses ProxyObjects contain metadata (name, sampling_rate, id, ...) so they can be inspected
143+ These proxy objects contain metadata (name, sampling_rate, id, ...) so they can be inspected
148144but they do not contain any array-like data.
149- All ProxyObjects contain a ``load() `` method to postpone the real load of array like data.
145+ All proxy objects contain a ``load() `` method to postpone the real load of array like data.
150146
151- Further more the ``load() `` method have a ``time_slice `` arguments to load only a slice
152- from the file. So the consumption of memory can be finely controlled.
147+ Further more the ``load() `` method has a ``time_slice `` argument to load only a slice
148+ from the file. In this way the consumption of memory can be finely controlled.
153149
154150
155- Here 2 examples that do read a dataset, load triggers a do trigger averaging on signals.
151+ Here are two examples that read a dataset, extract sections of the signal based on recorded events,
152+ and averages the sections.
156153
157- The first example is without lazy, so it consume more memory::
158-
159- lim0, lim1 = -500* pq.ms, +1500* pq.ms
154+ The first example is without lazy mode , so it consumes more memory::
155+
156+ lim0, lim1 = -500 * pq.ms, +1500 * pq.ms
160157 seg = reader.read_segment(lazy=False)
161158 triggers = seg.events[0]
162- anasig = seg.analogsignals[0] # here anasig contain the whole recording in memory
159+ sig = seg.analogsignals[0] # here sig contain the whole recording in memory
163160 all_sig_chunks = []
164161 for t in triggers.times:
165162 t0, t1 = (t + lim0), (t + lim1)
166- anasig_chunk = anasig .time_slice(t0, t1)
167- all_sig_chunks.append(anasig_chunk )
163+ sig_chunk = sig .time_slice(t0, t1)
164+ all_sig_chunks.append(sig_chunk )
168165 apply_my_fancy_average(all_sig_chunks)
169-
170- The second example use lazy so it consume fewer memory::
166+
167+ The second example uses lazy mode, so it consumes less memory::
171168
172169 lim0, lim1 = -500*pq.ms, +1500*pq.ms
173170 seg = reader.read_segment(lazy=True)
174- triggers = seg.events[0].load(time_slice=None) # this load all trigers in memory
175- anasigproxy = seg.analogsignals[0] # this is a proxy
171+ triggers = seg.events[0].load(time_slice=None) # this loads all triggers in memory
172+ sigproxy = seg.analogsignals[0] # this is a proxy
176173 all_sig_chunks = []
177174 for t in triggers.times:
178175 t0, t1 = (t + lim0), (t + lim1)
179- anasig_chunk = anasigproxy .load(time_slice=(t0, t1)) # here real data are loaded
180- all_sig_chunks.append(anasig_chunk )
176+ sig_chunk = sigproxy .load(time_slice=(t0, t1)) # here real data are loaded
177+ all_sig_chunks.append(sig_chunk )
181178 apply_my_fancy_average(all_sig_chunks)
182179
183- In addition to ``time_slice `` AnalogSignalProxy contains ``channel_indexes `` arguments .
184- This control also slicing in channel . This is usefull in case the channel count is very high.
180+ In addition to ``time_slice ``, AnalogSignalProxy supports the ``channel_indexes `` argument .
181+ This allows loading only a subset of channels . This is useful where the channel count is very high.
185182
186183 .. TODO: add something about magnitude mode when implemented for all objects.
187184
188- In this example, we read only 3 selected channels::
185+ In this example, we read only three selected channels::
189186
190187 seg = reader.read_segment(lazy=True)
191188 anasig = seg.analogsignals[0].load(time_slice=None, channel_indexes=[0, 2, 18])
0 commit comments