diff --git a/neo/core/imagesequence.py b/neo/core/imagesequence.py index 44714649d..6461f2fdd 100644 --- a/neo/core/imagesequence.py +++ b/neo/core/imagesequence.py @@ -183,3 +183,12 @@ def _pp(line): "spatial_scale: {0}".format(self.spatial_scale)]: _pp(line) + def _check_consistency(self, other): + ''' + Check if the attributes of another :class:`ImageSequence` + are compatible with this one. + ''' + if isinstance(other, ImageSequence): + for attr in ("sampling_rate", "spatial_scale"): + if getattr(self, attr) != getattr(other, attr): + raise ValueError("Inconsistent values of %s" % attr) diff --git a/neo/io/baseio.py b/neo/io/baseio.py index a58dcecb5..ed29579ac 100644 --- a/neo/io/baseio.py +++ b/neo/io/baseio.py @@ -20,7 +20,7 @@ Epoch, Event, IrregularlySampledSignal, ChannelIndex, - Segment, SpikeTrain, Unit) + Segment, SpikeTrain, Unit, ImageSequence) read_error = "This type is not supported by this file format for reading" write_error = "This type is not supported by this file format for writing" @@ -157,6 +157,9 @@ def read_spiketrain(self, **kargs): def read_analogsignal(self, **kargs): assert (AnalogSignal in self.readable_objects), read_error + def read_imagesequence(self, **kargs): + assert (ImageSequence in self.readable_objects), read_error + def read_irregularlysampledsignal(self, **kargs): assert (IrregularlySampledSignal in self.readable_objects), read_error @@ -185,6 +188,9 @@ def write_spiketrain(self, sptr, **kargs): def write_analogsignal(self, anasig, **kargs): assert (AnalogSignal in self.writeable_objects), write_error + def write_imagesequence(self, imseq, **kargs): + assert (ImageSequence in self.writeable_objects), write_error + def write_irregularlysampledsignal(self, irsig, **kargs): assert (IrregularlySampledSignal in self.writeable_objects), write_error diff --git a/neo/io/blkio.py b/neo/io/blkio.py index b23790a74..f7e223249 100644 --- a/neo/io/blkio.py +++ b/neo/io/blkio.py @@ -274,6 +274,8 @@ def read_header(file_name): segment = Segment(file_origin=self.filename, description=("stim nb:"+str(stim))) segment.imagesequences = [image_sequence] segment.block = block + for key in header: + block.annotations[key] = header[key] block.segments.append(segment) print("returning block")