Base processor classes and protocols for ezmsg signal processing pipelines
Project description
ezmsg-baseproc
Base processor classes and protocols for building signal processing pipelines in ezmsg.
Installation
pip install ezmsg-baseproc
Overview
This package provides the foundational processor architecture for ezmsg signal processing:
- Protocols - Type definitions for processors, transformers, consumers, and producers
- Base Classes - Abstract base classes for building stateless and stateful processors
- Composite Processors - Classes for chaining processors into pipelines
- Unit Wrappers - ezmsg Unit base classes that wrap processors for graph integration
Module Structure
ezmsg.baseproc/
├── protocols.py # Protocol definitions and type variables
├── processor.py # Base non-stateful processors
├── stateful.py # Stateful processor base classes
├── composite.py # CompositeProcessor and CompositeProducer
├── units.py # ezmsg Unit wrappers
└── util/
├── asio.py # Async/sync utilities
├── message.py # SampleMessage definitions
├── profile.py # Profiling decorators
└── typeresolution.py # Type resolution helpers
Usage
Creating a Simple Transformer
from dataclasses import dataclass
from ezmsg.baseproc import BaseTransformer
from ezmsg.util.messages.axisarray import AxisArray
@dataclass
class MySettings:
scale: float = 1.0
class MyTransformer(BaseTransformer[MySettings, AxisArray, AxisArray]):
def _process(self, message: AxisArray) -> AxisArray:
return message.replace(data=message.data * self.settings.scale)
Creating a Stateful Transformer
from ezmsg.baseproc import BaseStatefulTransformer, processor_state
@processor_state
class MyState:
count: int = 0
hash: int = -1
class MyStatefulTransformer(BaseStatefulTransformer[MySettings, AxisArray, AxisArray, MyState]):
def _reset_state(self, message: AxisArray) -> None:
self._state.count = 0
def _process(self, message: AxisArray) -> AxisArray:
self._state.count += 1
return message
Creating an ezmsg Unit
from ezmsg.baseproc import BaseTransformerUnit
class MyUnit(BaseTransformerUnit[MySettings, AxisArray, AxisArray, MyTransformer]):
SETTINGS = MySettings
# That's all - the base class handles everything else!
Development
We use uv for development.
- Install
uvif not already installed - Clone and cd into the repository
- Run
uv syncto create a.venvand install dependencies - Run
uv run pytest teststo run tests
License
MIT License - see LICENSE for details.
Project details
Release history Release notifications | RSS feed
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_baseproc-1.0.2.tar.gz.
File metadata
- Download URL: ezmsg_baseproc-1.0.2.tar.gz
- Upload date:
- Size: 32.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","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 |
da31267992eb9eb72c6aaeda267462d61ba98eb6949f70fbc495602b912affcd
|
|
| MD5 |
f5a1e0949e80dfe6fc0260220444049a
|
|
| BLAKE2b-256 |
2c72ab1fadd704d2682b1a7ba8c631e96aa7d8226c25e90aa31fdafef678ae28
|
File details
Details for the file ezmsg_baseproc-1.0.2-py3-none-any.whl.
File metadata
- Download URL: ezmsg_baseproc-1.0.2-py3-none-any.whl
- Upload date:
- Size: 22.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","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 |
ecd9b0925c87d1f86160ab788c969cb3b2b3bfcd39c14a9cd91fd949469f1b0a
|
|
| MD5 |
d71ba7e956db4b4138dc9db600b26169
|
|
| BLAKE2b-256 |
3397e7bcedf622e67a4c0908cb7bf25de02272e40f884a4a72dddad40fbace52
|