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

Uploaded CPython 3.12 Windows x86-64

dhn_med_py-2.0.0-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.0-cp312-cp312-macosx_11_0_arm64.whl (338.2 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

dhn_med_py-2.0.0-cp312-cp312-macosx_10_13_x86_64.whl (380.8 kB view details)

Uploaded CPython 3.12 macOS 10.13+ x86-64

dhn_med_py-2.0.0-cp311-cp311-win_amd64.whl (231.1 kB view details)

Uploaded CPython 3.11 Windows x86-64

dhn_med_py-2.0.0-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.0-cp311-cp311-macosx_11_0_arm64.whl (338.2 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

dhn_med_py-2.0.0-cp311-cp311-macosx_10_9_x86_64.whl (377.2 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

dhn_med_py-2.0.0-cp310-cp310-win_amd64.whl (231.1 kB view details)

Uploaded CPython 3.10 Windows x86-64

dhn_med_py-2.0.0-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.0-cp310-cp310-macosx_11_0_arm64.whl (338.2 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

dhn_med_py-2.0.0-cp310-cp310-macosx_10_9_x86_64.whl (377.2 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

dhn_med_py-2.0.0-cp39-cp39-win_amd64.whl (231.0 kB view details)

Uploaded CPython 3.9 Windows x86-64

dhn_med_py-2.0.0-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.0-cp39-cp39-macosx_11_0_arm64.whl (338.2 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

dhn_med_py-2.0.0-cp39-cp39-macosx_10_9_x86_64.whl (377.2 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c790ca08da0cebc4630ce539609eb224cc96b48294ee8fa3588ccb2e7a124ad6
MD5 1b7f2420088be619e9d77f9b81185596
BLAKE2b-256 511b631963982aea4d62e48acdfec0669f6b7d5e8e6f96b28d402160e7eb4628

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e489b3170367b7103d26c019c2f49d6b65918569442f2de638813b31171f8d3c
MD5 43ef8a36d50ecad431b3a6a96455fc00
BLAKE2b-256 c0d615a140115bcfd05c14c3d8ea9ecc3c4d77e74db4e19e9a198b30af671ba4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7c4c066cdcaf5018980dd8c2435b70fccc0587863b21ca16e90de47e3c53f81c
MD5 44f24b710c51aa249b2d643a295a98f1
BLAKE2b-256 a160379c5bfe137d2b4a2a54132b58bd2dfd3355aeccf0eb4647fa2f40943494

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.0-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 206c60b468c9734c6f996f7e5955555c5a8a1f065b83fa0a9c8822ce24db05eb
MD5 9a1a8053de7342148eb842a61469fe89
BLAKE2b-256 fcb34535625f4f86735da1508b1ec8bde6668d4298495dac2a2786f9bc0ce14e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fa7a4e000a49ec22f0a802eb2ea1c22557a468cd7ad5ee70cfe89b998d0bb5e6
MD5 12ff605644ad4fa199b41682e1e6feb1
BLAKE2b-256 c8619684bc19b310d1710e804924f6ecfe5b4b0d4c374021625b2880de830f0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 05454e2a9fcab9fefbacdff1c2e170690e5497e2a68a8ed2e0f3f47ac055a949
MD5 458589122c466047a0cee9c8e90f0ac3
BLAKE2b-256 380916a350874051ac046ac184b5c79a959767db65dfb7d1a27c0b4f15fd9b68

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fe3081f179ebc5c0e39bd17a7abde992e7731b1e24b3d9d70d4b2b57d003513b
MD5 ea1d0cf8662b6a40cbc46963b3dbd9b3
BLAKE2b-256 7c43760ef81a8d8c12c3c6442aba1805184ee743c2678961d51e972ac248a1d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5f6eb4d9457cdc85772e2d77514919951fb541d2196615843e0a5734ed3bd22f
MD5 d1f63dac3e3a20df51b3739567e840d8
BLAKE2b-256 d30aaf6f5e2020317c4a740846cb4f0144d38dfc56565e00784eaa98c63c8ccc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c8139336ca259ae168af7068dc6ee2b4a7d765789d13ad6ff5ba47eeda624709
MD5 df8053e680fa2934d8253d6e8f82829e
BLAKE2b-256 ed25717e464162cd80503154ce9d5a0245551a3c1c7cc086ee95ba5e39ea9303

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 852c5e0bb4cc017a97057c4d3e1abc0065e777ded78341ab88898961ca2139ba
MD5 87ca6d4111051883ec4967f9a2218413
BLAKE2b-256 387126c8037a1aa06dd8f15959f158da24a8be8884ab6c2014adeb89f9de4949

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f4e5729575f982572bf651890e82a48ccb454bf29c294db09ad6dcac318208ca
MD5 9caea52efb10a78d6df3fd0f0809a8e1
BLAKE2b-256 f0f52b000d77dddc71d79afeea3f160f2cc24d30093fdfe5e30541faf0b1d939

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a6450857a9a05563f8c6271d5102e68dbb8e44b19695d6a65f4504ed21859dc0
MD5 488034fe8d232f99b8e8c042881c5f73
BLAKE2b-256 bcfff05f2f97ceac1836a0b2036f11719aa6b1349b260481a7c040036fb6b5b5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dhn_med_py-2.0.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 231.0 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.13

File hashes

Hashes for dhn_med_py-2.0.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 43d81acdf1a0956a03989df26dc1eeee0370e0d50ebd7f114681952455704486
MD5 41cef2aa52c9e55bbcd078ff930308f0
BLAKE2b-256 5e54f60484870655ed01ada4ef50de6b13969260c8d2321b382a07ef023a96b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3a863c29960865e278e6dea69f8d47038882e3f194a74c8d833ed8afcc9d34dc
MD5 936a57cacd926a00efbe3b710398f0de
BLAKE2b-256 bfca4a935be8015238c01fdde67a305b3ff9a05a1aca014f81f43f991e1afd98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fcb1b06e0cae24074392e95fef459fd8d9d1399a1ad3d00cc9ce7d10177d5a4a
MD5 6783d600374bcdee9c92ffe1d148488a
BLAKE2b-256 e1a552fefcc48397d511c7542b0472c3aa75aec8b1e3492c3e6a2c1eeea70651

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 801a0b34eb108e049ef95824001dd30172b00be5fca952c0d60ae73b68fa3353
MD5 d08460e3e659b2cad0972785836b2290
BLAKE2b-256 3f8451023d7311e3927a0e1947a897accfe4ca7f2c38ce168b8208f58376f9fa

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