Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MED wrapper #1288

Merged
merged 6 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -164,6 +165,10 @@
.. autoclass:: neo.io.MaxwellIO

.. autoattribute:: extensions

.. autoclass:: neo.io.MedIO

.. autoattribute:: extensions

.. autoclass:: neo.io.MicromedIO

Expand Down Expand Up @@ -308,6 +313,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
JuliaSprenger marked this conversation as resolved.
Show resolved Hide resolved
from neo.io.micromedio import MicromedIO
from neo.io.neomatlabio import NeoMatlabIO
from neo.io.nestio import NestIO
Expand Down Expand Up @@ -360,6 +366,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 @@ -92,6 +93,10 @@

.. autoattribute:: extensions

.. autoclass:: neo.rawio.MedRawIO

.. autoattribute:: extensions

.. autoclass:: neo.rawio.MEArecRawIO

.. autoattribute:: extensions
Expand Down Expand Up @@ -181,6 +186,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 @@ -214,6 +220,7 @@
MicromedRawIO,
MaxwellRawIO,
MEArecRawIO,
MedRawIO,
NeuralynxRawIO,
NeuroExplorerRawIO,
NeuroScopeRawIO,
Expand Down
Loading