Skip to main content

Binary file reader for NeurOne Tesla EEG data

Project description

pyneurone_tools

Python package Upload Python Package

A simple python library to read Bittium NeurOne Tesla EEG system binary data

Function overview

Basic Usage

from pyneurone_tools import neurone_tools
from pathlib import Path

session_path = Path('./exciting_project/exciting_data/2022-01-03T090018')
recording_id = 1

nt = neurone_tools(session_path, recording_id, channels='all')

loading data

data, channel_names = nt.load_data()

The data has the shape (samples, channels), unit is nanovolt.

loading events

events = nt.load_events()

Evens are returned as a pandas DataFrame.
The columns are:

revision: Event marker revision number
type: Type of event marker
source_port: Source port number
channel_number: Channel used for event marking
8bit_trigger_code: The 8-bit TTL trigger code if the marker has one, otherwise None
start_sample_index: sample point where trigger occured
stop_sample_index: sample point where trigger ended
description_length: length of event comment (string in recording system)
description_offset: offset of event comment (string in recording system)
data_length: length of additional data of event (any binary data)
data_offset: offset of additional data of event (any binary data)
source_port_name: name of the channel from channel_number
description: name of the event marker type

sampling rate

fsample = nt.get_sampling_rate()

loading channel names

channel_names = nt.channels_avail

loading alternating current (AC) mode flags

ac_mode = nt.get_ac_mode()

loading filter parameters

filter_settings = nt.get_filter_settings()

Terminology

The following terms are used in this package

Session

A session is the top-level term, think of it as the folder containing all the other files.
It is started when you click 'Start' in the recording software and can be made up from several recordings.

Recording

A recording is what you get when you press the 'Record' button and ends when you click the 'Stop Recording' button.
Recording ID numbers are 1-indexed, as defined by the recording software.

Binary File

A Recording can be split into several Binary files, as one can be specified in the NeurOne recording software. Binary file IDs are 1-indexed, as this is given by the recording software.
It is unikely that the user would ever need to access these files directly.

Installation

Supported Python Versions

This code is tested on python versions 3.7, 3.8, 3.9, and 3.10.
Earlier versions could be usable, but need an older version of pandas.

Using pip

pip install neurone_tools

pip directly from github

pip install git+https://github.com/jkschluesener/pyneurone_tools.git@master

pip without PyPi

cd <your_preferred_code_folder>
git clone https://github.com/jkschluesener/pyneurone_tools.git
pip install ./pyneurone_tools/

Development mode

Link this repo's folder into your current python with the -e (external) flag.

cd <your_preferred_code_folder>
git clone https://github.com/jkschluesener/pyneurone_tools.git
pip install -e ./pyneurone_tools/

or use ssh if you prefer

cd <your_preferred_code_folder>
git clone git@github.com:jkschluesener/pyneurone_tools.git
pip install -e pyneurone_tools

Changes to this directory will be available without reinstall.
Upon local changes of the code, you may have to re-import this package or maybe restart your python kernel.

Adding functionality

Is there a funcitonality you would like to see in this package?
Just open an Issue for us / me to discuss and implement it.

License

This code is GPLv3 licensed.

Layout of the binary files was taken from the official NeurOne manual.
This code is also in parts derived from the original Bittium / Mega Electronics Ltd matlab toolbox (official / mirror) to map integer ID codes to their string counterparts.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neurone_tools-1.1.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neurone_tools-1.1-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file neurone_tools-1.1.tar.gz.

File metadata

  • Download URL: neurone_tools-1.1.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for neurone_tools-1.1.tar.gz
Algorithm Hash digest
SHA256 dbf4aa68acb67f23a9563a3e28b97744c1002d8c7572432c6066ebd08eebcba1
MD5 17968edd3695af609ff1616b6125c23a
BLAKE2b-256 82e1885967e22eb3414b8718ebcb930b6a410879ef5f13090f74f8ed853ce9ee

See more details on using hashes here.

File details

Details for the file neurone_tools-1.1-py3-none-any.whl.

File metadata

  • Download URL: neurone_tools-1.1-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for neurone_tools-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 07af39d5cdf36304502ca1108b22f2fdd313538b55ca53f9fd8b2ba47d7ced6a
MD5 6b165f4ec15b528a18a4bc4edc112a36
BLAKE2b-256 1d9ac52bc5f869b2645a3bbcc8461e911fd9bbc003d253d53dae584c05d72b19

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page