|
22 | 22 |
|
23 | 23 |
|
24 | 24 | from neo.io.baseio import BaseIO |
25 | | -from neo.core import (Block, Segment, AnalogSignal, IrregularlySampledSignal, |
26 | | - Event, Epoch, SpikeTrain, objectnames, class_by_name) |
| 25 | +from neo.core import (Block, Segment, AnalogSignal, |
| 26 | + IrregularlySampledSignal, Event, |
| 27 | + Epoch, SpikeTrain, |
| 28 | + Group, ImageSequence, |
| 29 | + objectnames, class_by_name) |
27 | 30 |
|
28 | 31 | classname_lower_to_upper = {} |
29 | 32 | for k in objectnames: |
@@ -176,7 +179,7 @@ class NeoMatlabIO(BaseIO): |
176 | 179 | is_writable = True |
177 | 180 |
|
178 | 181 | supported_objects = [Block, Segment, AnalogSignal, IrregularlySampledSignal, |
179 | | - Epoch, Event, SpikeTrain] |
| 182 | + Epoch, Event, SpikeTrain, Group, ImageSequence] |
180 | 183 | readable_objects = [Block] |
181 | 184 | writeable_objects = [Block] |
182 | 185 |
|
@@ -213,7 +216,7 @@ def read_block(self, lazy=False): |
213 | 216 |
|
214 | 217 | """ |
215 | 218 | import scipy.io |
216 | | - assert not lazy, 'Do not support lazy' |
| 219 | + assert not lazy, 'Does not support lazy' |
217 | 220 |
|
218 | 221 | d = scipy.io.loadmat(self.filename, struct_as_record=False, |
219 | 222 | squeeze_me=True, mat_dtype=True) |
@@ -259,6 +262,14 @@ def write_block(self, bl, **kargs): |
259 | 262 | sptr_struct = self.create_struct_from_obj(sptr) |
260 | 263 | seg_struct['spiketrains'].append(sptr_struct) |
261 | 264 |
|
| 265 | + for image_sq in seg.imagesequences: |
| 266 | + image_sq_structure = self.create_struct_from_obj(image_sq) |
| 267 | + seg_struct['imagesequences'].append(image_sq_structure) |
| 268 | + |
| 269 | + for group in bl.groups: |
| 270 | + group_structure = self.create_struct_from_obj(group) |
| 271 | + bl_struct['groups'].append(group_structure) |
| 272 | + |
262 | 273 | scipy.io.savemat(self.filename, {'block': bl_struct}, oned_as='row') |
263 | 274 |
|
264 | 275 | def create_struct_from_obj(self, ob): |
@@ -343,6 +354,11 @@ def create_ob_from_struct(self, struct, classname): |
343 | 354 | data_complement["t_start"] = arr.min() |
344 | 355 | else: |
345 | 356 | data_complement["t_start"] = 0.0 |
| 357 | + if "spatial_scale" in (at[0] for at in cl._necessary_attrs): |
| 358 | + if len(arr) > 0: |
| 359 | + data_complement["spatial_scale"] = arr |
| 360 | + else: |
| 361 | + pass # |
346 | 362 |
|
347 | 363 | if "times" in (at[0] for at in cl._necessary_attrs) and quantity_attr != "times": |
348 | 364 | # handle IrregularlySampledSignal |
|
0 commit comments