waveforge 0.1.0__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.
- waveforge-0.1.0/.github/workflows/ci.yml +39 -0
- waveforge-0.1.0/.github/workflows/python-publish.yml +47 -0
- waveforge-0.1.0/.gitignore +218 -0
- waveforge-0.1.0/.pre-commit-config.yaml +7 -0
- waveforge-0.1.0/LICENSE +21 -0
- waveforge-0.1.0/PKG-INFO +198 -0
- waveforge-0.1.0/README.md +187 -0
- waveforge-0.1.0/pyproject.toml +50 -0
- waveforge-0.1.0/pyrightconfig.json +14 -0
- waveforge-0.1.0/src/waveforge/__init__.py +6 -0
- waveforge-0.1.0/src/waveforge/models.py +35 -0
- waveforge-0.1.0/src/waveforge/py.typed +0 -0
- waveforge-0.1.0/src/waveforge/wavelets/__init__.py +0 -0
- waveforge-0.1.0/src/waveforge/wavelets/quadratic_spline/__init__.py +13 -0
- waveforge-0.1.0/src/waveforge/wavelets/quadratic_spline/generator.py +91 -0
- waveforge-0.1.0/src/waveforge/wavelets/quadratic_spline/loader.py +39 -0
- waveforge-0.1.0/tests/test_models.py +79 -0
- waveforge-0.1.0/tests/wavelets/quadratic_spline/test_generator.py +88 -0
- waveforge-0.1.0/tests/wavelets/quadratic_spline/test_loader.py +77 -0
- waveforge-0.1.0/uv.lock +391 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
test:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- name: Cache uv dependencies
|
|
15
|
+
uses: actions/cache@v4
|
|
16
|
+
with:
|
|
17
|
+
path: |
|
|
18
|
+
~/.cache/uv
|
|
19
|
+
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
20
|
+
restore-keys: |
|
|
21
|
+
uv-${{ runner.os }}-
|
|
22
|
+
|
|
23
|
+
- name: Install uv
|
|
24
|
+
uses: astral-sh/setup-uv@v5
|
|
25
|
+
|
|
26
|
+
- name: Setup Python
|
|
27
|
+
run: uv python install
|
|
28
|
+
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: uv sync --all-groups
|
|
31
|
+
|
|
32
|
+
- name: Ruff
|
|
33
|
+
run: uv run ruff check .
|
|
34
|
+
|
|
35
|
+
- name: Pyright
|
|
36
|
+
run: uv run pyright
|
|
37
|
+
|
|
38
|
+
- name: Pytest
|
|
39
|
+
run: uv run pytest
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: Upload Python Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
release-build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Install uv
|
|
17
|
+
uses: astral-sh/setup-uv@v5
|
|
18
|
+
|
|
19
|
+
- name: Build release distributions
|
|
20
|
+
run: uv build
|
|
21
|
+
|
|
22
|
+
- name: Upload distributions
|
|
23
|
+
uses: actions/upload-artifact@v4
|
|
24
|
+
with:
|
|
25
|
+
name: release-dists
|
|
26
|
+
path: dist/
|
|
27
|
+
|
|
28
|
+
pypi-publish:
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
needs:
|
|
31
|
+
- release-build
|
|
32
|
+
permissions:
|
|
33
|
+
id-token: write
|
|
34
|
+
environment:
|
|
35
|
+
name: pypi
|
|
36
|
+
url: https://pypi.org/p/waveforge
|
|
37
|
+
steps:
|
|
38
|
+
- name: Retrieve release distributions
|
|
39
|
+
uses: actions/download-artifact@v4
|
|
40
|
+
with:
|
|
41
|
+
name: release-dists
|
|
42
|
+
path: dist/
|
|
43
|
+
|
|
44
|
+
- name: Publish release distributions to PyPI
|
|
45
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
46
|
+
with:
|
|
47
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
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
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
# Temporary file for partial code execution
|
|
204
|
+
tempCodeRunnerFile.py
|
|
205
|
+
|
|
206
|
+
# Ruff stuff:
|
|
207
|
+
.ruff_cache/
|
|
208
|
+
|
|
209
|
+
# PyPI configuration file
|
|
210
|
+
.pypirc
|
|
211
|
+
|
|
212
|
+
# Marimo
|
|
213
|
+
marimo/_static/
|
|
214
|
+
marimo/_lsp/
|
|
215
|
+
__marimo__/
|
|
216
|
+
|
|
217
|
+
# Streamlit
|
|
218
|
+
.streamlit/secrets.toml
|
waveforge-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Agra Yuda
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
waveforge-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: waveforge
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A toolkit for generating and managing DWT configurations.
|
|
5
|
+
Author-email: Agra Bima Yuda <hub.agrayuda@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.14
|
|
9
|
+
Requires-Dist: pydantic>=2.14.4
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# WaveForge
|
|
13
|
+
|
|
14
|
+
A Python toolkit for generating, storing, and loading Discrete Wavelet Transform (DWT) coefficient configurations.
|
|
15
|
+
|
|
16
|
+
## Overview
|
|
17
|
+
|
|
18
|
+
WaveForge provides a structured approach to managing DWT filter coefficient configurations across different wavelet families.
|
|
19
|
+
|
|
20
|
+
Currently, WaveForge implements the **Quadratic Spline Wavelet** coefficient generator, supporting the generation of coefficient configurations at multiple scales. Configurations can be saved as JSON files and loaded back into validated Python objects using Pydantic.
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- Generate Quadratic Spline DWT coefficients for individual scales.
|
|
25
|
+
- Generate coefficient configurations across multiple scales.
|
|
26
|
+
- Automatically generate configuration filenames based on wavelet metadata.
|
|
27
|
+
- Save coefficient configurations as JSON files.
|
|
28
|
+
- Load and validate coefficient configurations from JSON files.
|
|
29
|
+
- Validate configuration structures using Pydantic.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Clone the repository:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
git clone <repository-url>
|
|
37
|
+
cd waveforge
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Install the package in editable mode:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install -e .
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
### 1. Generate Coefficient Configurations
|
|
49
|
+
|
|
50
|
+
Generate coefficients for a specific scale:
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from waveforge.wavelets.quadratic_spline import (
|
|
54
|
+
generate_scale_configuration
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
scale_config = generate_scale_configuration(3)
|
|
58
|
+
|
|
59
|
+
print(scale_config)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Generate configurations from scale 1 up to a specified maximum scale:
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from waveforge.wavelets.quadratic_spline import (
|
|
66
|
+
generate_coefficients
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
config = generate_coefficients(5)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 2. Save Coefficient Configurations
|
|
73
|
+
|
|
74
|
+
Save a configuration as a JSON file:
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from waveforge.wavelets.quadratic_spline import (
|
|
78
|
+
generate_coefficients,
|
|
79
|
+
save_coefficients
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
config = generate_coefficients(5)
|
|
83
|
+
|
|
84
|
+
output_path = save_coefficients(config)
|
|
85
|
+
|
|
86
|
+
print(output_path)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
By default, the file is saved in the current working directory.
|
|
90
|
+
|
|
91
|
+
You can also specify a destination directory:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
output_path = save_coefficients(
|
|
95
|
+
config,
|
|
96
|
+
dir="data/coefficients"
|
|
97
|
+
)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The filename is automatically generated using the wavelet name, configuration version, and scale range.
|
|
101
|
+
|
|
102
|
+
Example:
|
|
103
|
+
|
|
104
|
+
```text
|
|
105
|
+
quadratic_spline_v1.0_scales_1-5.json
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 3. Load Coefficient Configurations
|
|
109
|
+
|
|
110
|
+
Load a previously saved configuration:
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
from waveforge.wavelets.quadratic_spline import (
|
|
114
|
+
load_coefficients
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
config = load_coefficients(
|
|
118
|
+
"quadratic_spline_v1.0_scales_1-5.json"
|
|
119
|
+
)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
You can also specify the directory containing the JSON file:
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
config = load_coefficients(
|
|
126
|
+
"quadratic_spline_v1.0_scales_1-5.json",
|
|
127
|
+
dir="data/coefficients"
|
|
128
|
+
)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
The loader reconstructs and validates the configuration using Pydantic.
|
|
132
|
+
|
|
133
|
+
## Configuration Models
|
|
134
|
+
|
|
135
|
+
WaveForge uses two primary data models:
|
|
136
|
+
|
|
137
|
+
| Model | Description |
|
|
138
|
+
|---|---|
|
|
139
|
+
| `ScaleConfiguration` | Represents DWT filter coefficients and their associated parameters at a specific scale. |
|
|
140
|
+
| `DWTConfiguration` | Represents a complete DWT configuration containing coefficient data across multiple scales. |
|
|
141
|
+
|
|
142
|
+
Both models are available directly from the main package:
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
from waveforge import DWTConfiguration, ScaleConfiguration
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Project Structure
|
|
149
|
+
|
|
150
|
+
```text
|
|
151
|
+
waveforge/
|
|
152
|
+
├── pyproject.toml
|
|
153
|
+
├── README.md
|
|
154
|
+
├── src/
|
|
155
|
+
│ └── waveforge/
|
|
156
|
+
│ ├── __init__.py
|
|
157
|
+
│ ├── models.py
|
|
158
|
+
│ ├── wavelets/
|
|
159
|
+
│ │ ├── __init__.py
|
|
160
|
+
│ │ └── quadratic_spline/
|
|
161
|
+
│ │ ├── __init__.py
|
|
162
|
+
│ │ ├── generator.py
|
|
163
|
+
│ │ └── loader.py
|
|
164
|
+
│ └── data/
|
|
165
|
+
└── tests/
|
|
166
|
+
├── test_models.py
|
|
167
|
+
└── wavelets/
|
|
168
|
+
└── quadratic_spline/
|
|
169
|
+
├── test_generator.py
|
|
170
|
+
└── test_loader.py
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Testing
|
|
174
|
+
|
|
175
|
+
WaveForge uses `pytest` for automated testing.
|
|
176
|
+
|
|
177
|
+
Install pytest:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
pip install pytest
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Run the test suite from the project root:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
pytest -v
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Dependencies
|
|
190
|
+
|
|
191
|
+
- Python 3.10 or later
|
|
192
|
+
- Pydantic 2.x
|
|
193
|
+
- pytest (development and testing)
|
|
194
|
+
|
|
195
|
+
## License
|
|
196
|
+
|
|
197
|
+
No license has been specified yet.
|
|
198
|
+
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# WaveForge
|
|
2
|
+
|
|
3
|
+
A Python toolkit for generating, storing, and loading Discrete Wavelet Transform (DWT) coefficient configurations.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
WaveForge provides a structured approach to managing DWT filter coefficient configurations across different wavelet families.
|
|
8
|
+
|
|
9
|
+
Currently, WaveForge implements the **Quadratic Spline Wavelet** coefficient generator, supporting the generation of coefficient configurations at multiple scales. Configurations can be saved as JSON files and loaded back into validated Python objects using Pydantic.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- Generate Quadratic Spline DWT coefficients for individual scales.
|
|
14
|
+
- Generate coefficient configurations across multiple scales.
|
|
15
|
+
- Automatically generate configuration filenames based on wavelet metadata.
|
|
16
|
+
- Save coefficient configurations as JSON files.
|
|
17
|
+
- Load and validate coefficient configurations from JSON files.
|
|
18
|
+
- Validate configuration structures using Pydantic.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
Clone the repository:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
git clone <repository-url>
|
|
26
|
+
cd waveforge
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Install the package in editable mode:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install -e .
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
### 1. Generate Coefficient Configurations
|
|
38
|
+
|
|
39
|
+
Generate coefficients for a specific scale:
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from waveforge.wavelets.quadratic_spline import (
|
|
43
|
+
generate_scale_configuration
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
scale_config = generate_scale_configuration(3)
|
|
47
|
+
|
|
48
|
+
print(scale_config)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Generate configurations from scale 1 up to a specified maximum scale:
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from waveforge.wavelets.quadratic_spline import (
|
|
55
|
+
generate_coefficients
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
config = generate_coefficients(5)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 2. Save Coefficient Configurations
|
|
62
|
+
|
|
63
|
+
Save a configuration as a JSON file:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from waveforge.wavelets.quadratic_spline import (
|
|
67
|
+
generate_coefficients,
|
|
68
|
+
save_coefficients
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
config = generate_coefficients(5)
|
|
72
|
+
|
|
73
|
+
output_path = save_coefficients(config)
|
|
74
|
+
|
|
75
|
+
print(output_path)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
By default, the file is saved in the current working directory.
|
|
79
|
+
|
|
80
|
+
You can also specify a destination directory:
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
output_path = save_coefficients(
|
|
84
|
+
config,
|
|
85
|
+
dir="data/coefficients"
|
|
86
|
+
)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The filename is automatically generated using the wavelet name, configuration version, and scale range.
|
|
90
|
+
|
|
91
|
+
Example:
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
quadratic_spline_v1.0_scales_1-5.json
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 3. Load Coefficient Configurations
|
|
98
|
+
|
|
99
|
+
Load a previously saved configuration:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from waveforge.wavelets.quadratic_spline import (
|
|
103
|
+
load_coefficients
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
config = load_coefficients(
|
|
107
|
+
"quadratic_spline_v1.0_scales_1-5.json"
|
|
108
|
+
)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
You can also specify the directory containing the JSON file:
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
config = load_coefficients(
|
|
115
|
+
"quadratic_spline_v1.0_scales_1-5.json",
|
|
116
|
+
dir="data/coefficients"
|
|
117
|
+
)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The loader reconstructs and validates the configuration using Pydantic.
|
|
121
|
+
|
|
122
|
+
## Configuration Models
|
|
123
|
+
|
|
124
|
+
WaveForge uses two primary data models:
|
|
125
|
+
|
|
126
|
+
| Model | Description |
|
|
127
|
+
|---|---|
|
|
128
|
+
| `ScaleConfiguration` | Represents DWT filter coefficients and their associated parameters at a specific scale. |
|
|
129
|
+
| `DWTConfiguration` | Represents a complete DWT configuration containing coefficient data across multiple scales. |
|
|
130
|
+
|
|
131
|
+
Both models are available directly from the main package:
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from waveforge import DWTConfiguration, ScaleConfiguration
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Project Structure
|
|
138
|
+
|
|
139
|
+
```text
|
|
140
|
+
waveforge/
|
|
141
|
+
├── pyproject.toml
|
|
142
|
+
├── README.md
|
|
143
|
+
├── src/
|
|
144
|
+
│ └── waveforge/
|
|
145
|
+
│ ├── __init__.py
|
|
146
|
+
│ ├── models.py
|
|
147
|
+
│ ├── wavelets/
|
|
148
|
+
│ │ ├── __init__.py
|
|
149
|
+
│ │ └── quadratic_spline/
|
|
150
|
+
│ │ ├── __init__.py
|
|
151
|
+
│ │ ├── generator.py
|
|
152
|
+
│ │ └── loader.py
|
|
153
|
+
│ └── data/
|
|
154
|
+
└── tests/
|
|
155
|
+
├── test_models.py
|
|
156
|
+
└── wavelets/
|
|
157
|
+
└── quadratic_spline/
|
|
158
|
+
├── test_generator.py
|
|
159
|
+
└── test_loader.py
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Testing
|
|
163
|
+
|
|
164
|
+
WaveForge uses `pytest` for automated testing.
|
|
165
|
+
|
|
166
|
+
Install pytest:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
pip install pytest
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Run the test suite from the project root:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
pytest -v
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Dependencies
|
|
179
|
+
|
|
180
|
+
- Python 3.10 or later
|
|
181
|
+
- Pydantic 2.x
|
|
182
|
+
- pytest (development and testing)
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
No license has been specified yet.
|
|
187
|
+
|