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
  • 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)

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

Uploaded CPython 3.11 Windows x86-64

dhn_med_py-1.1.1-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.1-cp311-cp311-macosx_12_0_x86_64.whl (328.7 kB view details)

Uploaded CPython 3.11 macOS 12.0+ x86-64

dhn_med_py-1.1.1-cp311-cp311-macosx_12_0_arm64.whl (291.5 kB view details)

Uploaded CPython 3.11 macOS 12.0+ ARM64

dhn_med_py-1.1.1-cp311-cp311-macosx_11_0_x86_64.whl (316.5 kB view details)

Uploaded CPython 3.11 macOS 11.0+ x86-64

dhn_med_py-1.1.1-cp310-cp310-win_amd64.whl (190.5 kB view details)

Uploaded CPython 3.10 Windows x86-64

dhn_med_py-1.1.1-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.1-cp310-cp310-macosx_12_0_x86_64.whl (328.7 kB view details)

Uploaded CPython 3.10 macOS 12.0+ x86-64

dhn_med_py-1.1.1-cp310-cp310-macosx_12_0_arm64.whl (291.4 kB view details)

Uploaded CPython 3.10 macOS 12.0+ ARM64

dhn_med_py-1.1.1-cp310-cp310-macosx_11_0_x86_64.whl (316.5 kB view details)

Uploaded CPython 3.10 macOS 11.0+ x86-64

dhn_med_py-1.1.1-cp39-cp39-win_amd64.whl (234.5 kB view details)

Uploaded CPython 3.9 Windows x86-64

dhn_med_py-1.1.1-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.1-cp39-cp39-macosx_12_0_arm64.whl (291.4 kB view details)

Uploaded CPython 3.9 macOS 12.0+ ARM64

dhn_med_py-1.1.1-cp39-cp39-macosx_11_0_x86_64.whl (316.5 kB view details)

Uploaded CPython 3.9 macOS 11.0+ x86-64

dhn_med_py-1.1.1-cp38-cp38-win_amd64.whl (234.4 kB view details)

Uploaded CPython 3.8 Windows x86-64

dhn_med_py-1.1.1-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.1-cp38-cp38-macosx_12_0_arm64.whl (291.5 kB view details)

Uploaded CPython 3.8 macOS 12.0+ ARM64

dhn_med_py-1.1.1-cp38-cp38-macosx_11_0_x86_64.whl (316.5 kB view details)

Uploaded CPython 3.8 macOS 11.0+ x86-64

dhn_med_py-1.1.1-cp37-cp37m-win_amd64.whl (234.3 kB view details)

Uploaded CPython 3.7m Windows x86-64

dhn_med_py-1.1.1-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.1-cp37-cp37m-macosx_12_0_arm64.whl (291.3 kB view details)

Uploaded CPython 3.7m macOS 12.0+ ARM64

dhn_med_py-1.1.1-cp37-cp37m-macosx_11_0_x86_64.whl (316.3 kB view details)

Uploaded CPython 3.7m macOS 11.0+ x86-64

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 481a1c280e7989f5eb8b6e0f86f2b72d2a038ce8a5eae84bc9580cd4a165633b
MD5 43eef422c8d87c43dbef8ef52a9c2598
BLAKE2b-256 f7bb2a41efc238acd9db6a882a4a0cb28f135893af9ed8146fbba6020d75fd43

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8c8af6b23552d150823035e41c5936ae2b2e3bf4c222b8c38f7e491efbda4c7c
MD5 07dbd3a7044fbbcc89d8f38c509a78ab
BLAKE2b-256 a30ceb72cb49185aefb67c85dda0cad49d5e5a2192b0211dc5eb02ffe9be598a

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.1-cp311-cp311-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp311-cp311-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 e9a8d3a28197b3e8a6409274393c6bc3e91739b63f006788cc01b47378802f76
MD5 d4adbec8599d4c86d0ccf22692a8abb1
BLAKE2b-256 d85c14a721a181e202f3b01e5ca8c25bcca93f0170c08fec80ee07e4c45bfc69

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp311-cp311-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 c1e109efac45970a42b7af84ec2863805b48637747d3496db9b4dc46a92f7f1b
MD5 24772f482b3100c9dfb09a55b6a0dd17
BLAKE2b-256 7e9b6db6f4f95ec961d6cf81ca83ea19b898a5bbff26a51b016181f6582f9bf7

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.1-cp311-cp311-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 68dd91fbfd4d6fc740941d8c57aee91649eb1a005facb7f46bc5f7e4f9f593ba
MD5 4d195c6810193334cdb39a243fdf4ecf
BLAKE2b-256 e1f672325287df23b4221536a70f346cd6934698547dec8ae89640bc7e9c3927

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 6e17b6dc68c0519a9534663feb0761e0ce066095d0a27b2241c08ada082fa89b
MD5 8ec3b3b9222f62f13787422796a77770
BLAKE2b-256 da271728641157c356880c9d5630f1bc4f2ebfc8f5826007dac2c9d09adc26ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 520d5bfb98f9250af3b385f8ee202c91611a8c28daed3926fc16338fc4d6dfd4
MD5 45cc911d7676744cf657a0603d12a70f
BLAKE2b-256 4766ddabfa8ef103fe2212e6badd9eeeb5a7175980852f048e5b16e02d58bfd9

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.1-cp310-cp310-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp310-cp310-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 81b54110ffa88b638fa9aff827be8161f68e1b9ad8ad17413fb9f8ee53d4767a
MD5 7313208592fde5dc7183199a2aeefe4d
BLAKE2b-256 bdd2dcc23bf3f7d451d8bfb22717d92c1f8b0aea6ac053b0f4bbd19a662ce111

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 86c303f01221d894ed3484f9bee28c4a97e08fb25fefc86753e4c281070ce4f8
MD5 c3e61b66a97f9c82cd2b6d948a7f0d56
BLAKE2b-256 192a3fe4d201eb535ccf8cb6dbe26f10bf25926e6c434c7766bb9688a3f31497

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.1-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 dafe7ffbb81361b80480d757e525f4426415fed6b9c8e0434009ba678e20c093
MD5 4ae855f98262c9092aeb2b13ec7621a3
BLAKE2b-256 49b793c09239acd74bc7bca7ca23b17c3ad0baf71a450c9597f766ddb4a03a19

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dhn_med_py-1.1.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 234.5 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for dhn_med_py-1.1.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 96bba10b655f6ac6a902f0f125e0f9d0627c8f4157efdd2b1feb0fe71d9473b2
MD5 a5c1f536d0915feaf6a8c113da020ab6
BLAKE2b-256 13c3539bf2f9723f4d39e80304e063f29bd28849b680f08aa688d0446262f7de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c4009bf5b0a965ca4913741275e50c78d93851e556f92c37f7cb0fe52d3603be
MD5 fa6da51cd0084bac617a754870fdb595
BLAKE2b-256 a71bbc7439b342d05a2bc499c8c050255c2d8270a8b8acc7d0fe552c7a4d0fcb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp39-cp39-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 e4a9e973d1efce0302f2ad2dec0b7307ed3173c83d86bcae1396be125d6a06c6
MD5 99c2772b1c26a0b2e2ea90b6d19d485e
BLAKE2b-256 fcc0d65060397d2f53e26dde7c7e02efd79e67b83aed5df7afd50464df1279fd

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.1-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 5aaccc49870478dc7952007b9e15ff28a8c026bcf4b10de687efebef6ddfbdae
MD5 d6a8b19750ed91c70e6b53905cd83e54
BLAKE2b-256 071508895edee3ea84d62ca012c59f685023272772b0aaa0fb9be934e64e5b12

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dhn_med_py-1.1.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 234.4 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for dhn_med_py-1.1.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 b69176b7c572079af06ef21ebfa531fc67939a7fc4a7013a6f2483493df96fa3
MD5 5b24da33081845de918f90f7e07b18f6
BLAKE2b-256 e273a5bf8b0de2a2e8943cc52df309ae118d2d5e837f700e7d2a31be027fbf76

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ce42212a1119cc6d3d3ccee248884e3ab2d14ff0c4e35829b82794330c85d63e
MD5 86a5d4a44e0ab5c48e88c424e4664f20
BLAKE2b-256 2107088214fa7f8c6a65b278413a922b21032a9bbaccbb2671618715b688df7a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp38-cp38-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 5559450e0b09c19bba1138320cfecc32c2adef67dc872c01e1d59ab045004966
MD5 9cf4b0aa55133d6006419f63317de5a0
BLAKE2b-256 1ee64ef8b9a0ab69e65f62469ca54b582a12c446059e95836bb2d42804b56ae3

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.1-cp38-cp38-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 0ea7b829acee877ed25d19e66ac0e7e3b0c17879d6dd44cac0d7eb01def027db
MD5 8738849384314fda71d5bd2f0b1d45ba
BLAKE2b-256 ffd26b6fb0cc657c2367e43aa58a92f5eb96e7bedb9749ea09e5b104b131ad39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 6e0e779393f8943d1b723b02cc0173c0a5a5ace47f273ab8d6e9dc93eb3ce3c1
MD5 57b261fa26d79194f71ad77f737708cd
BLAKE2b-256 66ae3ae815f4ab11090c598781074ea903ad620f891d204e3e4caae03f00c86b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f381fecb040c7e9ef10a31db70c3589cbe36e2303c7950e11403d39a2edb0af3
MD5 d2460e0d7e9a128d4e65149deacf3909
BLAKE2b-256 6782b60034c242688c93459f5d2496547241a6a86b30f6615fd9a913fa9c0606

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp37-cp37m-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 7ff2196ae9043968e098ae197bb7742cc649f25bd273a3a47f8bffa09b1138dc
MD5 ba2f1425eba16b65fbf760c63304cc00
BLAKE2b-256 56066be9ff0be75b2a4c745fe17defd17e72ae64cec7e7fe0f52fe540474e5a7

See more details on using hashes here.

File details

Details for the file dhn_med_py-1.1.1-cp37-cp37m-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for dhn_med_py-1.1.1-cp37-cp37m-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 6552542c6040057864f1961b270e54b51336c07a6997671849380f16b4f2ed05
MD5 2f3c7670d252c30378958f8bb35ad22d
BLAKE2b-256 02e66dce21964a228cfe5d78e628405251ccea1815891c2a019af71f7860ff08

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