test_axonio.py 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. """
  2. Tests of neo.io.axonio
  3. """
  4. import unittest
  5. from neo.io import AxonIO
  6. from neo.test.iotest.common_io_test import BaseTestIO
  7. class TestAxonIO(BaseTestIO, unittest.TestCase):
  8. files_to_test = [
  9. 'File_axon_1.abf',
  10. 'File_axon_2.abf',
  11. 'File_axon_3.abf',
  12. 'File_axon_4.abf',
  13. 'File_axon_5.abf',
  14. 'File_axon_6.abf',
  15. 'File_axon_7.abf',
  16. 'test_file_edr3.abf',
  17. ]
  18. files_to_download = files_to_test
  19. ioclass = AxonIO
  20. def test_annotations(self):
  21. reader = AxonIO(filename=self.get_filename_path('File_axon_2.abf'))
  22. bl = reader.read_block()
  23. ev = bl.segments[0].events[0]
  24. assert 'comments' in ev.annotations
  25. def test_read_protocol(self):
  26. for f in self.files_to_test:
  27. filename = self.get_filename_path(f)
  28. reader = AxonIO(filename=filename)
  29. bl = reader.read_block(lazy=True)
  30. if bl.annotations['abf_version'] >= 2.:
  31. reader.read_protocol()
  32. if __name__ == "__main__":
  33. unittest.main()