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

Uploaded CPython 3.12 Windows x86-64

dhn_med_py-2.0.1-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.1-cp312-cp312-macosx_11_0_arm64.whl (338.9 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

dhn_med_py-2.0.1-cp312-cp312-macosx_10_13_x86_64.whl (381.5 kB view details)

Uploaded CPython 3.12 macOS 10.13+ x86-64

dhn_med_py-2.0.1-cp311-cp311-win_amd64.whl (231.8 kB view details)

Uploaded CPython 3.11 Windows x86-64

dhn_med_py-2.0.1-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.1-cp311-cp311-macosx_11_0_arm64.whl (339.0 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

dhn_med_py-2.0.1-cp311-cp311-macosx_10_9_x86_64.whl (378.0 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

dhn_med_py-2.0.1-cp310-cp310-win_amd64.whl (231.8 kB view details)

Uploaded CPython 3.10 Windows x86-64

dhn_med_py-2.0.1-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.1-cp310-cp310-macosx_11_0_arm64.whl (339.0 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

dhn_med_py-2.0.1-cp310-cp310-macosx_10_9_x86_64.whl (378.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

dhn_med_py-2.0.1-cp39-cp39-win_amd64.whl (231.8 kB view details)

Uploaded CPython 3.9 Windows x86-64

dhn_med_py-2.0.1-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.1-cp39-cp39-macosx_11_0_arm64.whl (339.0 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

dhn_med_py-2.0.1-cp39-cp39-macosx_10_9_x86_64.whl (378.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8a2b4976341edc8f8f0cb2a617c6883980b27716b8196af546004322d425b067
MD5 4cd22af674c9f237990166693b066f06
BLAKE2b-256 4f1981edc48c09976737941559fd3d78bc853920c33b766cc917cd4e5f3d9908

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0888b4b439085d157f1bc4f0ccb979fe0c81afc1ffdd9166dcbf9dfca97bbf4e
MD5 877e3eb65f4f09af4224184cce9ed4af
BLAKE2b-256 446fd6a7482f6615efe2d39611e6c40239fb25511bab331c0f6e3ef955908eec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0ee76a61bf19df4fedb63ecf8f4593e9f028922e15ed5f6d7a50e8200b1ebc3c
MD5 b62b82c8330af0e2fbcb78e5d5f86cac
BLAKE2b-256 69b6b7f5724cd2fda42296d623d88e076d5d181cc1dfd0d13fd08c3b44ae1296

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.1-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 14dd23e44dfff5b3a5b61d222a751744af06f3c03d5a063b03a4fc83d30eeb7c
MD5 05e8a71859f6e326f1ce5323e2f29dda
BLAKE2b-256 7e10dbccd3003862127d2817d261e7ee2e4a97b674673e2d5498a6b59c28a142

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 806be473b8dd7e42f1b8828574f18e07ad4a6228e96ef039953f9399816dcaaa
MD5 d37d9583508b5b3d9290b0c007a2cbf3
BLAKE2b-256 50fc8067e384626219fcef8398070d9bc4d16f1ebfe6a1e08eb91927d1c4b612

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 94745add5010cc8493bf9200ccf78a44d51080b891bf677e675897542dd25c25
MD5 bc017203a041809dabed7530d9b9d4d5
BLAKE2b-256 055e4cafe411ad96cced38506ccd353e29f729200f3281534069954b8e8cfb09

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0a93ce252f5fc987197dc16f256c8991f7059855c88b1b17c67e1e8359446a92
MD5 3caa14ee90ef4bf9a24432e092ac82ba
BLAKE2b-256 61e98ed6e3e3d909a4a59bd2dacc59742b1fe24638421c5959f11a3429bde792

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 45ca7cae6a3fb72e1ffd11c2b078840dcfb44f0041bbda9b69b80577439106ea
MD5 83d190155243a9a1d5e77fffad209a44
BLAKE2b-256 59113dc96df40d3ff629fc647e1f52da1bf12ffbe3e52c13f13e0d1bf09de835

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 6ac0a8b493c3eb2bdb161c2ce047d52289acc81a8518a8dcd886ee11e99d0d4b
MD5 7f3e868b8ab53efaeb2e73a4a5eb6d5f
BLAKE2b-256 cf7895b75e1b31c6a2d692c33141122d3b30843a9c8af6e219ed2004d107ead4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 57c6525482bd172715bc025f48fe2916c4648b46f3474223ca8d86537b7c0fb2
MD5 61d196fabae07d9706f4ccee35b835d4
BLAKE2b-256 b44774ff35e98b7dc61d6e69fc87953a69e547fe68ed2a28f28105471dba700e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4c6c1f3406d6b1035195b58679320daaa386edfa2134eef66b87b85ed682875a
MD5 37543d23b0d11930e94eae5c0a1c2762
BLAKE2b-256 c2baeaa964ce37254f34ece17ac194eadd83d36bca00c555ec82a2c1481602ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 11e704d05ac226e427fd57a758e7d0a270466b1e8c24b183c62d700399f06dcb
MD5 5bbc28a60f67542a29151411f63c3b64
BLAKE2b-256 3505124900b83db5a177d94bdcc6a117f496985564e57d9c89eaa05962784630

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dhn_med_py-2.0.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 231.8 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.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b27b11abd9d5e8e9dfedc845c2080e8714550f0ba5e165748d70f9c48de5866c
MD5 9fc8b7bb8f8a851f9d0845c26f375e30
BLAKE2b-256 51f35bdf7a431d6193df9cc59b3d76694233ae14bcc034851c364f7b61832588

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 93d6efd54bcc4bbb957f0cda87e9b5decb5cc561e43626575415a4d24848bf11
MD5 0b42a5cb4e8f8e2e995df3dc7de2329c
BLAKE2b-256 e162abdbdf04e9eab56b01db7ab61c190fdfc1812db1f8eed56b10da73035b59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f434f29adf6148b5deae0f2a94c04c5258e922ae03c872d0427936a8522c7075
MD5 5a08ff15678d634f5b1569e785897d5a
BLAKE2b-256 68b22e02c8127690269cd07b0635f28d09d90ec547516c39a8efbf7d40d84fb2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-2.0.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e19dd11d6666bd24e971c8ae231681134274c28110ef35643bf492c8bd5e4d59
MD5 36e36054c01cec766e1c6d42b40f47cd
BLAKE2b-256 1cc44a392dbf6d9467193136e25cea6d4b153b9d1fbd133c81a1d14f1f5c81b2

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