Load and stream data from neo files into ezmsg.
Project description
ezmsg-neo
Load and stream data from neo files into ezmsg.
Installation
pip install ezmsg-neo
Or install the latest development version:
pip install git+https://github.com/ezmsg-org/ezmsg-neo@dev
Dependencies
Usage
ezmsg-neo modules are available under import ezmsg.neo
Add the NeoIteratorUnit to your ezmsg graph as a data source. You may be interested in other ezmsg extensions for processing the data, such as ezmsg-sigproc and ezmsg-event.
import ezmsg.core as ez
from ezmsg.neo.source import NeoIteratorUnit
from ezmsg.util.messages.key import FilterOnKey
from ezmsg.util.debuglog import DebugLog
from ezmsg.event.rate import EventRate
comps = {
"NEO": NeoIteratorUnit(filepath="path/to/file", chunk_dur=0.05),
"FILTER": FilterOnKey(key="spike"),
"RATE": EventRate(bin_duration=0.05),
"LOG": DebugLog() # Print the output to the console
}
conns = (
(comps["NEO"].OUTPUT_SIGNAL, comps["FILTER"].INPUT_SIGNAL),
(comps["FILTER"].OUTPUT_SIGNAL, comps["RATE"].INPUT_SIGNAL),
(comps["RATE"].OUTPUT_SIGNAL, comps["LOG"].INPUT),
)
ez.run(components=comps, connections=conns)
Standalone
The NeoIterator class can be used outside ezmsg for offline processing:
from ezmsg.neo.source import NeoIterator, NeoIteratorSettings
from ezmsg.util.messages.axisarray import AxisArray
settings = NeoIteratorSettings(filepath="data.nev", chunk_dur=0.05)
neo_iter = NeoIterator(settings)
# Filter messages by key (e.g., "ns3" for analog signals, "spike" for spikes)
sig_msgs = [msg for msg in neo_iter if msg.key.startswith("ns")]
# Concatenate all chunks into a single AxisArray
full_signal = AxisArray.concatenate(*sig_msgs, dim="time")
NeoIterator Messages
The NeuoIteratorUnit and NeoIterator objects, when called, return AxisArray messages with a key attribute identifying the signal type:
- Analog signals - Key matches the stream name (e.g.,
"ns3"). Data shape:(n_samples, n_channels) - Spike trains - Key is
"spike". Data is a sparse array with shape(n_units, n_samples) - Events - Key is
"events". Data contains event labels and itstimeaxis is irregular (CoordinateAxis) with timestamps associated with each event.
Development
- Clone this repo and
cdinto it uv syncto setup your environmentuv run pytest teststo run the tests- (Optional) Install pre-commit hooks:
uv run pre-commit install
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ezmsg_neo-0.5.0.tar.gz.
File metadata
- Download URL: ezmsg_neo-0.5.0.tar.gz
- Upload date:
- Size: 6.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1ed7705473fa3795f444c434d9a9905abef8677d4810445df9151e3f6e1d746
|
|
| MD5 |
2d86f4c862af4c6a4cf8e0bf42e8d6be
|
|
| BLAKE2b-256 |
ff561fbad0a4381fbf419abc7589448f5a02c58ae4e6cdce4f7e4e9558b440b5
|
File details
Details for the file ezmsg_neo-0.5.0-py3-none-any.whl.
File metadata
- Download URL: ezmsg_neo-0.5.0-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c041af81577b02dececa130585b7e17760b22be6dfae27dcbd57feeeeb40d4bb
|
|
| MD5 |
7bdb3786ec230189b9394fe927700e34
|
|
| BLAKE2b-256 |
03350e720f698ee024826523d209f8d22cb8b45865dc8885475f235e525a2f8f
|