test_neuralynxrawio.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import unittest
  2. from neo.rawio.neuralynxrawio import NeuralynxRawIO
  3. from neo.test.rawiotest.common_rawio_test import BaseTestRawIO
  4. from neo.rawio.neuralynxrawio import NlxHeader
  5. import logging
  6. logging.getLogger().setLevel(logging.INFO)
  7. class TestNeuralynxRawIO(BaseTestRawIO, unittest.TestCase, ):
  8. rawioclass = NeuralynxRawIO
  9. entities_to_test = [
  10. # 'Cheetah_v4.0.2/original_data',
  11. 'Cheetah_v5.5.1/original_data',
  12. 'Cheetah_v5.6.3/original_data',
  13. 'Cheetah_v5.7.4/original_data',
  14. 'Cheetah_v6.3.2/incomplete_blocks']
  15. files_to_download = [
  16. 'Cheetah_v4.0.2/original_data/CSC14_trunc.Ncs',
  17. 'Cheetah_v5.5.1/original_data/CheetahLogFile.txt',
  18. 'Cheetah_v5.5.1/original_data/CheetahLostADRecords.txt',
  19. 'Cheetah_v5.5.1/original_data/Events.nev',
  20. 'Cheetah_v5.5.1/original_data/STet3a.nse',
  21. 'Cheetah_v5.5.1/original_data/STet3b.nse',
  22. 'Cheetah_v5.5.1/original_data/Tet3a.ncs',
  23. 'Cheetah_v5.5.1/original_data/Tet3b.ncs',
  24. 'Cheetah_v5.5.1/plain_data/STet3a.txt',
  25. 'Cheetah_v5.5.1/plain_data/STet3b.txt',
  26. 'Cheetah_v5.5.1/plain_data/Tet3a.txt',
  27. 'Cheetah_v5.5.1/plain_data/Tet3b.txt',
  28. 'Cheetah_v5.5.1/plain_data/Events.txt',
  29. 'Cheetah_v5.5.1/README.txt',
  30. 'Cheetah_v5.6.3/original_data/CheetahLogFile.txt',
  31. 'Cheetah_v5.6.3/original_data/CheetahLostADRecords.txt',
  32. 'Cheetah_v5.6.3/original_data/Events.nev',
  33. 'Cheetah_v5.6.3/original_data/CSC1.ncs',
  34. 'Cheetah_v5.6.3/original_data/CSC2.ncs',
  35. 'Cheetah_v5.6.3/original_data/TT1.ntt',
  36. 'Cheetah_v5.6.3/original_data/TT2.ntt',
  37. 'Cheetah_v5.6.3/original_data/VT1.nvt',
  38. 'Cheetah_v5.6.3/plain_data/Events.txt',
  39. 'Cheetah_v5.6.3/plain_data/CSC1.txt',
  40. 'Cheetah_v5.6.3/plain_data/CSC2.txt',
  41. 'Cheetah_v5.6.3/plain_data/TT1.txt',
  42. 'Cheetah_v5.6.3/plain_data/TT2.txt',
  43. 'Cheetah_v5.7.4/original_data/CSC1.ncs',
  44. 'Cheetah_v5.7.4/original_data/CSC2.ncs',
  45. 'Cheetah_v5.7.4/original_data/CSC3.ncs',
  46. 'Cheetah_v5.7.4/original_data/CSC4.ncs',
  47. 'Cheetah_v5.7.4/original_data/CSC5.ncs',
  48. 'Cheetah_v5.7.4/original_data/Events.nev',
  49. 'Cheetah_v5.7.4/plain_data/CSC1.txt',
  50. 'Cheetah_v5.7.4/plain_data/CSC2.txt',
  51. 'Cheetah_v5.7.4/plain_data/CSC3.txt',
  52. 'Cheetah_v5.7.4/plain_data/CSC4.txt',
  53. 'Cheetah_v5.7.4/plain_data/CSC5.txt',
  54. 'Cheetah_v5.7.4/plain_data/Events.txt',
  55. 'Cheetah_v5.7.4/README.txt',
  56. 'Cheetah_v6.3.2/incomplete_blocks/CSC1_reduced.ncs',
  57. 'Cheetah_v6.3.2/incomplete_blocks/Events.nev',
  58. 'Cheetah_v6.3.2/incomplete_blocks/README.txt']
  59. class TestNcsRecordingType(TestNeuralynxRawIO, unittest.TestCase):
  60. """
  61. Test of decoding of NlxHeader for type of recording.
  62. """
  63. ncsTypeTestFiles = [
  64. ('Cheetah_v4.0.2/original_data/CSC14_trunc.Ncs', 'PRE4'),
  65. ('Cheetah_v5.5.1/original_data/STet3a.nse', 'DIGITALLYNXSX'),
  66. ('Cheetah_v5.5.1/original_data/Tet3a.ncs', 'DIGITALLYNXSX'),
  67. ('Cheetah_v5.6.3/original_data/CSC1.ncs', 'DIGITALLYNXSX'),
  68. ('Cheetah_v5.6.3/original_data/TT1.ntt', 'DIGITALLYNXSX'),
  69. ('Cheetah_v5.7.4/original_data/CSC1.ncs', 'DIGITALLYNXSX'),
  70. ('Cheetah_v6.3.2/incomplete_blocks/CSC1_reduced.ncs', 'DIGITALLYNXSX')]
  71. def test_recording_types(self):
  72. for typeTest in self.ncsTypeTestFiles:
  73. filename = self.get_filename_path(typeTest[0])
  74. hdr = NlxHeader.build_for_file(filename)
  75. self.assertEqual(hdr.type_of_recording(), typeTest[1])
  76. if __name__ == "__main__":
  77. unittest.main()