Skip to content

Commit

Permalink
Merge pull request #1 from JuliaSprenger/lkoelman-lkmn-dev
Browse files Browse the repository at this point in the history
add test for single spike in matlabio
  • Loading branch information
lkoelman authored Jun 21, 2018
2 parents 6b04545 + c33ab1c commit 9086e22
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions neo/test/iotest/test_neomatlabio.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import unittest

import quantities as pq
from neo import Block, Segment, SpikeTrain
from neo.test.iotest.common_io_test import BaseTestIO
from neo.io.neomatlabio import NeoMatlabIO, HAVE_SCIPY

Expand All @@ -19,5 +21,25 @@ class TestNeoMatlabIO(BaseTestIO, unittest.TestCase):
files_to_download = []


def test_write_read_single_spike(self):
block1 = Block()
seg = Segment('segment1')
spiketrain = SpikeTrain([1]*pq.s, t_stop=10*pq.s, sampling_rate=1*pq.Hz)
block1.segments.append(seg)
seg.spiketrains.append(spiketrain)

# write block
filename = BaseTestIO.get_filename_path(self, 'matlabiotestfile.mat')
io1 = self.ioclass(filename)
io1.write_block(block1)

# read block
io2 = self.ioclass(filename)
block2 = io2.read_block()

self.assertEqual(block1.segments[0].spiketrains[0],
block2.segments[0].spiketrains[0])


if __name__ == "__main__":
unittest.main()

0 comments on commit 9086e22

Please sign in to comment.