ezmsg-sigproc 1.2.2__tar.gz → 1.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ezmsg_sigproc-1.3.1/.github/workflows/python-publish-ezmsg-sigproc.yml +30 -0
- ezmsg_sigproc-1.3.1/.github/workflows/python-tests.yml +43 -0
- ezmsg_sigproc-1.3.1/.gitignore +145 -0
- ezmsg_sigproc-1.3.1/.pre-commit-config.yaml +10 -0
- ezmsg_sigproc-1.3.1/PKG-INFO +59 -0
- ezmsg_sigproc-1.3.1/README.md +39 -0
- ezmsg_sigproc-1.3.1/pyproject.toml +50 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/__init__.py +1 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/__version__.py +16 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/activation.py +75 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/affinetransform.py +234 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/aggregate.py +158 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/bandpower.py +74 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/base.py +38 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/butterworthfilter.py +157 -0
- {ezmsg-sigproc-1.2.2 → ezmsg_sigproc-1.3.1/src}/ezmsg/sigproc/decimate.py +7 -4
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/downsample.py +107 -0
- {ezmsg-sigproc-1.2.2 → ezmsg_sigproc-1.3.1/src}/ezmsg/sigproc/ewmfilter.py +38 -16
- {ezmsg-sigproc-1.2.2 → ezmsg_sigproc-1.3.1/src}/ezmsg/sigproc/filter.py +108 -20
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/filterbank.py +278 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/math/__init__.py +0 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/math/abs.py +28 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/math/clip.py +30 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/math/difference.py +60 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/math/invert.py +29 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/math/log.py +32 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/math/scale.py +31 -0
- {ezmsg-sigproc-1.2.2 → ezmsg_sigproc-1.3.1/src}/ezmsg/sigproc/messages.py +2 -3
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/sampler.py +322 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/scaler.py +173 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/signalinjector.py +64 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/slicer.py +133 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/spectral.py +6 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/spectrogram.py +86 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/spectrum.py +259 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/synth.py +605 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/wavelets.py +167 -0
- ezmsg_sigproc-1.3.1/src/ezmsg/sigproc/window.py +282 -0
- ezmsg_sigproc-1.3.1/tests/conftest.py +4 -0
- ezmsg_sigproc-1.3.1/tests/helpers/__init__.py +0 -0
- ezmsg_sigproc-1.3.1/tests/helpers/util.py +104 -0
- ezmsg_sigproc-1.3.1/tests/resources/xform.csv +65 -0
- ezmsg_sigproc-1.3.1/tests/test_activation.py +47 -0
- ezmsg_sigproc-1.3.1/tests/test_affine_transform.py +123 -0
- ezmsg_sigproc-1.3.1/tests/test_aggregate.py +133 -0
- ezmsg_sigproc-1.3.1/tests/test_bandpower.py +69 -0
- ezmsg_sigproc-1.3.1/tests/test_butter.py +140 -0
- {ezmsg-sigproc-1.2.2 → ezmsg_sigproc-1.3.1}/tests/test_butterworth.py +10 -13
- ezmsg_sigproc-1.3.1/tests/test_downsample.py +191 -0
- ezmsg_sigproc-1.3.1/tests/test_filterbank.py +119 -0
- ezmsg_sigproc-1.3.1/tests/test_math.py +86 -0
- ezmsg_sigproc-1.3.1/tests/test_sampler.py +189 -0
- ezmsg_sigproc-1.3.1/tests/test_scaler.py +132 -0
- ezmsg_sigproc-1.3.1/tests/test_slicer.py +78 -0
- ezmsg_sigproc-1.3.1/tests/test_spectrogram.py +92 -0
- ezmsg_sigproc-1.3.1/tests/test_spectrum.py +275 -0
- ezmsg_sigproc-1.3.1/tests/test_synth.py +381 -0
- ezmsg_sigproc-1.3.1/tests/test_wavelets.py +132 -0
- ezmsg_sigproc-1.3.1/tests/test_window.py +380 -0
- ezmsg_sigproc-1.3.1/uv.lock +595 -0
- ezmsg-sigproc-1.2.2/PKG-INFO +0 -36
- ezmsg-sigproc-1.2.2/README.md +0 -17
- ezmsg-sigproc-1.2.2/ezmsg/sigproc/__init__.py +0 -1
- ezmsg-sigproc-1.2.2/ezmsg/sigproc/__version__.py +0 -1
- ezmsg-sigproc-1.2.2/ezmsg/sigproc/butterworthfilter.py +0 -66
- ezmsg-sigproc-1.2.2/ezmsg/sigproc/downsample.py +0 -63
- ezmsg-sigproc-1.2.2/ezmsg/sigproc/sampler.py +0 -287
- ezmsg-sigproc-1.2.2/ezmsg/sigproc/spectral.py +0 -132
- ezmsg-sigproc-1.2.2/ezmsg/sigproc/synth.py +0 -411
- ezmsg-sigproc-1.2.2/ezmsg/sigproc/window.py +0 -144
- ezmsg-sigproc-1.2.2/ezmsg_sigproc.egg-info/PKG-INFO +0 -36
- ezmsg-sigproc-1.2.2/ezmsg_sigproc.egg-info/SOURCES.txt +0 -25
- ezmsg-sigproc-1.2.2/ezmsg_sigproc.egg-info/dependency_links.txt +0 -1
- ezmsg-sigproc-1.2.2/ezmsg_sigproc.egg-info/not-zip-safe +0 -1
- ezmsg-sigproc-1.2.2/ezmsg_sigproc.egg-info/requires.txt +0 -7
- ezmsg-sigproc-1.2.2/ezmsg_sigproc.egg-info/top_level.txt +0 -1
- ezmsg-sigproc-1.2.2/setup.cfg +0 -31
- ezmsg-sigproc-1.2.2/setup.py +0 -7
- ezmsg-sigproc-1.2.2/tests/test_downsample.py +0 -132
- ezmsg-sigproc-1.2.2/tests/test_window.py +0 -139
- {ezmsg-sigproc-1.2.2 → ezmsg_sigproc-1.3.1}/LICENSE.txt +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# This workflow will upload a Python Package using Twine when a release is created
|
|
2
|
+
|
|
3
|
+
name: Upload Python Package - ezmsg-sigproc
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
release:
|
|
7
|
+
types: [published]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
deploy:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Install uv
|
|
21
|
+
uses: astral-sh/setup-uv@v2
|
|
22
|
+
|
|
23
|
+
- name: Build Package
|
|
24
|
+
run: uv build
|
|
25
|
+
|
|
26
|
+
- name: Publish Package
|
|
27
|
+
env:
|
|
28
|
+
TWINE_USERNAME: __token__
|
|
29
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
30
|
+
run: uvx twine upload dist/*
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: Test package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches:
|
|
8
|
+
- main
|
|
9
|
+
- dev
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
python-version: [3.9, "3.10", "3.11", "3.12"]
|
|
17
|
+
os:
|
|
18
|
+
- "ubuntu-latest"
|
|
19
|
+
- "windows-latest"
|
|
20
|
+
- "macos-latest"
|
|
21
|
+
runs-on: ${{matrix.os}}
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
|
|
26
|
+
- name: Install uv
|
|
27
|
+
uses: astral-sh/setup-uv@v2
|
|
28
|
+
with:
|
|
29
|
+
enable-cache: true
|
|
30
|
+
cache-dependency-glob: "uv.lock"
|
|
31
|
+
|
|
32
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
33
|
+
run: uv python install ${{ matrix.python-version }}
|
|
34
|
+
|
|
35
|
+
- name: Install the project
|
|
36
|
+
run: uv sync --all-extras --dev
|
|
37
|
+
|
|
38
|
+
- name: Lint
|
|
39
|
+
run:
|
|
40
|
+
uv tool run ruff check --output-format=github src
|
|
41
|
+
|
|
42
|
+
- name: Run tests
|
|
43
|
+
run: uv run pytest tests
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
docs/source/_build
|
|
74
|
+
docs/source/generated
|
|
75
|
+
|
|
76
|
+
# PyBuilder
|
|
77
|
+
.pybuilder/
|
|
78
|
+
target/
|
|
79
|
+
|
|
80
|
+
# Jupyter Notebook
|
|
81
|
+
.ipynb_checkpoints
|
|
82
|
+
|
|
83
|
+
# IPython
|
|
84
|
+
profile_default/
|
|
85
|
+
ipython_config.py
|
|
86
|
+
|
|
87
|
+
# pyenv
|
|
88
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
89
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
90
|
+
# .python-version
|
|
91
|
+
|
|
92
|
+
# pipenv
|
|
93
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
94
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
95
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
96
|
+
# install all needed dependencies.
|
|
97
|
+
#Pipfile.lock
|
|
98
|
+
|
|
99
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
100
|
+
__pypackages__/
|
|
101
|
+
|
|
102
|
+
# Celery stuff
|
|
103
|
+
celerybeat-schedule
|
|
104
|
+
celerybeat.pid
|
|
105
|
+
|
|
106
|
+
# SageMath parsed files
|
|
107
|
+
*.sage.py
|
|
108
|
+
|
|
109
|
+
# Environments
|
|
110
|
+
.env
|
|
111
|
+
.venv
|
|
112
|
+
env/
|
|
113
|
+
venv/
|
|
114
|
+
ENV/
|
|
115
|
+
env.bak/
|
|
116
|
+
venv.bak/
|
|
117
|
+
|
|
118
|
+
# Spyder project settings
|
|
119
|
+
.spyderproject
|
|
120
|
+
.spyproject
|
|
121
|
+
|
|
122
|
+
# Rope project settings
|
|
123
|
+
.ropeproject
|
|
124
|
+
|
|
125
|
+
# mkdocs documentation
|
|
126
|
+
/site
|
|
127
|
+
|
|
128
|
+
# mypy
|
|
129
|
+
.mypy_cache/
|
|
130
|
+
.dmypy.json
|
|
131
|
+
dmypy.json
|
|
132
|
+
|
|
133
|
+
# Pyre type checker
|
|
134
|
+
.pyre/
|
|
135
|
+
|
|
136
|
+
# pytype static type analyzer
|
|
137
|
+
.pytype/
|
|
138
|
+
|
|
139
|
+
# Cython debug symbols
|
|
140
|
+
cython_debug/
|
|
141
|
+
|
|
142
|
+
# JetBrains
|
|
143
|
+
.idea/
|
|
144
|
+
|
|
145
|
+
src/ezmsg/sigproc/__version__.py
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: ezmsg-sigproc
|
|
3
|
+
Version: 1.3.1
|
|
4
|
+
Summary: Timeseries signal processing implementations in ezmsg
|
|
5
|
+
Author-email: Griffin Milsap <griffin.milsap@gmail.com>, Preston Peranich <pperanich@gmail.com>, Chadwick Boulay <chadwick.boulay@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE.txt
|
|
8
|
+
Requires-Python: >=3.9
|
|
9
|
+
Requires-Dist: ezmsg>=3.5.0
|
|
10
|
+
Requires-Dist: numpy>=2.0.2
|
|
11
|
+
Requires-Dist: pywavelets>=1.6.0
|
|
12
|
+
Requires-Dist: scipy>=1.13.1
|
|
13
|
+
Provides-Extra: test
|
|
14
|
+
Requires-Dist: flake8>=7.1.1; extra == 'test'
|
|
15
|
+
Requires-Dist: frozendict>=2.4.4; extra == 'test'
|
|
16
|
+
Requires-Dist: pytest-asyncio>=0.24.0; extra == 'test'
|
|
17
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == 'test'
|
|
18
|
+
Requires-Dist: pytest>=8.3.3; extra == 'test'
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# ezmsg.sigproc
|
|
22
|
+
|
|
23
|
+
Timeseries signal processing implementations for ezmsg
|
|
24
|
+
|
|
25
|
+
## Dependencies
|
|
26
|
+
|
|
27
|
+
* `ezmsg`
|
|
28
|
+
* `numpy`
|
|
29
|
+
* `scipy`
|
|
30
|
+
* `pywavelets`
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
### Release
|
|
35
|
+
|
|
36
|
+
Install the latest release from pypi with: `pip install ezmsg-sigproc` (or `uv add ...` or `poetry add ...`).
|
|
37
|
+
|
|
38
|
+
### Development Version
|
|
39
|
+
|
|
40
|
+
You can add the development version of `ezmsg-sigproc` to your project's dependencies in one of several ways.
|
|
41
|
+
|
|
42
|
+
You can clone it and add its path to your project dependencies. You may wish to do this if you intend to edit `ezmsg-sigproc`. If so, please refer to the [Developers](#developers) section below.
|
|
43
|
+
|
|
44
|
+
You can also add it directly from GitHub:
|
|
45
|
+
|
|
46
|
+
* Using `pip`: `pip install git+https://github.com/ezmsg-org/ezmsg-sigproc.git@dev`
|
|
47
|
+
* Using `poetry`: `poetry add "git+https://github.com/ezmsg-org/ezmsg-sigproc.git@dev"`
|
|
48
|
+
* Using `uv`: `uv add git+https://github.com/ezmsg-org/ezmsg-sigproc --branch dev`
|
|
49
|
+
|
|
50
|
+
## Developers
|
|
51
|
+
|
|
52
|
+
We use [`uv`](https://docs.astral.sh/uv/getting-started/installation/) for development. It is not strictly required, but if you intend to contribute to ezmsg-sigproc then using `uv` will lead to the smoothest collaboration.
|
|
53
|
+
|
|
54
|
+
1. Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/) if not already installed.
|
|
55
|
+
2. Fork ezmsg-sigproc and clone your fork to your local computer.
|
|
56
|
+
3. Open a terminal and `cd` to the cloned folder.
|
|
57
|
+
4. `uv sync` to create a .venv and install dependencies.
|
|
58
|
+
5. `uv run pre-commit install` to install pre-commit hooks to do linting and formatting.
|
|
59
|
+
6. After editing code and making commits, Run the test suite before making a PR: `uv run pytest tests`
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# ezmsg.sigproc
|
|
2
|
+
|
|
3
|
+
Timeseries signal processing implementations for ezmsg
|
|
4
|
+
|
|
5
|
+
## Dependencies
|
|
6
|
+
|
|
7
|
+
* `ezmsg`
|
|
8
|
+
* `numpy`
|
|
9
|
+
* `scipy`
|
|
10
|
+
* `pywavelets`
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
### Release
|
|
15
|
+
|
|
16
|
+
Install the latest release from pypi with: `pip install ezmsg-sigproc` (or `uv add ...` or `poetry add ...`).
|
|
17
|
+
|
|
18
|
+
### Development Version
|
|
19
|
+
|
|
20
|
+
You can add the development version of `ezmsg-sigproc` to your project's dependencies in one of several ways.
|
|
21
|
+
|
|
22
|
+
You can clone it and add its path to your project dependencies. You may wish to do this if you intend to edit `ezmsg-sigproc`. If so, please refer to the [Developers](#developers) section below.
|
|
23
|
+
|
|
24
|
+
You can also add it directly from GitHub:
|
|
25
|
+
|
|
26
|
+
* Using `pip`: `pip install git+https://github.com/ezmsg-org/ezmsg-sigproc.git@dev`
|
|
27
|
+
* Using `poetry`: `poetry add "git+https://github.com/ezmsg-org/ezmsg-sigproc.git@dev"`
|
|
28
|
+
* Using `uv`: `uv add git+https://github.com/ezmsg-org/ezmsg-sigproc --branch dev`
|
|
29
|
+
|
|
30
|
+
## Developers
|
|
31
|
+
|
|
32
|
+
We use [`uv`](https://docs.astral.sh/uv/getting-started/installation/) for development. It is not strictly required, but if you intend to contribute to ezmsg-sigproc then using `uv` will lead to the smoothest collaboration.
|
|
33
|
+
|
|
34
|
+
1. Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/) if not already installed.
|
|
35
|
+
2. Fork ezmsg-sigproc and clone your fork to your local computer.
|
|
36
|
+
3. Open a terminal and `cd` to the cloned folder.
|
|
37
|
+
4. `uv sync` to create a .venv and install dependencies.
|
|
38
|
+
5. `uv run pre-commit install` to install pre-commit hooks to do linting and formatting.
|
|
39
|
+
6. After editing code and making commits, Run the test suite before making a PR: `uv run pytest tests`
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "ezmsg-sigproc"
|
|
3
|
+
description = "Timeseries signal processing implementations in ezmsg"
|
|
4
|
+
authors = [
|
|
5
|
+
{ name = "Griffin Milsap", email = "griffin.milsap@gmail.com" },
|
|
6
|
+
{ name = "Preston Peranich", email = "pperanich@gmail.com" },
|
|
7
|
+
{ name = "Chadwick Boulay", email = "chadwick.boulay@gmail.com" }
|
|
8
|
+
]
|
|
9
|
+
license = "MIT"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
dynamic = ["version"]
|
|
13
|
+
dependencies = [
|
|
14
|
+
"ezmsg>=3.5.0",
|
|
15
|
+
"numpy>=2.0.2",
|
|
16
|
+
"pywavelets>=1.6.0",
|
|
17
|
+
"scipy>=1.13.1",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[project.optional-dependencies]
|
|
21
|
+
test = [
|
|
22
|
+
"flake8>=7.1.1",
|
|
23
|
+
"frozendict>=2.4.4",
|
|
24
|
+
"pytest-asyncio>=0.24.0",
|
|
25
|
+
"pytest-cov>=5.0.0",
|
|
26
|
+
"pytest>=8.3.3",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[build-system]
|
|
30
|
+
requires = ["hatchling", "hatch-vcs"]
|
|
31
|
+
build-backend = "hatchling.build"
|
|
32
|
+
|
|
33
|
+
[tool.hatch.version]
|
|
34
|
+
source = "vcs"
|
|
35
|
+
|
|
36
|
+
[tool.hatch.build.hooks.vcs]
|
|
37
|
+
version-file = "src/ezmsg/sigproc/__version__.py"
|
|
38
|
+
|
|
39
|
+
[tool.hatch.build.targets.wheel]
|
|
40
|
+
packages = ["src/ezmsg"]
|
|
41
|
+
|
|
42
|
+
[tool.uv]
|
|
43
|
+
dev-dependencies = [
|
|
44
|
+
"pre-commit>=3.8.0",
|
|
45
|
+
"ruff>=0.6.7",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[tool.pytest.ini_options]
|
|
49
|
+
norecursedirs = "tests/helpers"
|
|
50
|
+
addopts = "-p no:warnings"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .__version__ import __version__ as __version__
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# file generated by setuptools_scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
TYPE_CHECKING = False
|
|
4
|
+
if TYPE_CHECKING:
|
|
5
|
+
from typing import Tuple, Union
|
|
6
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
7
|
+
else:
|
|
8
|
+
VERSION_TUPLE = object
|
|
9
|
+
|
|
10
|
+
version: str
|
|
11
|
+
__version__: str
|
|
12
|
+
__version_tuple__: VERSION_TUPLE
|
|
13
|
+
version_tuple: VERSION_TUPLE
|
|
14
|
+
|
|
15
|
+
__version__ = version = '1.3.1'
|
|
16
|
+
__version_tuple__ = version_tuple = (1, 3, 1)
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
from dataclasses import replace
|
|
2
|
+
import typing
|
|
3
|
+
|
|
4
|
+
import numpy as np
|
|
5
|
+
import scipy.special
|
|
6
|
+
import ezmsg.core as ez
|
|
7
|
+
from ezmsg.util.messages.axisarray import AxisArray
|
|
8
|
+
from ezmsg.util.generator import consumer
|
|
9
|
+
|
|
10
|
+
from .spectral import OptionsEnum
|
|
11
|
+
from .base import GenAxisArray
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ActivationFunction(OptionsEnum):
|
|
15
|
+
"""Activation (transformation) function."""
|
|
16
|
+
|
|
17
|
+
NONE = "none"
|
|
18
|
+
"""None."""
|
|
19
|
+
|
|
20
|
+
SIGMOID = "sigmoid"
|
|
21
|
+
""":obj:`scipy.special.expit`"""
|
|
22
|
+
|
|
23
|
+
EXPIT = "expit"
|
|
24
|
+
""":obj:`scipy.special.expit`"""
|
|
25
|
+
|
|
26
|
+
LOGIT = "logit"
|
|
27
|
+
""":obj:`scipy.special.logit`"""
|
|
28
|
+
|
|
29
|
+
LOGEXPIT = "log_expit"
|
|
30
|
+
""":obj:`scipy.special.log_expit`"""
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
ACTIVATIONS = {
|
|
34
|
+
ActivationFunction.NONE: lambda x: x,
|
|
35
|
+
ActivationFunction.SIGMOID: scipy.special.expit,
|
|
36
|
+
ActivationFunction.EXPIT: scipy.special.expit,
|
|
37
|
+
ActivationFunction.LOGIT: scipy.special.logit,
|
|
38
|
+
ActivationFunction.LOGEXPIT: scipy.special.log_expit,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@consumer
|
|
43
|
+
def activation(
|
|
44
|
+
function: typing.Union[str, ActivationFunction],
|
|
45
|
+
) -> typing.Generator[AxisArray, AxisArray, None]:
|
|
46
|
+
if type(function) is ActivationFunction:
|
|
47
|
+
func = ACTIVATIONS[function]
|
|
48
|
+
else:
|
|
49
|
+
# str type. There's probably an easier way to support either enum or str argument. Oh well this works.
|
|
50
|
+
function: str = function.lower()
|
|
51
|
+
if function not in ActivationFunction.options():
|
|
52
|
+
raise ValueError(
|
|
53
|
+
f"Unrecognized activation function {function}. Must be one of {ACTIVATIONS.keys()}"
|
|
54
|
+
)
|
|
55
|
+
function = list(ACTIVATIONS.keys())[
|
|
56
|
+
ActivationFunction.options().index(function)
|
|
57
|
+
]
|
|
58
|
+
func = ACTIVATIONS[function]
|
|
59
|
+
|
|
60
|
+
msg_out = AxisArray(np.array([]), dims=[""])
|
|
61
|
+
|
|
62
|
+
while True:
|
|
63
|
+
msg_in: AxisArray = yield msg_out
|
|
64
|
+
msg_out = replace(msg_in, data=func(msg_in.data))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class ActivationSettings(ez.Settings):
|
|
68
|
+
function: str = ActivationFunction.NONE
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class Activation(GenAxisArray):
|
|
72
|
+
SETTINGS = ActivationSettings
|
|
73
|
+
|
|
74
|
+
def construct_generator(self):
|
|
75
|
+
self.STATE.gen = activation(function=self.SETTINGS.function)
|