test_neuroexplorerio.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. """
  2. Tests of neo.io.neuroexplorerio
  3. """
  4. import unittest
  5. from neo.io import NeuroExplorerIO
  6. from neo.test.iotest.common_io_test import BaseTestIO
  7. from neo.test.iotest.tools import get_test_file_full_path
  8. class TestNeuroExplorerIO(BaseTestIO, unittest.TestCase, ):
  9. ioclass = NeuroExplorerIO
  10. _prefered_signal_group_mode = 'split-all'
  11. files_to_test = ['File_neuroexplorer_1.nex',
  12. 'File_neuroexplorer_2.nex',
  13. ]
  14. files_to_download = files_to_test
  15. def test_signal_group_mode(self):
  16. filename = get_test_file_full_path(ioclass=NeuroExplorerIO,
  17. filename='File_neuroexplorer_1.nex',
  18. directory=self.local_test_dir,
  19. clean=False)
  20. # test that 2 signals are rendered with 2 sampling_rate
  21. for signal_group_mode in ('group-by-same-units', 'split-all'):
  22. reader = NeuroExplorerIO(filename=filename)
  23. bl = reader.read_block(signal_group_mode=signal_group_mode)
  24. seg = bl.segments[0]
  25. assert len(seg.analogsignals) == 2
  26. anasig0 = seg.analogsignals[0]
  27. anasig1 = seg.analogsignals[1]
  28. assert anasig0.sampling_rate != anasig1.sampling_rate
  29. assert anasig0.shape != anasig1.shape
  30. # ~ for anasig in seg.analogsignals:
  31. # ~ print(anasig.shape, anasig.sampling_rate)
  32. if __name__ == "__main__":
  33. unittest.main()