Skip to content

Commit d41dba1

Browse files
author
sprenger
committed
[MLIO] add main MLIO
1 parent ae719dd commit d41dba1

3 files changed

Lines changed: 60 additions & 0 deletions

File tree

neo/io/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
* :attr:`KwikIO`
3838
* :attr:`MaxwellIO`
3939
* :attr:`MicromedIO`
40+
* :attr:`MonkeyLogicIO`
4041
* :attr:`NeoMatlabIO`
4142
* :attr:`NestIO`
4243
* :attr:`NeuralynxIO`
@@ -158,6 +159,10 @@
158159
159160
.. autoattribute:: extensions
160161
162+
.. autoclass:: neo.io.MonkeyLogicIO
163+
164+
.. autoattribute:: extensions
165+
161166
.. autoclass:: neo.io.NeoMatlabIO
162167
163168
.. autoattribute:: extensions
@@ -295,6 +300,7 @@
295300
from neo.io.mearecio import MEArecIO
296301
from neo.io.maxwellio import MaxwellIO
297302
from neo.io.micromedio import MicromedIO
303+
from neo.io.monkeylogicio import MonkeyLogicIO
298304
from neo.io.neomatlabio import NeoMatlabIO
299305
from neo.io.nestio import NestIO
300306
from neo.io.neuralynxio import NeuralynxIO
@@ -345,6 +351,7 @@
345351
MEArecIO,
346352
MaxwellIO,
347353
MicromedIO,
354+
MonkeyLogicIO,
348355
NixIO, # place NixIO before other IOs that use HDF5 to make it the default for .h5 files
349356
NeoMatlabIO,
350357
NestIO,

neo/io/monkeylogicio.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from neo.io.basefromrawio import BaseFromRaw
2+
from neo.rawio.monkeylogicrawio import MonkeyLogicRawIO
3+
4+
5+
class MonkeyLogicIO(MonkeyLogicRawIO, BaseFromRaw):
6+
7+
name = 'MonkeyLogicIO'
8+
9+
_prefered_signal_group_mode = 'group-by-same-units'
10+
_prefered_units_group_mode = 'all-in-one'
11+
12+
def __init__(self, filename):
13+
MonkeyLogicRawIO.__init__(self, filename)
14+
BaseFromRaw.__init__(self, filename)
15+
16+
def __enter__(self):
17+
return self
18+
19+
def __exit__(self, *args):
20+
self.header = None
21+
self.file.close()
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
Tests of neo.io.monkeylogicio
3+
"""
4+
5+
import unittest
6+
7+
from neo.io import MonkeyLogicIO
8+
from neo.test.iotest.common_io_test import BaseTestIO
9+
10+
# class TestMonkeyLogicIO(BaseTestIO, unittest.TestCase):
11+
# entities_to_download = [
12+
# 'monkeylogic'
13+
# ]
14+
# entities_to_test = [
15+
# 'monkeylogic/mearec_test_10s.h5'
16+
# ]
17+
# ioclass = MonkeyLogicIO
18+
19+
20+
class TestMonkeyLogicIO(unittest.TestCase):
21+
# TODO: Adjust this once ML files are on GIN
22+
23+
def test_read(self):
24+
filename = '/home/sprengerj/projects/monkey_logic/210909_TSCM_5cj_5cl_Riesling.bhv2'
25+
filename = '/home/sprengerj/projects/monkey_logic/sabrina/210810__learndms_userloop.bhv2'
26+
# filename = '/home/sprengerj/projects/monkey_logic/sabrina/210916__learndms_userloop.bhv2'
27+
# filename = '/home/sprengerj/projects/monkey_logic/sabrina/210917__learndms_userloop.bhv2'
28+
io = MonkeyLogicIO(filename)
29+
io.read_block()
30+
31+
if __name__ == "__main__":
32+
unittest.main()

0 commit comments

Comments
 (0)