Skip to content

Commit

Permalink
Merge pull request #1288 from dancrepeau/master
Browse files Browse the repository at this point in the history
Add MED wrapper
  • Loading branch information
JuliaSprenger authored Jul 27, 2023
2 parents 20c0fec + c2ab6cf commit 071efb1
Show file tree
Hide file tree
Showing 7 changed files with 787 additions and 2 deletions.
7 changes: 7 additions & 0 deletions neo/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
* :attr:`KlustaKwikIO`
* :attr:`KwikIO`
* :attr:`MaxwellIO`
* :attr:`MedIO`
* :attr:`MicromedIO`
* :attr:`NeoMatlabIO`
* :attr:`NestIO`
Expand Down Expand Up @@ -165,6 +166,10 @@
.. autoclass:: neo.io.MaxwellIO
.. autoattribute:: extensions
.. autoclass:: neo.io.MedIO
.. autoattribute:: extensions
.. autoclass:: neo.io.MicromedIO
Expand Down Expand Up @@ -313,6 +318,7 @@
from neo.io.kwikio import KwikIO
from neo.io.mearecio import MEArecIO
from neo.io.maxwellio import MaxwellIO
from neo.io.medio import MedIO
from neo.io.micromedio import MicromedIO
from neo.io.neomatlabio import NeoMatlabIO
from neo.io.nestio import NestIO
Expand Down Expand Up @@ -366,6 +372,7 @@
KwikIO,
MEArecIO,
MaxwellIO,
MedIO,
MicromedIO,
NixIO,
NixIOFr,
Expand Down
52 changes: 52 additions & 0 deletions neo/io/medio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""
IO for reading MED datasets using dhn-med-py library.
dhn-med-py
https://medformat.org
https://pypi.org/project/dhn-med-py/
MED Format Specifications: https://medformat.org
Author: Dan Crepeau, Matt Stead
"""

from neo.io.basefromrawio import BaseFromRaw
from neo.rawio.medrawio import MedRawIO


class MedIO(MedRawIO, BaseFromRaw):
"""
IO for reading MED datasets.
"""
name = 'MED IO'
description = "IO for reading MED datasets"

_prefered_signal_group_mode = 'group-by-same-units'
mode = 'dir'

def __init__(self, dirname=None, password=None, keep_original_times=False):
MedRawIO.__init__(self, dirname=dirname, password=password,
keep_original_times=keep_original_times)
"""
Initialise IO instance
Parameters
----------
dirname : str
Directory containing data files
password : str
MED sessions can be optionally encrypted with a password.
Default: None
keep_original_times : bool
Preserve original time stamps as in data files. By default datasets are
shifted to begin at t_start = 0. When set to True, timestamps will be
returned as UTC (seconds since midnight 1 Jan 1970).
Default: False
"""
BaseFromRaw.__init__(self, dirname)

def close(self):
MedRawIO.close(self)

def __del__(self):
MedRawIO.__del__(self)
7 changes: 7 additions & 0 deletions neo/rawio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* :attr:`ElanRawIO`
* :attr:`IntanRawIO`
* :attr:`MaxwellRawIO`
* :attr:`MedRawIO`
* :attr:`MEArecRawIO`
* :attr:`MicromedRawIO`
* :attr:`NeuralynxRawIO`
Expand Down Expand Up @@ -93,6 +94,10 @@
.. autoattribute:: extensions
.. autoclass:: neo.rawio.MedRawIO
.. autoattribute:: extensions
.. autoclass:: neo.rawio.MEArecRawIO
.. autoattribute:: extensions
Expand Down Expand Up @@ -186,6 +191,7 @@
from neo.rawio.intanrawio import IntanRawIO
from neo.rawio.maxwellrawio import MaxwellRawIO
from neo.rawio.mearecrawio import MEArecRawIO
from neo.rawio.medrawio import MedRawIO
from neo.rawio.micromedrawio import MicromedRawIO
from neo.rawio.neuralynxrawio import NeuralynxRawIO
from neo.rawio.neuroexplorerrawio import NeuroExplorerRawIO
Expand Down Expand Up @@ -220,6 +226,7 @@
MicromedRawIO,
MaxwellRawIO,
MEArecRawIO,
MedRawIO,
NeuralynxRawIO,
NeuroExplorerRawIO,
NeuroScopeRawIO,
Expand Down
Loading

0 comments on commit 071efb1

Please sign in to comment.