fbscatnet 1.0.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.
@@ -0,0 +1,20 @@
1
+ name: CI
2
+ on: [push, pull_request]
3
+
4
+ jobs:
5
+ test:
6
+ runs-on: ubuntu-latest
7
+ strategy:
8
+ matrix:
9
+ python-version: ["3.10", "3.11", "3.12"]
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ with:
13
+ fetch-depth: 0 # needed for hatch-vcs to see git tags
14
+ - uses: actions/setup-python@v5
15
+ with:
16
+ python-version: ${{ matrix.python-version }}
17
+ - run: pip install -e ".[dev]"
18
+ - run: ruff check .
19
+ - run: mypy src/
20
+ - run: pytest -v
@@ -0,0 +1,36 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*' # Triggers on any tag pushed to GitHub (v0.1, v1.0, v1.3.2, etc.)
7
+
8
+ jobs:
9
+ pypi-publish:
10
+ name: Build and publish Python distribution
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ id-token: write # REQUIRED for Trusted Publishing
14
+ contents: read
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ with:
19
+ fetch-depth: 0 # Needed so hatch-vcs gets the version right!
20
+
21
+ - name: Set up Python
22
+ uses: actions/setup-python@v5
23
+ with:
24
+ python-version: "3.10"
25
+
26
+ - name: Install build tools
27
+ run: python -m pip install build
28
+
29
+ - name: Build wheel and sdist
30
+ run: python -m build
31
+
32
+ - name: Publish package
33
+ # This matches tags with exactly two numbers (e.g., v1.0, v2.1)
34
+ # and skips three-part tags (e.g., v1.3.2) or zero-prefixed versions.
35
+ if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '.') && !contains(github.ref, 'v0.')
36
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,39 @@
1
+ name: Build and Deploy Sphinx Docs
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+
7
+ permissions:
8
+ contents: write
9
+ pages: write
10
+ id-token: write
11
+
12
+ jobs:
13
+ build-and-deploy:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - name: Checkout repository
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: '3.12'
23
+ cache: 'pip'
24
+
25
+ - name: Install dependencies
26
+ run: |
27
+ pip install .[docs]
28
+
29
+ - name: Build Sphinx Documentation
30
+ run: |
31
+ cd docs
32
+ sphinx-build -b html . _build
33
+
34
+ - name: Deploy to GitHub Pages
35
+ uses: peaceiris/actions-gh-pages@v4
36
+ with:
37
+ github_token: ${{ secrets.GITHUB_TOKEN }}
38
+ publish_dir: docs/_build
39
+ force_orphan: true
@@ -0,0 +1,38 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .eggs/
6
+
7
+ # Virtual environments
8
+ .venv/
9
+ venv/
10
+
11
+ # Build artifacts
12
+ build/
13
+ dist/
14
+ *.whl
15
+
16
+ # Testing / coverage
17
+ .pytest_cache/
18
+ .mypy_cache/
19
+ .ruff_cache/
20
+ htmlcov/
21
+ .coverage
22
+
23
+ # Docs build output
24
+ docs/_build/
25
+
26
+ # IDE
27
+ .vscode/
28
+ .idea/
29
+
30
+ # OS
31
+ .DS_Store
32
+ Thumbs.db
33
+
34
+ # Features output (from save_embeddings)
35
+ features/
36
+
37
+ # Models
38
+ models/
@@ -0,0 +1,12 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.6.9
4
+ hooks:
5
+ - id: ruff
6
+ args: [ --fix ]
7
+ - id: ruff-format
8
+ - repo: https://github.com/pre-commit/mirrors-mypy
9
+ rev: v1.11.2
10
+ hooks:
11
+ - id: mypy
12
+ additional_dependencies: [types-tqdm, scipy-stubs, numpy]
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ## [Released]
4
+
5
+ ## [1.0.0] - 2026-07-31
6
+ ### Added
7
+ - Push first production version to PyPI
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Marcel Venturotti
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.
@@ -0,0 +1,120 @@
1
+ Metadata-Version: 2.4
2
+ Name: fbscatnet
3
+ Version: 1.0.0
4
+ Summary: Fourier-Bessel wavelet scattering transforms
5
+ Project-URL: Homepage, https://github.com/Smee18/FourierBesselWavelets
6
+ Project-URL: Repository, https://github.com/Smee18/FourierBesselWavelets.git
7
+ Project-URL: Issues, https://github.com/Smee18/FourierBesselWavelets/issues
8
+ Author-email: Marcel Venturotti <mv514@bath.ac.uk>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: fourier-bessel,image-processing,machine-learning,scattering-transform,wavelets
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
19
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: joblib>=1.3
22
+ Requires-Dist: matplotlib>=3.7
23
+ Requires-Dist: numpy>=1.24
24
+ Requires-Dist: scipy>=1.10
25
+ Requires-Dist: tqdm>=4.65
26
+ Provides-Extra: dev
27
+ Requires-Dist: build; extra == 'dev'
28
+ Requires-Dist: mypy; extra == 'dev'
29
+ Requires-Dist: pre-commit; extra == 'dev'
30
+ Requires-Dist: pytest; extra == 'dev'
31
+ Requires-Dist: ruff; extra == 'dev'
32
+ Requires-Dist: scipy-stubs; extra == 'dev'
33
+ Requires-Dist: types-tqdm; extra == 'dev'
34
+ Provides-Extra: docs
35
+ Requires-Dist: sphinx; extra == 'docs'
36
+ Requires-Dist: sphinx-autobuild; extra == 'docs'
37
+ Requires-Dist: sphinx-rtd-theme; extra == 'docs'
38
+ Provides-Extra: gpu
39
+ Requires-Dist: cupy-cuda12x>=11.0; extra == 'gpu'
40
+ Description-Content-Type: text/markdown
41
+
42
+ # fbscatnet
43
+
44
+ [![PyPI version](https://img.shields.io/pypi/v/fbscatnet.svg)](https://pypi.org/project/fbscatnet/)
45
+ [![Python Versions](https://img.shields.io/pypi/pyversions/fbscatnet.svg)](https://pypi.org/project/fbscatnet/)
46
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
47
+ [![CI](https://github.com/Smee18/FourierBesselWavelets/actions/workflows/ci.yml/badge.svg)](https://github.com/Smee18/FourierBesselWavelets/actions/workflows/ci.yml)
48
+ [![Code style: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
49
+
50
+ `fbscatnet` is a high-performance Python library for computing **Fourier-Bessel wavelet scattering transforms**. It generates robust, feature embeddings from 2D images, making it an ideal feature extractor for computer vision, biomedical imaging, and physics-based machine learning. This is a brand new project of mine that I have been working on for some time. I would love any criticism, improvements, corrections to both the code and the maths.
51
+
52
+ ## Features
53
+
54
+ - **Novel Wavelet:** New wavelet relying on Bessel basis functions.
55
+ - **Hardware Accelerated:** Seamlessly switch between multi-core CPU execution (`scipy`/`joblib`) and GPU acceleration (`cupy`).
56
+ - **Highly Optimized:** Vectorised filtering in the frequency domain for maximum throughput across large image batches.
57
+ - **ML-Ready:** Outputs flattened feature arrays directly compatible with `scikit-learn`, `xgboost`, or `pytorch`.
58
+
59
+ ## Installation
60
+
61
+ Install the base package (CPU-only) via pip:
62
+
63
+ ```bash
64
+ pip install fbscatnet
65
+ ```
66
+
67
+ To enable **GPU acceleration**, install with the `gpu` extra (requires a CUDA-compatible GPU):
68
+
69
+ ```bash
70
+ pip install fbscatnet[gpu]
71
+ ```
72
+
73
+ ## Quickstart
74
+
75
+ Extracting features from a dataset takes just a few lines of code:
76
+
77
+ ```python
78
+ import numpy as np
79
+ import logging
80
+ from fbscatnet import FourierBesselWaveletBank, FourierBesselScatNet, logger_config
81
+ logger_config.enable_colored_logs(logging.DEBUG) # IMPORTANT: SET TO SEE LOGS
82
+
83
+ # 1. Create some dummy image data (e.g., 10 grayscale images of size 64x64)
84
+ images = np.random.rand(10, 64, 64)
85
+
86
+ # 2. Instantiate a Fourier-Bessel Wavelet Bank
87
+ # size: spatial dimension (64x64), m: angular order, k: radial roots
88
+ bank = FourierBesselWaveletBank(size=64, m=2, k=2, sigma=0.1)
89
+
90
+ # 3. Initialize the Scattering Network
91
+ # Use backend="gpu" if you installed with CuPy
92
+ net = FourierBesselScatNet(bank=bank, backend="cpu")
93
+
94
+ # 4. Generate feature embeddings
95
+ # downsize: spatial pooling factor (must evenly divide the image size)
96
+ features = net.generate_embeddings(images, downsize=4, use_multiprocessing=True)
97
+
98
+ print(f"Generated embeddings shape: {features.shape}")
99
+ # Output: (10, feature_dimension)
100
+ ```
101
+
102
+ ## Visualising Wavelet Maps
103
+
104
+ If you want to inspect how the wavelet filters are interacting with your image at the first scattering order, `fbscatnet` includes a built-in plotting tool:
105
+
106
+ ```python
107
+ # Pass a single 2D image to visualize
108
+ single_image = images[0]
109
+ net.visualise_maps(single_image, downsize=4)
110
+ ```
111
+
112
+ ## API Overview
113
+
114
+ Sphinx documentation at: https://smee18.github.io/FourierBesselWavelets/
115
+
116
+ The `example` folder also contains a full pipeline, classifying MNIST using the library
117
+ The pdf of my notes taken along this project contains an in-depth explanation of the mathematics behind these wavelets. Here you can find all derivations, proofs and useful information. Some stuff might seem trivial but my goal is to really expose all aspects so anyone new to wavelet theory can understand the mathematics behind these Fourier Bessel wavelets.
118
+
119
+ ## License
120
+ This project is licensed under the MIT License.
@@ -0,0 +1,79 @@
1
+ # fbscatnet
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/fbscatnet.svg)](https://pypi.org/project/fbscatnet/)
4
+ [![Python Versions](https://img.shields.io/pypi/pyversions/fbscatnet.svg)](https://pypi.org/project/fbscatnet/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![CI](https://github.com/Smee18/FourierBesselWavelets/actions/workflows/ci.yml/badge.svg)](https://github.com/Smee18/FourierBesselWavelets/actions/workflows/ci.yml)
7
+ [![Code style: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
8
+
9
+ `fbscatnet` is a high-performance Python library for computing **Fourier-Bessel wavelet scattering transforms**. It generates robust, feature embeddings from 2D images, making it an ideal feature extractor for computer vision, biomedical imaging, and physics-based machine learning. This is a brand new project of mine that I have been working on for some time. I would love any criticism, improvements, corrections to both the code and the maths.
10
+
11
+ ## Features
12
+
13
+ - **Novel Wavelet:** New wavelet relying on Bessel basis functions.
14
+ - **Hardware Accelerated:** Seamlessly switch between multi-core CPU execution (`scipy`/`joblib`) and GPU acceleration (`cupy`).
15
+ - **Highly Optimized:** Vectorised filtering in the frequency domain for maximum throughput across large image batches.
16
+ - **ML-Ready:** Outputs flattened feature arrays directly compatible with `scikit-learn`, `xgboost`, or `pytorch`.
17
+
18
+ ## Installation
19
+
20
+ Install the base package (CPU-only) via pip:
21
+
22
+ ```bash
23
+ pip install fbscatnet
24
+ ```
25
+
26
+ To enable **GPU acceleration**, install with the `gpu` extra (requires a CUDA-compatible GPU):
27
+
28
+ ```bash
29
+ pip install fbscatnet[gpu]
30
+ ```
31
+
32
+ ## Quickstart
33
+
34
+ Extracting features from a dataset takes just a few lines of code:
35
+
36
+ ```python
37
+ import numpy as np
38
+ import logging
39
+ from fbscatnet import FourierBesselWaveletBank, FourierBesselScatNet, logger_config
40
+ logger_config.enable_colored_logs(logging.DEBUG) # IMPORTANT: SET TO SEE LOGS
41
+
42
+ # 1. Create some dummy image data (e.g., 10 grayscale images of size 64x64)
43
+ images = np.random.rand(10, 64, 64)
44
+
45
+ # 2. Instantiate a Fourier-Bessel Wavelet Bank
46
+ # size: spatial dimension (64x64), m: angular order, k: radial roots
47
+ bank = FourierBesselWaveletBank(size=64, m=2, k=2, sigma=0.1)
48
+
49
+ # 3. Initialize the Scattering Network
50
+ # Use backend="gpu" if you installed with CuPy
51
+ net = FourierBesselScatNet(bank=bank, backend="cpu")
52
+
53
+ # 4. Generate feature embeddings
54
+ # downsize: spatial pooling factor (must evenly divide the image size)
55
+ features = net.generate_embeddings(images, downsize=4, use_multiprocessing=True)
56
+
57
+ print(f"Generated embeddings shape: {features.shape}")
58
+ # Output: (10, feature_dimension)
59
+ ```
60
+
61
+ ## Visualising Wavelet Maps
62
+
63
+ If you want to inspect how the wavelet filters are interacting with your image at the first scattering order, `fbscatnet` includes a built-in plotting tool:
64
+
65
+ ```python
66
+ # Pass a single 2D image to visualize
67
+ single_image = images[0]
68
+ net.visualise_maps(single_image, downsize=4)
69
+ ```
70
+
71
+ ## API Overview
72
+
73
+ Sphinx documentation at: https://smee18.github.io/FourierBesselWavelets/
74
+
75
+ The `example` folder also contains a full pipeline, classifying MNIST using the library
76
+ The pdf of my notes taken along this project contains an in-depth explanation of the mathematics behind these wavelets. Here you can find all derivations, proofs and useful information. Some stuff might seem trivial but my goal is to really expose all aspects so anyone new to wavelet theory can understand the mathematics behind these Fourier Bessel wavelets.
77
+
78
+ ## License
79
+ This project is licensed under the MIT License.
@@ -0,0 +1,43 @@
1
+ import os
2
+ import sys
3
+ from importlib.metadata import PackageNotFoundError
4
+ from importlib.metadata import version as get_installed_version
5
+
6
+ project = "fbscatnet"
7
+ copyright = "2026, Marcel Venturotti"
8
+ author = "Marcel Venturotti"
9
+ try:
10
+ release = get_installed_version("fbscatnet")
11
+ except PackageNotFoundError:
12
+ release = "0.0.0"
13
+
14
+ sys.path.insert(0, os.path.abspath("../src"))
15
+
16
+ extensions = [
17
+ "sphinx.ext.autodoc",
18
+ "sphinx.ext.napoleon", # Supports Google and NumPy style docstrings
19
+ "sphinx.ext.viewcode", # Adds links to highlighted source code
20
+ "sphinx.ext.intersphinx", # Links to external documentation (e.g., Python standard library)
21
+ "sphinx.ext.autosummary", # Generates stub files for autodoc automatically
22
+ ]
23
+
24
+ # --- Autodoc Customisation ---
25
+ # Controls how members (functions, classes) are ordered in the docs
26
+ autodoc_member_order = "bysource" # Options: 'alphabetical', 'bysource', 'groupwise'
27
+
28
+ # Default flags used by all autodoc directives (e.g., show member type hints)
29
+ autodoc_typehints = "description" # Options: 'signature', 'description', 'none', 'both'
30
+
31
+ # Automatically mock imports that might not be installed in the readthedocs/build environment
32
+ autodoc_mock_imports = []
33
+
34
+ # --- Intersphinx Mapping ---
35
+ # Allows linking to Python's built-in types and other libraries
36
+ intersphinx_mapping = {
37
+ "python": ("https://docs.python.org/3", None),
38
+ "numpy": ("https://numpy.org/doc/stable/", None),
39
+ }
40
+
41
+ html_theme = "sphinx_rtd_theme"
42
+
43
+ autosummary_generate = True
@@ -0,0 +1,35 @@
1
+ Welcome to fbscatnet's Documentation!
2
+ =====================================
3
+
4
+ .. toctree::
5
+ :maxdepth: 2
6
+ :caption: Contents:
7
+
8
+ API Reference
9
+ =============
10
+
11
+ This section documents the core modules of the ``fbscatnet`` package.
12
+
13
+ Generate Bank
14
+ -------------
15
+
16
+ .. automodule:: fbscatnet.generate_bank
17
+ :members:
18
+ :undoc-members:
19
+ :show-inheritance:
20
+
21
+ Scatnet
22
+ -------
23
+
24
+ .. automodule:: fbscatnet.scatnet
25
+ :members:
26
+ :undoc-members:
27
+ :show-inheritance:
28
+
29
+
30
+ Indices and Tables
31
+ ==================
32
+
33
+ * :ref:`genindex`
34
+ * :ref:`modindex`
35
+ * :ref:`search`