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

Uploaded CPython 3.11 Windows x86-64

dhn_med_py-1.1.0-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.0-cp311-cp311-macosx_12_0_arm64.whl (291.3 kB view details)

Uploaded CPython 3.11 macOS 12.0+ ARM64

dhn_med_py-1.1.0-cp311-cp311-macosx_11_0_x86_64.whl (316.2 kB view details)

Uploaded CPython 3.11 macOS 11.0+ x86-64

dhn_med_py-1.1.0-cp310-cp310-win_amd64.whl (189.9 kB view details)

Uploaded CPython 3.10 Windows x86-64

dhn_med_py-1.1.0-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.0-cp310-cp310-macosx_12_0_arm64.whl (291.1 kB view details)

Uploaded CPython 3.10 macOS 12.0+ ARM64

dhn_med_py-1.1.0-cp310-cp310-macosx_11_0_x86_64.whl (316.2 kB view details)

Uploaded CPython 3.10 macOS 11.0+ x86-64

dhn_med_py-1.1.0-cp39-cp39-win_amd64.whl (233.9 kB view details)

Uploaded CPython 3.9 Windows x86-64

dhn_med_py-1.1.0-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.0-cp39-cp39-macosx_12_0_arm64.whl (291.1 kB view details)

Uploaded CPython 3.9 macOS 12.0+ ARM64

dhn_med_py-1.1.0-cp39-cp39-macosx_11_0_x86_64.whl (316.2 kB view details)

Uploaded CPython 3.9 macOS 11.0+ x86-64

dhn_med_py-1.1.0-cp38-cp38-win_amd64.whl (233.8 kB view details)

Uploaded CPython 3.8 Windows x86-64

dhn_med_py-1.1.0-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.0-cp38-cp38-macosx_12_0_arm64.whl (291.3 kB view details)

Uploaded CPython 3.8 macOS 12.0+ ARM64

dhn_med_py-1.1.0-cp38-cp38-macosx_11_0_x86_64.whl (316.2 kB view details)

Uploaded CPython 3.8 macOS 11.0+ x86-64

dhn_med_py-1.1.0-cp37-cp37m-win_amd64.whl (233.7 kB view details)

Uploaded CPython 3.7m Windows x86-64

dhn_med_py-1.1.0-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.0-cp37-cp37m-macosx_12_0_arm64.whl (291.2 kB view details)

Uploaded CPython 3.7m macOS 12.0+ ARM64

dhn_med_py-1.1.0-cp37-cp37m-macosx_11_0_x86_64.whl (316.1 kB view details)

Uploaded CPython 3.7m macOS 11.0+ x86-64

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 32df156722ec975954f0a1053f06c387883192a51f79812fef5ba4182891fe9e
MD5 e0a9f825e8a227b497394cb7890f8f40
BLAKE2b-256 71957245af425a5ee356fc0f2c86855c83518b1db3a4a700111c8ef8f138e981

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8491e8fee12ebc39bad78ed1624ca5b6a15fb8d2b9b6bba2fc8c282fe4303c51
MD5 96c2521e5ba16fd4defd30d777526169
BLAKE2b-256 76e56961a379816087dfa2856b804d47dd99d4ceb162def2e4d23c3b512f9948

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.0-cp311-cp311-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 3c4c0b91e1306e147b3d3352d68466c4bbb4591ea1960324caa3791f6c310644
MD5 c1f5831cacc30094c934cd67cc5a17c7
BLAKE2b-256 3fde24acadcceda07ac70aba7454545a64b0309171a2a01814bde2de0557ee30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.0-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 7705782b4c3e2ec723e8fb9a583e67a2a12acf193654f53924d70c7a1da295a7
MD5 519a84ca149835d5bca45d382bddf695
BLAKE2b-256 ad2f846c42f383ad169ac8ab96ae7e0ef6724ae8c020aaf74ee01196b5100363

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4bb79016408be14c650f38cd51c839cd39494d896c093c5a1235217df51b050c
MD5 9ff3b13f52dd4e8fb41af2dd274ef431
BLAKE2b-256 dd7f8b8012bc590643bf29749a7944dba12e73b05f572b15fbfaf19016269d40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a5ac5dbcc176018ef60748e706abee17cb09ea4db290f9317d07d9639f60b4d8
MD5 7dbe18c43845d8607e4af7faf9944f7f
BLAKE2b-256 312a1f5796da07e0ae001f09365413b3d028883a7ce116403a9306bb0f4920d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.0-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 f5b772be7994765cd6df1d69bda2a32baf5c7d9bfa4b4d6abb2691ac1e26180e
MD5 9f5cb8ca70f9b33db0f773cba3f0518c
BLAKE2b-256 23db2b2235e8c76cab1dba5a68066446dd4d47282d41fc4d8b084af6902d0d1b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.0-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 7ffff53b0b953bc972e697c5aa37c0310e32d0d4169153652945e8af7dcf7c81
MD5 36514fd3f0dd609fd0a1ab93bf35ebd8
BLAKE2b-256 a8ef9c5b170bb4116b8c6719767b089f613d74baca17dcf050415dca52c6ad08

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dhn_med_py-1.1.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 233.9 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.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 0e7d59be178829e8518532340222f060a5a6b34e663160136c524158cacddf33
MD5 200038dd66c3d927e75fb81aa494026d
BLAKE2b-256 d7928b36d912c1a33916979cd6be176ebcf52dadb42cba38dfa5edac62a74af2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a042b5c09f2da958e10c9266aedf565ab1572326544d99dc6716361b772366c1
MD5 17c628958949d128d56d844c1a27871b
BLAKE2b-256 b831da6c442aa2b53661dcdf3d006cf0e1c237fb7267598de5de6d8dafa73e8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.0-cp39-cp39-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 a3e654b0a8c4dde7cbf2df5e3be5287a7b016899253f9abb54427220f55043a1
MD5 65bbcde50a9fdb332484a2121ac1c9d4
BLAKE2b-256 11cbd2e4512cb8b0d00aff2d815a9748cca9c01f08ced1d9c7f9a6303d51f01a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.0-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 a9d915e226754355b4251a00798ac5b802a50cd4ecc20974012efb9b882b7f00
MD5 ba55221acf18f9d63cbdf5592ebe848a
BLAKE2b-256 3696fef43cc98ef35d43a078fe13c0616bf478aacd8d7b3ebf4a9c7ccf7e6c20

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dhn_med_py-1.1.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 233.8 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.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 b850a7c960f6c6a8fa93bcf5bc57ba10215d6625bcc190c1d3872e89597c004f
MD5 0b2e799987eb13edce02344a96d5beaa
BLAKE2b-256 d92198f164eeb5bca4ef637ec17951f6f83ee0d36b2c75eb825a50eb321a04d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0fcf392eedb902c526ccbd8d9293e5812c6a402a6a08ec8fe8182bcb7ef63ca6
MD5 4a14a494af28b0f225063af3dbf3d4c1
BLAKE2b-256 8c3a25d5c3108aa89a9ea947a4bec5067884c1fa604501cfeaef1a6c9f091dc1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.0-cp38-cp38-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 786b915627f8043d5fea624c88a2d018d50617fb1741f973f39108b3132f7c28
MD5 9f4f8b9b0d2f596caad9aea4559a0c59
BLAKE2b-256 9ef75cf06f0e76a074f0aa4c46792add439fa374d548d01d0cb14369cc7b9cca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.0-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 3fa6a9541554293961fa27ac91c65867a895aee052ea1a89cbdbaf26801dc99c
MD5 bc1c8b259b0d072c920615d7436dca65
BLAKE2b-256 bcf088f57382ad33ce75a06f4f7fb45e2765d74508a549bb7149ba2e4a4728c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 bc7ee2cf91d9f67bee375a564e51e24de614213f29f5a8e07b91db106b790356
MD5 0a83d9b1c950591a26333ada59a1af02
BLAKE2b-256 00824f6fe7cd8602575d0c701fdbf2c9a7359ffba5d8bbbda9f62afe4f3e158a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0d867b36a7c213fe2234e4cbee30c666e3d5892cd8fe4ad905ba1034e3da85f0
MD5 c0d645f4b3e6c8c85ab3651c791502b3
BLAKE2b-256 3f26cdb984b658a46a3bcb76379faba7345eb11ad5c6c582b4bf25d55083022e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.0-cp37-cp37m-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 69e2d92666a44d39406dc2ad3bd0e41e46145cbcc1a6fda639b9c4e055e150ec
MD5 93ca3651d3e8ea29c06b350f74dae3c1
BLAKE2b-256 e1dd1326c777812aad71dfcc31c83f0cfa39b7ac28feb6a07a538b02b0c4bacd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.1.0-cp37-cp37m-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 9e939362fd58802b0d3e8e941e0d2bba3ed59d4bde0d7ff4519809dae4b0fa97
MD5 3b63ff82cb850129bb14b39cce9a2ee0
BLAKE2b-256 8d6f03d0b960dc872396b0c405768b89acb189780a6443b8f1325b2e4472ff1a

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