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

Uploaded CPython 3.11 Windows x86-64

dhn_med_py-1.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (852.6 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

dhn_med_py-1.0.0-cp311-cp311-macosx_12_0_arm64.whl (284.1 kB view details)

Uploaded CPython 3.11 macOS 12.0+ ARM64

dhn_med_py-1.0.0-cp311-cp311-macosx_11_0_x86_64.whl (305.6 kB view details)

Uploaded CPython 3.11 macOS 11.0+ x86-64

dhn_med_py-1.0.0-cp310-cp310-win_amd64.whl (189.0 kB view details)

Uploaded CPython 3.10 Windows x86-64

dhn_med_py-1.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (850.7 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

dhn_med_py-1.0.0-cp310-cp310-macosx_12_0_arm64.whl (284.0 kB view details)

Uploaded CPython 3.10 macOS 12.0+ ARM64

dhn_med_py-1.0.0-cp310-cp310-macosx_11_0_x86_64.whl (305.6 kB view details)

Uploaded CPython 3.10 macOS 11.0+ x86-64

dhn_med_py-1.0.0-cp39-cp39-win_amd64.whl (222.6 kB view details)

Uploaded CPython 3.9 Windows x86-64

dhn_med_py-1.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (850.4 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

dhn_med_py-1.0.0-cp39-cp39-macosx_12_0_arm64.whl (284.1 kB view details)

Uploaded CPython 3.9 macOS 12.0+ ARM64

dhn_med_py-1.0.0-cp39-cp39-macosx_11_0_x86_64.whl (305.6 kB view details)

Uploaded CPython 3.9 macOS 11.0+ x86-64

dhn_med_py-1.0.0-cp38-cp38-win_amd64.whl (222.6 kB view details)

Uploaded CPython 3.8 Windows x86-64

dhn_med_py-1.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (849.8 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

dhn_med_py-1.0.0-cp38-cp38-macosx_12_0_arm64.whl (284.1 kB view details)

Uploaded CPython 3.8 macOS 12.0+ ARM64

dhn_med_py-1.0.0-cp38-cp38-macosx_11_0_x86_64.whl (305.6 kB view details)

Uploaded CPython 3.8 macOS 11.0+ x86-64

dhn_med_py-1.0.0-cp37-cp37m-win_amd64.whl (222.4 kB view details)

Uploaded CPython 3.7m Windows x86-64

dhn_med_py-1.0.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (847.6 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

dhn_med_py-1.0.0-cp37-cp37m-macosx_12_0_arm64.whl (284.0 kB view details)

Uploaded CPython 3.7m macOS 12.0+ ARM64

dhn_med_py-1.0.0-cp37-cp37m-macosx_11_0_x86_64.whl (305.5 kB view details)

Uploaded CPython 3.7m macOS 11.0+ x86-64

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.0.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5026485253ee6f62beaf4116de3f85096252669453010a0a979907097d39beef
MD5 251f3ebb821350597caf362a994319e9
BLAKE2b-256 5aeb7b9006b7a862bbb86310e7dd62eddfe28e27b4bc7b0a9179bcf6ba8c8463

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ae5f82ef867380bf8b54b1f995fecd82eae55f2a78d954bd1125f32646d1fb1b
MD5 575c06be9d24d5275fd1afb01a078540
BLAKE2b-256 2e4e585530ccef7eb041514e5b133af2afe9c378de90c331b2dc35139f4b2b3a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.0.0-cp311-cp311-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 3f3e79f9eadc1a7ad57e917cab47e85beb0f08de7e01454d02fc5f3009f411f7
MD5 4026a526348c45b91def0af38bb0a47c
BLAKE2b-256 52a03469d01c8aa5c5f5a037e7b10a54be313dbf8a3a26d01c87c763ba2717e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.0.0-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 dfce2672fc171df0c9870f41187db3f8c5db8a8f979883d28ccafb159d8a3771
MD5 0b65afd411682e00d78d19a0c39f4f3d
BLAKE2b-256 b3b7c1c5c6a7e00b9e5476245b93fe3ebf6b48d27cdf4cb52ac0b7823ea679c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.0.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7c56f6b54cb73b3fb9bc084e1a05543571420c1f7b7d3bc005a06b9973f2431c
MD5 04ef87f62f6d39c94e5702e1f684dc7c
BLAKE2b-256 9afe1ac9566a8ae5f4aa7d4dabe4da78d3404d993efebcc9ce425068d981c8c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d2b2f2d3011ab090e6c7b91264a0d9aedfb6ca459fde5ed36e088da5ea6a2434
MD5 e47dd10cc8a2b63c75b4bdb4b1a97e40
BLAKE2b-256 2ea59ea865caccb416232efeea4a0d96c8a1e25eba813040d346a6b26b3eb855

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.0.0-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 b7ec9a686e5d6dc5a628a0ded8c3037268a8222409b3afdd4b40b6fad36f0d42
MD5 a2c64c3ce6376f4f972f19e813c9efe3
BLAKE2b-256 341ec5f82eba46b733fcd4252e0edf7165f15ef05387eaf623ba9f8c79bf1bfa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.0.0-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 60f2c8b01b0045337f5c3734f66ebf126b0d5f87c2a3aab97cc6c27b9481b952
MD5 a4248ab8cc0a307f3bfea69138a29561
BLAKE2b-256 bfce4525629d6dcef8fc9c7dae3389ebec399acd107a4f191aa46620f6f8716d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dhn_med_py-1.0.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 222.6 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.0.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 1f2c7c6031ba952969f9622b580707540d724f2f1c85e2dabb4b0d3cb5a9fb4d
MD5 709da75cf1fb23098f6f561d9afc25e5
BLAKE2b-256 d854ab073a127100c6ac978601a4f2d53743c24699e6961186afac847dddc8b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ecfffd06210ebbef4a28a7cc9f8240e87dc4539a3de0d98c2d62206232eb62f3
MD5 da5fea83f1c40a3f192fb5271d1eddb4
BLAKE2b-256 b631967c62c1958f320b4b19b2447fa3266024603ed66ae807b1f669600f4aad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.0.0-cp39-cp39-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 cc55040c3f9ddd6f521b4db7d0b84a5e9866ce88e031fdb53f11980d89738a04
MD5 3621b0516c0bb99ddfc475aca9f99767
BLAKE2b-256 79bc28f9fc8099b2c75b49783f7908f0a8863608fd92d622900ef513e7bba5f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.0.0-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 78648d842bc8edc57b8d6a1b6d64a43af7f103633bac3d278af8fa34e500250e
MD5 b93bdae0a543739b8924a4f8f3ea0317
BLAKE2b-256 d2ebeda84f72108e67403a238e4ef8c31d7f02aaf23dfe1b77c433514ef5d632

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dhn_med_py-1.0.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 222.6 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.0.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 b94dafee07eda2b338b463bf8f6eaf7fa504f433b4c71f457aaf529d418be570
MD5 db3cb44aab97a517522c2e5db98fae06
BLAKE2b-256 3e56ae837b9bd4ef7268d663b25b8dc81372764d8805a60835dcc5d6a23a6e6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1f5cefef55020dc4cd3b3de947d99dc7dc2f9c90aa84887aa71eb7a9e60bee06
MD5 a7a16d476ec0a96c1c3e8b0b45250b08
BLAKE2b-256 fbe78cb6bcb3c876b1d4629a037bd1b75689f2f8490f3458a1257c719c3188b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.0.0-cp38-cp38-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 5b5da1a24366808a8d3841506721d1c17382c39af1b5e96773f85c2af127f8cb
MD5 df599a681112a19a2998cded46e6ee6a
BLAKE2b-256 bb445d9834bb765bd54fb813bb99ff8250e89152299692aba2e380be3f433330

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.0.0-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 a67e05d0a7a4b566e00b739348a92e12db02c8c9f776c90c406412c3d8d3a29c
MD5 2f072efe12bd55b904a613df093fa522
BLAKE2b-256 c4ba8755e6e297ae2648ad8aa8c02c1f1ab78bac4e5793e5328960fc793292f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.0.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 6f286aab5519451dcac45ff4bea8785dfe0d7796b22a40eb6eb396fb10d9f58d
MD5 d75a15eae0f77e9f574d93bb8dead1df
BLAKE2b-256 c533d7359a17db1434454a63b79561a457472f673296003fb1a8c6f1142c7698

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.0.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 086f6629580405e43795044a1050275183e0f14f786f5497d8c02415e5e14cd0
MD5 1c985ff2eb44c45dca02cdbbe4931a07
BLAKE2b-256 7e7053d1e46e41865cf15b43f813ec1090211e7390e6ba0f2b892e77eff0f467

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.0.0-cp37-cp37m-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 ed3e93a6988cf98e2634e76434bbb7c56474a6ff92686c2fe6577b401492b144
MD5 b6b74097eae8124ee842f1ee2fe3f87b
BLAKE2b-256 21fcbebd985e2c4848a794d3f05f0bee078060815bb372323d9156f73ccadf0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dhn_med_py-1.0.0-cp37-cp37m-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 e2d79f36780edbc13ecf9638c66fb2f2a2a27a2fe796efe633279470ebcfabae
MD5 8b27abd1403fa4cf58c3a5d8ea19cc35
BLAKE2b-256 78a03e451413dffe5ce983c19a63a893c5933cfec3c43a13968b9ba3ba879643

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