Skip to content

Commit

Permalink
modification based on review blkio and imagesequence
Browse files Browse the repository at this point in the history
  • Loading branch information
teogale committed Sep 19, 2019
1 parent 674546d commit 00be899
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
9 changes: 9 additions & 0 deletions neo/core/imagesequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
8 changes: 7 additions & 1 deletion neo/io/baseio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions neo/io/blkio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 00be899

Please sign in to comment.