Skip to main content

DHN-MED-Py is a wrapper library for Multiscale Electrophysiology Data Format developed by Matt Stead.

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.

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-2.0.6-cp312-cp312-win_amd64.whl (232.5 kB view details)

Uploaded CPython 3.12 Windows x86-64

dhn_med_py-2.0.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

dhn_med_py-2.0.6-cp312-cp312-macosx_11_0_arm64.whl (350.3 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

dhn_med_py-2.0.6-cp312-cp312-macosx_10_13_x86_64.whl (393.8 kB view details)

Uploaded CPython 3.12 macOS 10.13+ x86-64

dhn_med_py-2.0.6-cp311-cp311-win_amd64.whl (232.5 kB view details)

Uploaded CPython 3.11 Windows x86-64

dhn_med_py-2.0.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

dhn_med_py-2.0.6-cp311-cp311-macosx_11_0_arm64.whl (350.3 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

dhn_med_py-2.0.6-cp311-cp311-macosx_10_9_x86_64.whl (390.6 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

dhn_med_py-2.0.6-cp310-cp310-win_amd64.whl (232.5 kB view details)

Uploaded CPython 3.10 Windows x86-64

dhn_med_py-2.0.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

dhn_med_py-2.0.6-cp310-cp310-macosx_11_0_arm64.whl (350.3 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

dhn_med_py-2.0.6-cp310-cp310-macosx_10_9_x86_64.whl (390.6 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

dhn_med_py-2.0.6-cp39-cp39-win_amd64.whl (232.5 kB view details)

Uploaded CPython 3.9 Windows x86-64

dhn_med_py-2.0.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

dhn_med_py-2.0.6-cp39-cp39-macosx_11_0_arm64.whl (350.3 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

dhn_med_py-2.0.6-cp39-cp39-macosx_10_9_x86_64.whl (390.6 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file dhn_med_py-2.0.6-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for dhn_med_py-2.0.6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d7dfe5cd03a52329883d56e8abf9370507437fe0423a3e43ed4358a76058911b
MD5 67f3239f0d3d984fc2a6c2ed102a701f
BLAKE2b-256 67d91b25c2b40f164be25969e616967418424201aa5c117b0b784c437025e76c

See more details on using hashes here.

File details

Details for the file dhn_med_py-2.0.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dhn_med_py-2.0.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2e71ba7ebe54652619986aac8af6706f21b769cdef97cc9ae5731aac54ba7da4
MD5 f6c7e8833a2568aeaaf040945f7712e5
BLAKE2b-256 0d5267b829f8a0df084275a34c78cdb579277a8dd6b3d2d84661aa2f25fc954c

See more details on using hashes here.

File details

Details for the file dhn_med_py-2.0.6-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dhn_med_py-2.0.6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7f8faeb6b86623c23a7edd6b57831a45cee685019fbac8e56ded5f3155082e9a
MD5 19bbfdc38106e3763a79d0da70500674
BLAKE2b-256 722f16677cab93a1c91f884b1b25c3eb57fc01a28e81870ae61bba98ce5ad5ef

See more details on using hashes here.

File details

Details for the file dhn_med_py-2.0.6-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for dhn_med_py-2.0.6-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 839c3d4216da74b6b302a8e4c6e6c3368a6c183010ca83c260a5efa57c6dadab
MD5 07ae308011a4f5c545f0b84d7f5b2836
BLAKE2b-256 2f1ad6d7d73394d92b39227ea8672ed087cb3a9c52156261a62c21c9f4dd2f53

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.6-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ab7aba7fd7fbd083b2feb0ed88adedbd10615af43f695c62328d6fc110d942a0
MD5 d98b470dc5d62f490b1566a0f4652c9d
BLAKE2b-256 a9a090275488d02e9a2f47cbbba5a0bd4b0193377f039b0b7de705457e0be948

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 19b16cc4dfb1f49414dec7db84bb4c5aa7613976ea7002106545c16092b6bb2c
MD5 a9e26a07a96d40267d740b5efc284359
BLAKE2b-256 4e59d0aff81c381ac8ab5afac24b0a3f11720b929457a59ff19ae1c8afd3bcbb

See more details on using hashes here.

File details

Details for the file dhn_med_py-2.0.6-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dhn_med_py-2.0.6-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3a788185c9f26bc761e54461e21e2806740dd0bb1fb93275de1bfb78ee633999
MD5 d335e70135761940b224002244806825
BLAKE2b-256 fae3af5fd3bec3ed0b4890abbc3dc94b6e50205375fc1c90ac79b64bc2a390df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.6-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0bfbc2a641e4374c6dc40cb2f94a3dec5172f7e97a86586d400c9c15b73807fb
MD5 eac1bbc82438ce6a2e721b1cf40437e3
BLAKE2b-256 d6ec9a59baeeb33b5870fc8d79355811ad5478945a6110e4cf050f326c005603

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.6-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7a6bf6a84678a6fea66d7a3585589bc54740800854cf0acdca4e060ea182fa26
MD5 4e138fae5973d279786fe85b1003ba14
BLAKE2b-256 e042032cc3f8b50fd935142a3f2c9656aa879aecf3539e0c1aa4312733eadb35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 498e5d9b0e85d4619792fd1385cae630f300b85df49ce5008adf8c13f0f3e11d
MD5 0b411b43cbecfd1ae544784cf91a247f
BLAKE2b-256 c0ebdd38e63051b625d0412d5d513ba65825d691082b5d067fd6b5932fb35b83

See more details on using hashes here.

File details

Details for the file dhn_med_py-2.0.6-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dhn_med_py-2.0.6-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4ba01a562a04f9d3b77f6300d7c5cb0c4622d2bc511807c2322033ae461d2e0b
MD5 6e0e1fa8e31e25f59437b9418a9ed15c
BLAKE2b-256 607b7b505cecc20459db13cf6843e05a865bd0e0cbc203ca9373fe6a08ad3d10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.6-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7710d64cd45b05d17ad5bdf2ef223e7667326491bf7a1c71357dbb3466f82986
MD5 032902cc0891d70755254a58692e3727
BLAKE2b-256 ff8d0c9f3bfdcb52eb3dd17ccebd0ec5674e5ddbbd9d4653bb421cb14c87a512

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.6-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 3c11868c969f2dc83537d1b488a137f7717134dc81b91e46b407e7d449f0fae8
MD5 c7152b1e212f487b4c3cac30f9c1d62b
BLAKE2b-256 8122b9bb50cd7b7efb67e0db153eb976657cacf133e3b47b52b099f6c55d742f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8abcb517ea3118f53ce1c083120e4d31234c0dfdd371605756145ab91e2017e5
MD5 505185aed474a5d14414b1f70be7e25e
BLAKE2b-256 21f725b5c13c49fa0db32dfa5564f22317a32e5924db4a3d6dcbe9d56d429649

See more details on using hashes here.

File details

Details for the file dhn_med_py-2.0.6-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dhn_med_py-2.0.6-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 00f59ea6acd15bbec4123236ed5ec645bef329b9f3fb29674ab4d6a31f1267bc
MD5 2d38dd3a6d15d4cebc1b02b24ab3b920
BLAKE2b-256 21699f6c6b31c9fd877c3c056560c791d51914a15fdb1b549574dab5d2a8400e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.6-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 aa34b0ed87c797a0a73d655ffedc5068c5bb9f842b99edb796a67fa1e57304df
MD5 645b64961166edccf5a61a2283e241b9
BLAKE2b-256 ee1856987bafe340576e31e56ac798839af4566302ba27b9744be9179c6e7d9b

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 Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page