Skip to content

Commit 071efb1

Browse files
Merge pull request #1288 from dancrepeau/master
Add MED wrapper
2 parents 20c0fec + c2ab6cf commit 071efb1

File tree

7 files changed

+787
-2
lines changed

7 files changed

+787
-2
lines changed

neo/io/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
* :attr:`KlustaKwikIO`
4040
* :attr:`KwikIO`
4141
* :attr:`MaxwellIO`
42+
* :attr:`MedIO`
4243
* :attr:`MicromedIO`
4344
* :attr:`NeoMatlabIO`
4445
* :attr:`NestIO`
@@ -165,6 +166,10 @@
165166
.. autoclass:: neo.io.MaxwellIO
166167
167168
.. autoattribute:: extensions
169+
170+
.. autoclass:: neo.io.MedIO
171+
172+
.. autoattribute:: extensions
168173
169174
.. autoclass:: neo.io.MicromedIO
170175
@@ -313,6 +318,7 @@
313318
from neo.io.kwikio import KwikIO
314319
from neo.io.mearecio import MEArecIO
315320
from neo.io.maxwellio import MaxwellIO
321+
from neo.io.medio import MedIO
316322
from neo.io.micromedio import MicromedIO
317323
from neo.io.neomatlabio import NeoMatlabIO
318324
from neo.io.nestio import NestIO
@@ -366,6 +372,7 @@
366372
KwikIO,
367373
MEArecIO,
368374
MaxwellIO,
375+
MedIO,
369376
MicromedIO,
370377
NixIO,
371378
NixIOFr,

neo/io/medio.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
"""
2+
IO for reading MED datasets using dhn-med-py library.
3+
4+
dhn-med-py
5+
https://medformat.org
6+
https://pypi.org/project/dhn-med-py/
7+
8+
MED Format Specifications: https://medformat.org
9+
10+
Author: Dan Crepeau, Matt Stead
11+
"""
12+
13+
from neo.io.basefromrawio import BaseFromRaw
14+
from neo.rawio.medrawio import MedRawIO
15+
16+
17+
class MedIO(MedRawIO, BaseFromRaw):
18+
"""
19+
IO for reading MED datasets.
20+
"""
21+
name = 'MED IO'
22+
description = "IO for reading MED datasets"
23+
24+
_prefered_signal_group_mode = 'group-by-same-units'
25+
mode = 'dir'
26+
27+
def __init__(self, dirname=None, password=None, keep_original_times=False):
28+
MedRawIO.__init__(self, dirname=dirname, password=password,
29+
keep_original_times=keep_original_times)
30+
"""
31+
Initialise IO instance
32+
33+
Parameters
34+
----------
35+
dirname : str
36+
Directory containing data files
37+
password : str
38+
MED sessions can be optionally encrypted with a password.
39+
Default: None
40+
keep_original_times : bool
41+
Preserve original time stamps as in data files. By default datasets are
42+
shifted to begin at t_start = 0. When set to True, timestamps will be
43+
returned as UTC (seconds since midnight 1 Jan 1970).
44+
Default: False
45+
"""
46+
BaseFromRaw.__init__(self, dirname)
47+
48+
def close(self):
49+
MedRawIO.close(self)
50+
51+
def __del__(self):
52+
MedRawIO.__del__(self)

neo/rawio/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* :attr:`ElanRawIO`
2525
* :attr:`IntanRawIO`
2626
* :attr:`MaxwellRawIO`
27+
* :attr:`MedRawIO`
2728
* :attr:`MEArecRawIO`
2829
* :attr:`MicromedRawIO`
2930
* :attr:`NeuralynxRawIO`
@@ -93,6 +94,10 @@
9394
9495
.. autoattribute:: extensions
9596
97+
.. autoclass:: neo.rawio.MedRawIO
98+
99+
.. autoattribute:: extensions
100+
96101
.. autoclass:: neo.rawio.MEArecRawIO
97102
98103
.. autoattribute:: extensions
@@ -186,6 +191,7 @@
186191
from neo.rawio.intanrawio import IntanRawIO
187192
from neo.rawio.maxwellrawio import MaxwellRawIO
188193
from neo.rawio.mearecrawio import MEArecRawIO
194+
from neo.rawio.medrawio import MedRawIO
189195
from neo.rawio.micromedrawio import MicromedRawIO
190196
from neo.rawio.neuralynxrawio import NeuralynxRawIO
191197
from neo.rawio.neuroexplorerrawio import NeuroExplorerRawIO
@@ -220,6 +226,7 @@
220226
MicromedRawIO,
221227
MaxwellRawIO,
222228
MEArecRawIO,
229+
MedRawIO,
223230
NeuralynxRawIO,
224231
NeuroExplorerRawIO,
225232
NeuroScopeRawIO,

0 commit comments

Comments
 (0)