curvelets 1.1__tar.gz → 1.2__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.
- {curvelets-1.1 → curvelets-1.2}/.pre-commit-config.yaml +5 -2
- {curvelets-1.1 → curvelets-1.2}/.readthedocs.yaml +11 -9
- {curvelets-1.1 → curvelets-1.2}/AUTHORS.md +4 -0
- {curvelets-1.1 → curvelets-1.2}/Makefile +3 -2
- {curvelets-1.1 → curvelets-1.2}/PKG-INFO +1 -24
- curvelets-1.2/PULL_REQUEST_TEMPLATE.md +8 -0
- curvelets-1.2/docs/api/curvelets.numpy.rst +18 -0
- {curvelets-1.1/docs/source → curvelets-1.2/docs/api}/curvelets.torch.rst +8 -2
- {curvelets-1.1/docs/source → curvelets-1.2/docs/api}/modules.rst +2 -2
- {curvelets-1.1 → curvelets-1.2}/docs/conf.py +47 -1
- curvelets-1.2/docs/contributing.rst +187 -0
- {curvelets-1.1 → curvelets-1.2}/docs/index.rst +8 -1
- {curvelets-1.1 → curvelets-1.2}/examples/plot_01_zone_plate.py +20 -1
- {curvelets-1.1 → curvelets-1.2}/examples/plot_02_direction_resolution.py +60 -42
- {curvelets-1.1 → curvelets-1.2}/examples/plot_03_direction_disk.py +22 -15
- {curvelets-1.1 → curvelets-1.2}/examples/plot_04_meyer_wavelet.py +15 -15
- {curvelets-1.1 → curvelets-1.2}/examples/plot_05_curvelet_vs_wavelet.py +12 -14
- {curvelets-1.1 → curvelets-1.2}/examples/plot_06_monogenic_curvelet.py +10 -5
- {curvelets-1.1 → curvelets-1.2}/examples/plot_07_monogenic_verification.py +43 -26
- {curvelets-1.1 → curvelets-1.2}/examples/plot_08_window_overlap_heatmap.py +4 -3
- {curvelets-1.1 → curvelets-1.2}/examples/plot_10_udct_mnist.py +15 -7
- curvelets-1.2/examples/plot_11_udct_denoise.py +122 -0
- {curvelets-1.1 → curvelets-1.2}/noxfile.py +16 -16
- {curvelets-1.1 → curvelets-1.2}/pyproject.toml +39 -8
- curvelets-1.2/src/curvelets/_version.py +24 -0
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/numpy/__init__.py +3 -2
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/numpy/_backward_transform.py +141 -234
- curvelets-1.2/src/curvelets/numpy/_backward_transform_monogenic.py +242 -0
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/numpy/_forward_transform.py +209 -300
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/numpy/_meyerwavelet.py +10 -10
- curvelets-1.2/src/curvelets/numpy/_periodized_fft.py +128 -0
- curvelets-1.2/src/curvelets/numpy/_sparse_window.py +581 -0
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/numpy/_udct.py +255 -115
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/numpy/_udct_windows.py +142 -147
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/numpy/_utils.py +33 -56
- curvelets-1.2/src/curvelets/numpy/typing.py +162 -0
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/plot/_curvelet.py +44 -14
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/torch/__init__.py +3 -2
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/torch/_backward_transform.py +127 -169
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/torch/_forward_transform.py +90 -112
- curvelets-1.2/src/curvelets/torch/_periodized_fft.py +165 -0
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/torch/_riesz.py +4 -1
- curvelets-1.2/src/curvelets/torch/_sparse_window.py +657 -0
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/torch/_udct.py +180 -66
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/torch/_udct_module.py +24 -7
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/torch/_udct_windows.py +66 -48
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/torch/_utils.py +0 -19
- curvelets-1.2/src/curvelets/torch/typing.py +47 -0
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/utils/_utils.py +2 -2
- {curvelets-1.1 → curvelets-1.2}/tests/numpy/conftest.py +30 -40
- {curvelets-1.1 → curvelets-1.2}/tests/numpy/test_compute_optimal_window_overlap.py +25 -10
- {curvelets-1.1 → curvelets-1.2}/tests/numpy/test_mudct_round_trip.py +47 -28
- {curvelets-1.1 → curvelets-1.2}/tests/numpy/test_numpy_refactor_udct_methods.py +1 -1
- {curvelets-1.1 → curvelets-1.2}/tests/numpy/test_nwedges_4_5.py +5 -7
- curvelets-1.2/tests/numpy/test_periodized_fft.py +148 -0
- {curvelets-1.1 → curvelets-1.2}/tests/numpy/test_plot_integration.py +7 -2
- {curvelets-1.1 → curvelets-1.2}/tests/numpy/test_round_trip_numpy.py +59 -5
- curvelets-1.2/tests/numpy/test_sparse_window.py +94 -0
- {curvelets-1.1 → curvelets-1.2}/tests/numpy/test_typing.py +6 -12
- {curvelets-1.1 → curvelets-1.2}/tests/numpy/test_udct_integration_public_methods.py +86 -29
- {curvelets-1.1 → curvelets-1.2}/tests/numpy/test_udct_windows_typing.py +39 -43
- {curvelets-1.1 → curvelets-1.2}/tests/numpy_torch_comparison/test_udct_comparison.py +5 -8
- {curvelets-1.1 → curvelets-1.2}/tests/numpy_torch_comparison/test_udct_windows_comparison.py +10 -3
- curvelets-1.2/tests/torch/test_periodized_fft.py +142 -0
- {curvelets-1.1 → curvelets-1.2}/tests/torch/test_round_trip_torch.py +46 -5
- curvelets-1.2/tests/torch/test_sparse_window.py +98 -0
- {curvelets-1.1 → curvelets-1.2}/tests/torch/test_udct_integration_public_methods.py +95 -2
- {curvelets-1.1 → curvelets-1.2}/tests/torch/test_udct_module_apply.py +8 -8
- curvelets-1.1/docs/source/curvelets.numpy.rst +0 -7
- curvelets-1.1/src/curvelets/_version.py +0 -34
- curvelets-1.1/src/curvelets/numpy/_backward_transform_monogenic.py +0 -269
- curvelets-1.1/src/curvelets/numpy/_typing.py +0 -136
- curvelets-1.1/src/curvelets/torch/_typing.py +0 -25
- curvelets-1.1/tests/numpy/test_udct_from_sparse.py +0 -120
- {curvelets-1.1 → curvelets-1.2}/.git_archival.txt +0 -0
- {curvelets-1.1 → curvelets-1.2}/.gitattributes +0 -0
- {curvelets-1.1 → curvelets-1.2}/.gitignore +0 -0
- {curvelets-1.1 → curvelets-1.2}/LICENSE +0 -0
- {curvelets-1.1 → curvelets-1.2}/README.md +0 -0
- {curvelets-1.1/docs/source → curvelets-1.2/docs/api}/curvelets.plot.rst +0 -0
- {curvelets-1.1/docs/source → curvelets-1.2/docs/api}/curvelets.rst +0 -0
- {curvelets-1.1/docs/source → curvelets-1.2/docs/api}/curvelets.utils.rst +0 -0
- {curvelets-1.1 → curvelets-1.2}/docs/curvelet_faqs.rst +0 -0
- {curvelets-1.1 → curvelets-1.2}/docs/montage_all_border.png +0 -0
- {curvelets-1.1 → curvelets-1.2}/docs/references.bib +0 -0
- {curvelets-1.1 → curvelets-1.2}/docs/requirements.txt +0 -0
- {curvelets-1.1 → curvelets-1.2}/docs/table.md +0 -0
- {curvelets-1.1 → curvelets-1.2}/examples/README.rst +0 -0
- {curvelets-1.1 → curvelets-1.2}/examples/plot_09_udct_module_gradcheck.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/__init__.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/_internal.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/_version.pyi +0 -0
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/numpy/_riesz.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/plot/__init__.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/plot/_matplotlib.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/py.typed +0 -0
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/torch/_meyerwavelet.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/src/curvelets/utils/__init__.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/tests/__init__.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/tests/conftest.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/tests/numpy/__init__.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/tests/numpy/test_meyerwavelet.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/tests/numpy/test_numpy_refactor_errors.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/tests/numpy/test_package.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/tests/numpy/test_transform_errors.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/tests/numpy/test_udct_errors.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/tests/numpy/test_utils.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/tests/numpy/test_utils_integration.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/tests/numpy_torch_comparison/__init__.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/tests/numpy_torch_comparison/conftest.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/tests/numpy_torch_comparison/test_riesz_comparison.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/tests/numpy_torch_comparison/test_utils_comparison.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/tests/torch/__init__.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/tests/torch/conftest.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/tests/torch/test_meyerwavelet.py +0 -0
- {curvelets-1.1 → curvelets-1.2}/tests/torch/test_udct_module_gradcheck.py +0 -0
|
@@ -45,11 +45,14 @@ repos:
|
|
|
45
45
|
rev: "v1.15.0"
|
|
46
46
|
hooks:
|
|
47
47
|
- id: mypy
|
|
48
|
-
args: ["--follow-imports=skip"]
|
|
48
|
+
args: ["--follow-imports=skip", "--cache-dir=/dev/null"]
|
|
49
49
|
exclude: src/curvelets/reference|noxfile.py
|
|
50
50
|
additional_dependencies:
|
|
51
51
|
- pytest
|
|
52
|
-
|
|
52
|
+
- numpy
|
|
53
|
+
- scipy
|
|
54
|
+
- scipy-stubs
|
|
55
|
+
- types-docutils
|
|
53
56
|
|
|
54
57
|
- repo: https://github.com/codespell-project/codespell
|
|
55
58
|
rev: "v2.4.1"
|
|
@@ -4,20 +4,22 @@
|
|
|
4
4
|
version: 2
|
|
5
5
|
|
|
6
6
|
build:
|
|
7
|
-
os: ubuntu-
|
|
7
|
+
os: ubuntu-24.04
|
|
8
8
|
tools:
|
|
9
9
|
python: "3.11"
|
|
10
|
+
jobs:
|
|
11
|
+
pre_create_environment:
|
|
12
|
+
- pip install uv
|
|
13
|
+
create_environment:
|
|
14
|
+
- uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
|
|
15
|
+
install:
|
|
16
|
+
- uv pip install --python "${READTHEDOCS_VIRTUALENV_PATH}/bin/python" -e .
|
|
17
|
+
- uv pip install --python "${READTHEDOCS_VIRTUALENV_PATH}/bin/python" -r docs/requirements.txt
|
|
18
|
+
- uv pip install --python "${READTHEDOCS_VIRTUALENV_PATH}/bin/python" --group docs
|
|
19
|
+
|
|
10
20
|
sphinx:
|
|
11
21
|
configuration: docs/conf.py
|
|
12
22
|
|
|
13
|
-
python:
|
|
14
|
-
install:
|
|
15
|
-
- method: pip
|
|
16
|
-
path: .
|
|
17
|
-
extra_requirements:
|
|
18
|
-
- docs
|
|
19
|
-
- requirements: docs/requirements.txt
|
|
20
|
-
|
|
21
23
|
# Version Management:
|
|
22
24
|
# - The version is dynamically generated by hatch-vcs from git tags during pip install
|
|
23
25
|
# - When building from an exact tag (e.g., v0.1.0b2), the version is clean: "0.1.0b2"
|
|
@@ -51,10 +51,11 @@ pylint:
|
|
|
51
51
|
|
|
52
52
|
doc:
|
|
53
53
|
make uvcheck
|
|
54
|
-
|
|
54
|
+
make cleandoc
|
|
55
|
+
unset NO_COLOR FORCE_COLOR; $(UV) tool run nox -s build_api_docs && $(UV) tool run nox -s docs
|
|
55
56
|
|
|
56
57
|
cleandoc:
|
|
57
|
-
rm -rf docs/_build docs/
|
|
58
|
+
rm -rf docs/_build docs/api docs/auto_examples
|
|
58
59
|
|
|
59
60
|
servedocs:
|
|
60
61
|
make uvcheck
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: curvelets
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2
|
|
4
4
|
Summary: Open source implementation of the uniform discrete curvelet transform in Python.
|
|
5
5
|
Project-URL: Homepage, https://github.com/cako/curvelets
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/cako/curvelets/issues
|
|
@@ -50,29 +50,6 @@ Classifier: Typing :: Typed
|
|
|
50
50
|
Requires-Python: >=3.9
|
|
51
51
|
Requires-Dist: numpy>=1.20
|
|
52
52
|
Requires-Dist: typing-extensions; python_version <= '3.10'
|
|
53
|
-
Provides-Extra: dev
|
|
54
|
-
Requires-Dist: coverage>=7.7.0; extra == 'dev'
|
|
55
|
-
Requires-Dist: pytest-cov>=3; extra == 'dev'
|
|
56
|
-
Requires-Dist: pytest>=6; extra == 'dev'
|
|
57
|
-
Provides-Extra: docs
|
|
58
|
-
Requires-Dist: furo>=2023.08.17; extra == 'docs'
|
|
59
|
-
Requires-Dist: matplotlib; extra == 'docs'
|
|
60
|
-
Requires-Dist: myst-parser; extra == 'docs'
|
|
61
|
-
Requires-Dist: scikit-learn; extra == 'docs'
|
|
62
|
-
Requires-Dist: sphinx-autodoc-typehints; extra == 'docs'
|
|
63
|
-
Requires-Dist: sphinx-copybutton; extra == 'docs'
|
|
64
|
-
Requires-Dist: sphinx-gallery; extra == 'docs'
|
|
65
|
-
Requires-Dist: sphinx>=8.2.1; extra == 'docs'
|
|
66
|
-
Requires-Dist: sphinxcontrib-bibtex; extra == 'docs'
|
|
67
|
-
Provides-Extra: matplotlib
|
|
68
|
-
Requires-Dist: matplotlib; extra == 'matplotlib'
|
|
69
|
-
Provides-Extra: test
|
|
70
|
-
Requires-Dist: coverage>=7.7.0; extra == 'test'
|
|
71
|
-
Requires-Dist: matplotlib; extra == 'test'
|
|
72
|
-
Requires-Dist: pytest-cov>=3; extra == 'test'
|
|
73
|
-
Requires-Dist: pytest-timeout>=2.0; extra == 'test'
|
|
74
|
-
Requires-Dist: pytest>=6; extra == 'test'
|
|
75
|
-
Requires-Dist: torch; extra == 'test'
|
|
76
53
|
Provides-Extra: torch
|
|
77
54
|
Requires-Dist: torch; extra == 'torch'
|
|
78
55
|
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Pull request
|
|
2
|
+
|
|
3
|
+
This PR bumps mypy's configured python_version to 3.14 so that mypy accepts modern numpy stubs
|
|
4
|
+
which use `Type` statement syntax introduced in Python 3.12+. This only affects static
|
|
5
|
+
type checking and does not change runtime requirements.
|
|
6
|
+
|
|
7
|
+
The change prevents pre-commit's mypy hook from failing on CI when parsing numpy
|
|
8
|
+
stub files.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
curvelets.numpy package
|
|
2
|
+
=======================
|
|
3
|
+
|
|
4
|
+
.. automodule:: curvelets.numpy
|
|
5
|
+
:members:
|
|
6
|
+
:show-inheritance:
|
|
7
|
+
:undoc-members:
|
|
8
|
+
|
|
9
|
+
Submodules
|
|
10
|
+
----------
|
|
11
|
+
|
|
12
|
+
curvelets.numpy.typing module
|
|
13
|
+
-----------------------------
|
|
14
|
+
|
|
15
|
+
.. automodule:: curvelets.numpy.typing
|
|
16
|
+
:members:
|
|
17
|
+
:show-inheritance:
|
|
18
|
+
:undoc-members:
|
|
@@ -5,8 +5,14 @@ curvelets.torch package
|
|
|
5
5
|
:members:
|
|
6
6
|
:show-inheritance:
|
|
7
7
|
:undoc-members:
|
|
8
|
-
:no-index:
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
Submodules
|
|
10
|
+
----------
|
|
11
|
+
|
|
12
|
+
curvelets.torch.typing module
|
|
13
|
+
-----------------------------
|
|
14
|
+
|
|
15
|
+
.. automodule:: curvelets.torch.typing
|
|
11
16
|
:members:
|
|
12
17
|
:show-inheritance:
|
|
18
|
+
:undoc-members:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import importlib
|
|
3
4
|
import sys
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
|
|
@@ -82,15 +83,60 @@ intersphinx_mapping = {
|
|
|
82
83
|
# sphinx_copybutton
|
|
83
84
|
copybutton_prompt_text = ">>> "
|
|
84
85
|
|
|
86
|
+
|
|
87
|
+
def reset_curvelets_modules(gallery_conf, fname): # noqa: ARG001
|
|
88
|
+
"""Reset all curvelets modules and submodules to disable caching."""
|
|
89
|
+
# Create a list of keys first to avoid "dictionary changed during iteration" error
|
|
90
|
+
for name in list(sys.modules):
|
|
91
|
+
if name.startswith("curvelets"):
|
|
92
|
+
importlib.reload(sys.modules[name])
|
|
93
|
+
|
|
94
|
+
|
|
85
95
|
# sphinx_gallery.gen_gallery
|
|
86
96
|
sphinx_gallery_conf = {
|
|
87
97
|
"examples_dirs": "../examples", # path to your example scripts
|
|
88
98
|
"gallery_dirs": "auto_examples", # path to where to save gallery generated output
|
|
89
99
|
"within_subsection_order": "FileNameSortKey",
|
|
100
|
+
# Note: reset_modules is set in setup() to avoid pickling issues
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
MISSING_REF_MAPPING = {
|
|
105
|
+
# NumPy
|
|
106
|
+
"npt.NDArray": "https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html",
|
|
107
|
+
"NDArray": "https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html",
|
|
108
|
+
"ndarray": "https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html",
|
|
109
|
+
"array_like": "https://numpy.org/doc/stable/glossary.html#term-array_like",
|
|
110
|
+
"numpy.int64": "https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.int64",
|
|
111
|
+
"np.intp": "https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.intp",
|
|
112
|
+
"npt.DTypeLike": "https://numpy.org/doc/stable/reference/arrays.dtypes.html",
|
|
113
|
+
"np.floating": "https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.floating",
|
|
90
114
|
}
|
|
91
115
|
|
|
116
|
+
|
|
117
|
+
def on_missing_reference(app, env, node, contnode): # noqa: ARG001
|
|
118
|
+
target = node.get("reftarget")
|
|
119
|
+
if target in MISSING_REF_MAPPING:
|
|
120
|
+
from docutils import nodes
|
|
121
|
+
|
|
122
|
+
new_ref = nodes.reference(
|
|
123
|
+
"", "", internal=False, refuri=MISSING_REF_MAPPING[target]
|
|
124
|
+
)
|
|
125
|
+
new_ref += contnode
|
|
126
|
+
return new_ref
|
|
127
|
+
return None
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def setup(app):
|
|
131
|
+
"""Configure Sphinx extensions."""
|
|
132
|
+
# Set reset_modules here to avoid pickling warnings
|
|
133
|
+
# This function is called after config is loaded but before building
|
|
134
|
+
app.config.sphinx_gallery_conf["reset_modules"] = (reset_curvelets_modules,)
|
|
135
|
+
app.connect("missing-reference", on_missing_reference)
|
|
136
|
+
|
|
137
|
+
|
|
92
138
|
# sphinxcontrib.bibtex
|
|
93
139
|
bibtex_bibfiles = ["references.bib"]
|
|
94
140
|
bibtex_reference_style = "author_year"
|
|
95
141
|
# bibtex_default_style = "plain"
|
|
96
|
-
suppress_warnings = ["bibtex.duplicate_citation"]
|
|
142
|
+
suppress_warnings = ["bibtex.duplicate_citation", "config.cache"]
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
.. _contributing:
|
|
2
|
+
|
|
3
|
+
Contributing
|
|
4
|
+
############
|
|
5
|
+
|
|
6
|
+
.. _gh-discussions: https://github.com/cako/curvelets/discussions
|
|
7
|
+
.. _gh-discussions-feature-requests: https://github.com/cako/curvelets/discussions/new?category=feature-requests-and-ideas
|
|
8
|
+
.. _gh-discussions-bug-reports: https://github.com/cako/curvelets/discussions/new?category=report-issues
|
|
9
|
+
.. _gh-issues: https://github.com/cako/curvelets/issues
|
|
10
|
+
.. _numfocus-coc: https://numfocus.org/code-of-conduct
|
|
11
|
+
.. _conventional-commits: https://www.conventionalcommits.org/en/v1.0.0/#summary
|
|
12
|
+
|
|
13
|
+
We welcome and appreciate all contributions to the ``curvelets`` library! Please review the following guidelines before beginning your work.
|
|
14
|
+
|
|
15
|
+
To communicate with the core developers and maintainers, we request that you open a topic in our `GitHub Discussions <gh-discussions_>`_. Note that `as explained in Issue #55 <https://github.com/cako/curvelets/issues/55>`_, we ask external users and non-contributors to report bugs and request new features strictly via Discussions rather than opening direct issues on GitHub.
|
|
16
|
+
|
|
17
|
+
Furthermore, before participating, please read and abide by the `NUMFOCUS Code of Conduct <numfocus-coc_>`_. We expect all community members to uphold these standards.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
Welcomed contributions
|
|
21
|
+
**********************
|
|
22
|
+
|
|
23
|
+
Bug reports
|
|
24
|
+
===========
|
|
25
|
+
|
|
26
|
+
If you encounter unexpected behavior while computing transforms with ``curvelets``, please report the bug via our `GitHub Discussion for bug reports <gh-discussions-bug-reports_>`_.
|
|
27
|
+
|
|
28
|
+
To help us diagnose and reproduce the problem quickly, please include:
|
|
29
|
+
|
|
30
|
+
* The exact name and version of your operating system.
|
|
31
|
+
* Detailed details regarding your Python environment and dependencies.
|
|
32
|
+
* A self-contained, minimal script or step-by-step instructions showing how to reproduce the bug from a clean installation.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
New methods and features
|
|
36
|
+
========================
|
|
37
|
+
|
|
38
|
+
If you have ideas for new directional transforms, operators, or functional improvements, we invite you to open a `GitHub Discussion for new features <gh-discussions-feature-requests_>`_.
|
|
39
|
+
|
|
40
|
+
When proposing a new method or feature:
|
|
41
|
+
|
|
42
|
+
* Explain in detail the mathematical rationale and numerical behavior of the proposed method.
|
|
43
|
+
* Keep the initial implementation scope narrow to ensure that we can review and maintain the code effectively.
|
|
44
|
+
* Provide a minimal example that shows the intended usage and expected numerical output.
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
Fix issues
|
|
48
|
+
==========
|
|
49
|
+
|
|
50
|
+
We maintain a tracked backlog of validated bugs and planned features in `GitHub Issues <gh-issues_>`_. Note that these issues represent tasks that maintainers have triaged from community discussions.
|
|
51
|
+
|
|
52
|
+
We welcome contributors to inspect open issues and submit pull requests targeting our ``main`` branch to resolve them.
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
Add examples or improve documentation
|
|
56
|
+
=====================================
|
|
57
|
+
|
|
58
|
+
Writing new code is only one of many ways to strengthen the library. We highly encourage contributors to develop new gallery examples showing practical applications of existing methods, or to improve the clarity and completeness of our API documentation.
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
Step-by-step instructions for contributing
|
|
62
|
+
******************************************
|
|
63
|
+
|
|
64
|
+
When you are ready to contribute code or documentation, follow this workflow:
|
|
65
|
+
|
|
66
|
+
1. **Environment setup with uv**
|
|
67
|
+
|
|
68
|
+
We use ``uv`` as our primary package and environment manager. First, clone the repository and install the package in development mode with all optional dependencies:
|
|
69
|
+
|
|
70
|
+
.. code-block:: bash
|
|
71
|
+
|
|
72
|
+
uv pip install -e .[torch]
|
|
73
|
+
|
|
74
|
+
Next, install our development and testing dependencies:
|
|
75
|
+
|
|
76
|
+
.. code-block:: bash
|
|
77
|
+
|
|
78
|
+
uv pip install --group dev
|
|
79
|
+
|
|
80
|
+
2. **Branch creation**
|
|
81
|
+
|
|
82
|
+
Create a dedicated feature branch starting from our latest ``main`` branch:
|
|
83
|
+
|
|
84
|
+
.. code-block:: bash
|
|
85
|
+
|
|
86
|
+
git checkout -b name-of-your-branch main
|
|
87
|
+
|
|
88
|
+
You can now implement your modifications locally.
|
|
89
|
+
|
|
90
|
+
3. **Running tests**
|
|
91
|
+
|
|
92
|
+
We use ``pytest`` managed via ``nox`` to test across multiple Python environments. You can run the test suite directly using our convenient ``Makefile`` shortcut:
|
|
93
|
+
|
|
94
|
+
.. code-block:: bash
|
|
95
|
+
|
|
96
|
+
make test
|
|
97
|
+
|
|
98
|
+
Note that this command delegates to ``uv run nox -s tests``. You can also invoke specific sessions explicitly if needed.
|
|
99
|
+
|
|
100
|
+
4. **Running static analysis and linting**
|
|
101
|
+
|
|
102
|
+
We maintain strict standards for code formatting, linting, and static type safety (``ruff``, ``ty``, ``mypy``). To verify that your code complies with our standards, run:
|
|
103
|
+
|
|
104
|
+
.. code-block:: bash
|
|
105
|
+
|
|
106
|
+
make lint
|
|
107
|
+
|
|
108
|
+
This shortcut executes ``uv run nox -s lint`` across the codebase. Therefore, we strongly recommend running ``make lint`` before submitting your code for review.
|
|
109
|
+
|
|
110
|
+
5. **Updating documentation**
|
|
111
|
+
|
|
112
|
+
If your contribution modifies any API signature or introduces new functionality, please update the documentation and gallery scripts accordingly. To build the HTML documentation locally:
|
|
113
|
+
|
|
114
|
+
.. code-block:: bash
|
|
115
|
+
|
|
116
|
+
make doc
|
|
117
|
+
|
|
118
|
+
This command runs ``uv run nox -s docs`` and generates our Sphinx documentation gallery in ``docs/_build/html``.
|
|
119
|
+
|
|
120
|
+
6. **Committing your changes**
|
|
121
|
+
|
|
122
|
+
Once you have verified that all tests and linting checks pass, stage and commit your changes:
|
|
123
|
+
|
|
124
|
+
.. code-block:: bash
|
|
125
|
+
|
|
126
|
+
git add .
|
|
127
|
+
git commit -m "feat: detailed description of your changes"
|
|
128
|
+
git push -u origin name-of-your-branch
|
|
129
|
+
|
|
130
|
+
We recommend following `Conventional Commits <conventional-commits_>`_ formatting for all commit messages.
|
|
131
|
+
|
|
132
|
+
7. **Submitting a pull request**
|
|
133
|
+
|
|
134
|
+
Finally, open a pull request on GitHub comparing your feature branch against our ``main`` branch.
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
Pull request guidelines
|
|
138
|
+
***********************
|
|
139
|
+
|
|
140
|
+
Before submitting a pull request, verify that your contribution meets the following criteria:
|
|
141
|
+
|
|
142
|
+
1. **Comprehensive test coverage**: Include unit tests verifying both forward and backward numerical precision for all newly added routines.
|
|
143
|
+
2. **Documentation synchronization**: Ensure that docstrings and gallery tutorials accurately reflect any changes to function arguments or behavior.
|
|
144
|
+
3. **Clean verification**: Confirm that your branch passes all automated checks by running ``make test`` and ``make lint`` locally without errors or warnings.
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
Project structure
|
|
148
|
+
*****************
|
|
149
|
+
|
|
150
|
+
We organize the ``curvelets`` repository into the following functional directories:
|
|
151
|
+
|
|
152
|
+
* ``src/curvelets``: Core Python package containing our Uniform Discrete Curvelet Transform (UDCT) implementations for NumPy and PyTorch.
|
|
153
|
+
* ``tests``: Unit and integration test suites executed via ``pytest``.
|
|
154
|
+
* ``testdata``: Standard reference images and synthetic datasets used across our test assertions and gallery examples.
|
|
155
|
+
* ``docs``: Sphinx configuration, ReStructuredText manuals, and bibliography files (``references.bib``).
|
|
156
|
+
* ``examples``: Python scripts formatted for ``sphinx-gallery`` that generate our visual tutorials and verification charts.
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
Development tools
|
|
160
|
+
*****************
|
|
161
|
+
|
|
162
|
+
We rely on modern, high-performance tooling to maintain our developer workflow:
|
|
163
|
+
|
|
164
|
+
* **uv**: Fast Python package and virtual environment manager.
|
|
165
|
+
* **nox**: Automated task runner managing isolated testing and documentation sessions.
|
|
166
|
+
* **pre-commit**: Git hooks enforcing rapid formatting and checks prior to commits.
|
|
167
|
+
* **ruff**: High-speed Python linter and code formatter.
|
|
168
|
+
* **ty**: Ultra-fast Rust-based static type checker.
|
|
169
|
+
* **mypy**: Standard static type checker ensuring structural typing integrity across modules.
|
|
170
|
+
* **pytest**: Comprehensive testing framework used for numerical precision and gradient verification.
|
|
171
|
+
* **sphinx**: Documentation engine powering our HTML manual and gallery build.
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
Automated workflows (GitHub Actions)
|
|
175
|
+
************************************
|
|
176
|
+
|
|
177
|
+
We automate quality assurance, multi-platform testing, and package distribution using GitHub Actions configured in ``.github/workflows/``:
|
|
178
|
+
|
|
179
|
+
* **Continuous Integration (``ci.yml``)**: Whenever you push commits or open a pull request, our CI pipeline automatically verifies your changes across a comprehensive build matrix:
|
|
180
|
+
|
|
181
|
+
* **Code formatting and linting**: A dedicated job checks all files against our pre-commit hooks and runs ``pylint`` via ``nox`` to guarantee formatting consistency.
|
|
182
|
+
* **Multi-platform and multi-version testing**: We run our complete ``pytest`` suite across Linux (Ubuntu), macOS, and Windows for Python versions ``3.9`` through ``3.14`` (including free-threaded ``3.14t`` and ``PyPy 3.10``).
|
|
183
|
+
* **Coverage tracking**: Test execution generates XML coverage reports that are automatically uploaded and analyzed via Codecov.
|
|
184
|
+
|
|
185
|
+
* **Continuous Deployment (``cd.yml``)**: When maintainers publish a new release on GitHub, our CD workflow verifies package integrity using ``build-and-inspect-python-package`` and automatically publishes the built artifacts to PyPI using secure OIDC authentication (``pypa/gh-action-pypi-publish``).
|
|
186
|
+
|
|
187
|
+
Therefore, when you submit a pull request, you can monitor these automated workflow checks directly on the GitHub PR page to verify that your branch works seamlessly across all supported environments.
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
self
|
|
6
6
|
curvelet_faqs.rst
|
|
7
|
+
contributing.rst
|
|
7
8
|
auto_examples/index.rst
|
|
8
|
-
API <
|
|
9
|
+
API <api/modules>
|
|
9
10
|
|
|
10
11
|
.. image:: montage_all_border.png
|
|
11
12
|
:alt: Four scales of curvelets
|
|
@@ -27,6 +28,12 @@ Installation
|
|
|
27
28
|
|
|
28
29
|
pip install curvelets
|
|
29
30
|
|
|
31
|
+
or, if you want to use the PyTorch backend, you can install the ``torch`` optional dependency:
|
|
32
|
+
|
|
33
|
+
.. code-block:: sh
|
|
34
|
+
|
|
35
|
+
pip install curvelets[torch]
|
|
36
|
+
|
|
30
37
|
**Curvelets** supports Python 3.9 and above, NumPy 1.20 and above.
|
|
31
38
|
|
|
32
39
|
First Steps
|
|
@@ -25,12 +25,31 @@ zone_plate = make_zone_plate(shape)
|
|
|
25
25
|
cfg = np.array([[3, 3], [6, 6], [12, 6]])
|
|
26
26
|
C = UDCT(shape=shape, angular_wedges_config=cfg)
|
|
27
27
|
|
|
28
|
+
# %%
|
|
29
|
+
# Inspecting Coefficient Shapes Ahead of Time
|
|
30
|
+
# ###########################################
|
|
31
|
+
#
|
|
32
|
+
# Before performing a forward transform on an image, we can calculate the exact
|
|
33
|
+
# shapes of all output curvelet coefficients in :math:`O(1)` time using
|
|
34
|
+
# :meth:`~curvelets.numpy.UDCT.coefficient_shapes`. This allows checking wedge dimensions or
|
|
35
|
+
# pre-allocating memory without executing an expensive forward transform dry run.
|
|
36
|
+
|
|
37
|
+
shapes = C.coefficient_shapes()
|
|
38
|
+
for ires, scale_shapes in enumerate(shapes):
|
|
39
|
+
total_wedges = sum(len(dir_shapes) for dir_shapes in scale_shapes)
|
|
40
|
+
first_wedge_shape = scale_shapes[0][0]
|
|
41
|
+
print(
|
|
42
|
+
f"Scale {ires}: {len(scale_shapes)} direction(s), "
|
|
43
|
+
f"{total_wedges} total wedge(s), wedge shape: {first_wedge_shape}"
|
|
44
|
+
)
|
|
45
|
+
|
|
28
46
|
# %%
|
|
29
47
|
# Uniform Discrete Curvelet Transform Round Trip
|
|
30
48
|
# ##############################################
|
|
31
49
|
|
|
32
50
|
coeffs = C.forward(zone_plate)
|
|
33
51
|
zone_plate_inv = C.backward(coeffs)
|
|
52
|
+
assert isinstance(zone_plate_inv, np.ndarray) # Type narrowing
|
|
34
53
|
|
|
35
54
|
# %%
|
|
36
55
|
vmax = np.abs(zone_plate).max()
|
|
@@ -62,7 +81,7 @@ cb.ax.yaxis.set_major_formatter(fmt)
|
|
|
62
81
|
despine(ax)
|
|
63
82
|
ax.set(title=f"Error (max = {opts['vmax']:.2g})")
|
|
64
83
|
|
|
65
|
-
print(f"Max Error: {opts['vmax']:.2g}")
|
|
84
|
+
print(f"Max Error: {opts['vmax']:.2g}")
|
|
66
85
|
|
|
67
86
|
# %%
|
|
68
87
|
# Curvelet Coefficients: Amplitude and Phase
|