Skip to main content

Python wrapper for MED format

Project description

DHN-MED-Py

Python wrapper for MED format, GPL license 3.0. Commercial exceptions to GPL open source requirements may be negotiated with Dark Horse Neuro, Inc.

Multiscale Electrophysiology Data Format (MED) is an open source data format developed to manage big data in electrophysiology and facilitate data sharing.

The MED format is maintained by MEDFormat.org.

Installation

To install please use:

pip install dhn-med-py

Numpy is a required dependency.

Wrapper features

  • Opens all MED format data for reading directly into python environment.
  • Fully open-source (GPL license 3.0) for both C library code and python wrapper.
  • Samples are returned in NumPy arrays for easy and efficient processing.
  • Channel and session metadata are returned in python dictionaries.
  • Threaded file opening and channel reading for optimal performance.
  • Optional matrix (2D NumPy array) output for efficient processing/visualization.
  • Support for major platforms (MacOS, Linux, Windows).
  • Supported format in the Neo project.

Version History

1.1.2 - Fixed a potential mutex bug. General library updates.

1.1.1 - Bug fix in support of Neo project - fixed a crash that occurred in Linux when reading only records.

1.1.0 - General library changes and bug fixes. Support for parallel processing is integrated in C library but not fully integrated in python library. Multiple MedSession objects can now point to the same MED session.

1.0.0 - Initial release.

Sample Script

#!/usr/bin/env python3

import dhn_med_py
  
from dhn_med_py import MedSession

# open session
sess = MedSession("/Users/JohnDoe/Desktop/MED-test/RawData.medd", "password")

print("First channel name:", sess.session_info['channels'][0]['metadata']['channel_name'])
sampling_rate = sess.session_info['channels'][0]['metadata']['sampling_frequency']
print("Sampling rate of first channel:", sampling_rate)

# read first minute of data, in 1 second chunks
for y in range(0, 60):
    sess.read_by_index(sampling_rate * y, sampling_rate * (y+1))
    print(sess.data['channels'][0]['data'])

# read first minute of data, in 1 second chunks
# negative time means relative to beginning of session
for y in range(0, 60):
    sess.read_by_time(y * -1000000, (y+1) * -1000000)
    print(sess.data['channels'][0]['data'])
    
# read matrix of first 1 minute of data.
# Return 5000 samples of data per channel (matrix has 5000 columns)
# antialiasing will be applied when downsampling (default filter setting is 'antialias')
sess.get_matrix_by_time(0, -60 * 1000000, sample_count=5000)

# print number of samples in each channel of the resulting matrix
print(sess.matrix['sample_count'])

# print the resulting matrix samples (2D Numpy array)
print (sess.matrix['samples'])

# read matrix of first 1 minute of data
# Return a sampling frequency of 3000 Hz.
sess.get_matrix_by_time(0, -60 * 1000000, 3000)

# print resulting matrix
print (sess.matrix['samples'])

# Read entire dataset, with output sampling set to 1000 Hz
sess.get_matrix_by_time('start', 'end', 1000)

# Read first 25000 samples, using the channel "5k_0001" as the reference channel
# This means the first 5 seconds of the session (for all channels) will be read.
# The default output number of samples corresponds to the highest channel
# sampling frequency.
sess.set_reference_channel("5k_0001")
sess.get_matrix_by_index(0, 25000)

# helper function to set detrending (baseline correction) for future matrix calls
sess.set_detrend(True)

# helper function to set trace_ranges.  Matrix calls will return these
# as "minima" and "maxima" in the matrix result.
sess.set_trace_ranges(True)

# helper function to turn off filtering for future matrix calls
sess.set_filter("none")

# free session
del sess

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

dhn_med_py-1.1.2-cp311-cp311-win_amd64.whl (204.5 kB view details)

Uploaded CPython 3.11 Windows x86-64

dhn_med_py-1.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

dhn_med_py-1.1.2-cp311-cp311-macosx_12_0_arm64.whl (279.5 kB view details)

Uploaded CPython 3.11 macOS 12.0+ ARM64

dhn_med_py-1.1.2-cp311-cp311-macosx_10_9_x86_64.whl (303.8 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

dhn_med_py-1.1.2-cp310-cp310-win_amd64.whl (204.5 kB view details)

Uploaded CPython 3.10 Windows x86-64

dhn_med_py-1.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

dhn_med_py-1.1.2-cp310-cp310-macosx_12_0_arm64.whl (279.4 kB view details)

Uploaded CPython 3.10 macOS 12.0+ ARM64

dhn_med_py-1.1.2-cp310-cp310-macosx_10_9_x86_64.whl (303.8 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

dhn_med_py-1.1.2-cp39-cp39-win_amd64.whl (238.5 kB view details)

Uploaded CPython 3.9 Windows x86-64

dhn_med_py-1.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

dhn_med_py-1.1.2-cp39-cp39-macosx_12_0_arm64.whl (279.4 kB view details)

Uploaded CPython 3.9 macOS 12.0+ ARM64

dhn_med_py-1.1.2-cp39-cp39-macosx_10_9_x86_64.whl (303.8 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

dhn_med_py-1.1.2-cp38-cp38-win_amd64.whl (238.4 kB view details)

Uploaded CPython 3.8 Windows x86-64

dhn_med_py-1.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

dhn_med_py-1.1.2-cp38-cp38-macosx_12_0_arm64.whl (279.5 kB view details)

Uploaded CPython 3.8 macOS 12.0+ ARM64

dhn_med_py-1.1.2-cp38-cp38-macosx_10_9_x86_64.whl (303.8 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

dhn_med_py-1.1.2-cp37-cp37m-win_amd64.whl (238.4 kB view details)

Uploaded CPython 3.7m Windows x86-64

dhn_med_py-1.1.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

dhn_med_py-1.1.2-cp37-cp37m-macosx_12_0_arm64.whl (279.4 kB view details)

Uploaded CPython 3.7m macOS 12.0+ ARM64

dhn_med_py-1.1.2-cp37-cp37m-macosx_10_9_x86_64.whl (303.6 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

Details for the file dhn_med_py-1.1.2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4b255768e2809a22e41d1aa9254f9b37fea9384aa1bb2d5fd5ed00215c6cb41d
MD5 4d43daad60f3280d9f91f7f1d4c8aefc
BLAKE2b-256 b74c738684b07434efae392e3c974c9accb3643c2ed23a250d6ba15220a94528

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 058ff097095c190822c38ad6f90e915e094a7a9b70d834a4bf249408181ef136
MD5 d85d6044ab29b66aedf4a3aff12a985c
BLAKE2b-256 a653978b9b4565ec355274fcdf01b578c16a980c29c8a3b922e34acfb8c8b1f2

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.2-cp311-cp311-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp311-cp311-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 cba4cfd27df2dc2e596fd65f03a26c3ee21f55fe0ff8c1f9556018a494dcf4c0
MD5 cd52e2de56c7c05f65bcf3c7437fa232
BLAKE2b-256 a416e0dae72e835fb75c11f88acae48ad3d30d1ff16d6a58a15399228331ed5e

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.2-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 88f1005d2c126b22dbdb92545298d57fe43500615b0939c1532a9b25248441ea
MD5 ba3ac3857b9867a56c2dad870e9d1407
BLAKE2b-256 77faedd7e5dbe93f4c2885bad6e21bb126bb5ae0b7cfbf615b2651e8d1646708

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.2-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 24f4378c8e94607bbe087bd6505573b58025455006c21881dea9650d74dfb885
MD5 8d2a28185d656419de09e63a211577f1
BLAKE2b-256 f70c81872c9c23c761f7fdd1e7e408e60630fea521f6a14e6a65830a5d527f2c

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 300aca447e62f1ccce28dbda7cdc9141a31be070e2c49de29ae21a03f0ca1e16
MD5 a0b8df2e051bbc4ec3061eddf48e162f
BLAKE2b-256 e3c1de3929fc4e217f8bcffba359e0a2a42117a4d8bb750ad5dd1cba8f1ac9df

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.2-cp310-cp310-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 154322dd5098d480b4eea3135cb00d78947b3c04b33d2eb5afebe6ab4ecf15fa
MD5 7eaf91c2b56caa69ea44c5c35605037b
BLAKE2b-256 3d2cb0b1ee7f4c23b2b18006380dc617a243e41648d78a4ecba82972291d3661

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.2-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 94c62eeb380c2528d1f20483bd3b92ba4d4561aad4b4d26e84ce69e7040c859b
MD5 d990f4504d8ad81a18ff8f9f3bc6d659
BLAKE2b-256 2028d45b729cea241cb83b9e3c89643d89076148642f711410504628bdd0a609

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.2-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 134c1fd2a323c55eca927f3c7d4cc8dbd4689a0bef69ae2c938bc6e2762d72ee
MD5 4902f6f31635d4233ba66d7b13288c46
BLAKE2b-256 14252c85862883df2bee485e4a65ab8500e126be9899255e1cae3822b9c870d1

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cdf17ea00fd0eb755b39934ecb107e41e65c1356035055ebc55dcfde7058bea2
MD5 2d9a48bcce1088e5390a5962a84ee309
BLAKE2b-256 37f6fc74221f2620e35e71d4e6312d2be2d36284c5ad7c34af4e0da7d527adfd

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.2-cp39-cp39-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp39-cp39-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 28ff6e3e059b902196c2de496288d6d1e572c00bde48eb5f2425a4cd63a62803
MD5 8ba466fa4e69074304e4b7d27a8264df
BLAKE2b-256 fe8a766d498da04a5d07a91ea12360d3ed768049e111e24d4d80f5fc4856bdc2

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.2-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7b90fc93ba9beda4bc7bbfe9d2be2c1e1ea4d1eaada85e6be4f53c77ee83a183
MD5 819f7fcdb969d418e030acbda41eaebc
BLAKE2b-256 e2ac6913b5a5ee8e4fc397973d62cbc55cdbb39333b86c2777800a5682a02e31

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.2-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 2eae1cf523e3a2fcf7ead066861cd1f59b9f91f9ee53dae8c6db4459ecaf4f07
MD5 9f6eea9652f2a179ea7a458fa5990a8a
BLAKE2b-256 92f85713ebbd0b58cab0bb28003c0902fefe349391658931a7a48e60ede6bc8d

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ce5170f6fa0201eda7ae0728f39efa3954920628728b45f62025380022687d24
MD5 e290bf1d828eb51ff47d25d9e5df5dee
BLAKE2b-256 f26dee774d2e9d219747e8ba0099e4b87d35d79c54bb15070e9b449eaa17149b

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.2-cp38-cp38-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp38-cp38-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 f1e55e1ef712e73ca873ae2094b8a5d15b8096c631634d0704284e415becfeeb
MD5 3ec11e3fc50ca5058506e0d64c5bc054
BLAKE2b-256 8dbc8a5aadc09a89d53aac410365e5e34f3c5d2b1938faa24e3740f9316074d3

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.2-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8f42bb92662ab35a8f4b5f8c185394abc7bb57644cca46836f43bfafc7ff948d
MD5 4ead49b62e347cb7b4d01acd8f886893
BLAKE2b-256 5df145bc12508cc83a39f1790ec5d213164d20b27ff66446cd9539278a279ea1

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.2-cp37-cp37m-win_amd64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 44637dc6288beab1af3e5cc84be8bdd3ba87f93dcd5f72103a750a0dbc35384b
MD5 0396ff4c4765cf881849522c7c3ecf2c
BLAKE2b-256 9a15d9d67c096c0056c704cfeffdf06c79d82f2843f120cf6f27fda4d0b73f07

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a01546672c3c710a6c9b9dcca83ad54e5810a889be5724714dccb1b007bef517
MD5 a310624d467f655a015c29f0b78f5e6a
BLAKE2b-256 260f904e5606d00677623c98b74ea02863f9a69ea7a4d775582e3085b74dad20

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.2-cp37-cp37m-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp37-cp37m-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 975eedf70ec1e5fffe4e5ed424eed2a3f94e1aed18786662e753a6b106dfe749
MD5 0faec2a78357764ba8590ecbaac158d4
BLAKE2b-256 f73113baba123cf74fadabcfe928936948a5419334e13521a1018e09b56518e7

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.2-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 24cde75f88e4e85718e4151dbb3c1b95fd39f141551a1c73d619d7e28a088895
MD5 4c626feae0b83706924e92c9ec6b9c74
BLAKE2b-256 612fe7004eb63067f04899be80e512befe76f8a67d206f4ab8ca3d09898eaf8e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page