smoove 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.
smoove-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Landman Bester
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.
smoove-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,78 @@
1
+ Metadata-Version: 2.4
2
+ Name: smoove
3
+ Version: 0.1.0
4
+ Summary: Miscellaneous fast smoothing utilities
5
+ Keywords: smoothing,kalman-filter,gaussian-process,numerical,signal-processing
6
+ Author: Landman Bester
7
+ Author-email: Landman Bester <lbester@sarao.ac.za>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Topic :: Scientific/Engineering
19
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
20
+ Requires-Dist: hip-cargo>=0.5.0
21
+ Requires-Dist: numpy>=1.20 ; python_full_version >= '3.11' and extra == 'full'
22
+ Requires-Dist: scipy>=1.7 ; python_full_version >= '3.11' and extra == 'full'
23
+ Requires-Dist: numba>=0.55 ; python_full_version >= '3.11' and extra == 'full'
24
+ Requires-Dist: sympy>=1.14 ; python_full_version >= '3.11' and extra == 'full'
25
+ Requires-Dist: jax>=0.4.30 ; python_full_version >= '3.11' and extra == 'jax'
26
+ Maintainer: Landman Bester
27
+ Maintainer-email: Landman Bester <lbester@sarao.ac.za>
28
+ Requires-Python: >=3.10
29
+ Project-URL: Homepage, https://github.com/landmanbester/smoove
30
+ Project-URL: Repository, https://github.com/landmanbester/smoove
31
+ Project-URL: Bug Tracker, https://github.com/landmanbester/smoove/issues
32
+ Project-URL: Changelog, https://github.com/landmanbester/smoove/blob/main/CHANGELOG.md
33
+ Provides-Extra: full
34
+ Provides-Extra: jax
35
+ Description-Content-Type: text/markdown
36
+
37
+ # smoove
38
+
39
+ Miscellaneous fast smoothing utilities
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ pip install smoove # lightweight: the `smoove` CLI, runs commands in a container
45
+ pip install "smoove[full]" # Python 3.11+: numpy, scipy, numba, sympy; runs natively and gives the library
46
+ pip install "smoove[full,jax]" # adds jax for smoove.filter_jax
47
+ ```
48
+
49
+ The container image is `ghcr.io/landmanbester/smoove`.
50
+
51
+ ## Usage
52
+
53
+ ```bash
54
+ smoove --help
55
+ ```
56
+
57
+ The Stimela cabs for the commands are in `src/smoove/cabs/`.
58
+
59
+ ## Robust smoothing with `kanterp`
60
+
61
+ Needs `smoove[full]`.
62
+
63
+ `kanterp` smooths 1D data with a cubic smoothing spline (integrated Wiener process) prior
64
+ and Student-t noise, so isolated outliers barely move the fit. Points with `w == 0` are
65
+ treated as missing.
66
+
67
+ ```python
68
+ import numpy as np
69
+ from smoove.kanterp import kanterp
70
+
71
+ x = np.linspace(0.0, 1.0, 32) # any strictly increasing coordinates
72
+ w = np.full(32, 100.0) # relative inverse variances, 0 = missing
73
+ y = np.sin(6 * x) + np.random.default_rng(0).standard_normal(32) / np.sqrt(w)
74
+ y[10] += 3.0 # an outlier
75
+
76
+ res = kanterp(x, y, w) # or: theta, muf, covf, nu = kanterp(...)
77
+ res.muf, np.sqrt(res.covf) # posterior mean and standard deviation of f
78
+ ```
smoove-0.1.0/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # smoove
2
+
3
+ Miscellaneous fast smoothing utilities
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install smoove # lightweight: the `smoove` CLI, runs commands in a container
9
+ pip install "smoove[full]" # Python 3.11+: numpy, scipy, numba, sympy; runs natively and gives the library
10
+ pip install "smoove[full,jax]" # adds jax for smoove.filter_jax
11
+ ```
12
+
13
+ The container image is `ghcr.io/landmanbester/smoove`.
14
+
15
+ ## Usage
16
+
17
+ ```bash
18
+ smoove --help
19
+ ```
20
+
21
+ The Stimela cabs for the commands are in `src/smoove/cabs/`.
22
+
23
+ ## Robust smoothing with `kanterp`
24
+
25
+ Needs `smoove[full]`.
26
+
27
+ `kanterp` smooths 1D data with a cubic smoothing spline (integrated Wiener process) prior
28
+ and Student-t noise, so isolated outliers barely move the fit. Points with `w == 0` are
29
+ treated as missing.
30
+
31
+ ```python
32
+ import numpy as np
33
+ from smoove.kanterp import kanterp
34
+
35
+ x = np.linspace(0.0, 1.0, 32) # any strictly increasing coordinates
36
+ w = np.full(32, 100.0) # relative inverse variances, 0 = missing
37
+ y = np.sin(6 * x) + np.random.default_rng(0).standard_normal(32) / np.sqrt(w)
38
+ y[10] += 3.0 # an outlier
39
+
40
+ res = kanterp(x, y, w) # or: theta, muf, covf, nu = kanterp(...)
41
+ res.muf, np.sqrt(res.covf) # posterior mean and standard deviation of f
42
+ ```
@@ -0,0 +1,132 @@
1
+ [project]
2
+ name = "smoove"
3
+ version = "0.1.0"
4
+ description = "Miscellaneous fast smoothing utilities"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = "MIT"
8
+ license-files = ["LICENSE"]
9
+ keywords = [
10
+ "smoothing",
11
+ "kalman-filter",
12
+ "gaussian-process",
13
+ "numerical",
14
+ "signal-processing",
15
+ ]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Science/Research",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3 :: Only",
25
+ "Topic :: Scientific/Engineering",
26
+ "Topic :: Scientific/Engineering :: Mathematics",
27
+ ]
28
+ dependencies = ["hip-cargo>=0.5.0"]
29
+
30
+ [[project.authors]]
31
+ name = "Landman Bester"
32
+ email = "lbester@sarao.ac.za"
33
+
34
+ [[project.maintainers]]
35
+ name = "Landman Bester"
36
+ email = "lbester@sarao.ac.za"
37
+
38
+ [project.optional-dependencies]
39
+ full = [
40
+ "numpy>=1.20; python_version >= '3.11'",
41
+ "scipy>=1.7; python_version >= '3.11'",
42
+ "numba>=0.55; python_version >= '3.11'",
43
+ "sympy>=1.14; python_version >= '3.11'",
44
+ ]
45
+ jax = ["jax>=0.4.30; python_version >= '3.11'"]
46
+
47
+ [project.urls]
48
+ Homepage = "https://github.com/landmanbester/smoove"
49
+ Repository = "https://github.com/landmanbester/smoove"
50
+ "Bug Tracker" = "https://github.com/landmanbester/smoove/issues"
51
+ Changelog = "https://github.com/landmanbester/smoove/blob/main/CHANGELOG.md"
52
+
53
+ [project.scripts]
54
+ smoove = "smoove.cli:app"
55
+
56
+ [build-system]
57
+ requires = ["uv_build>=0.8.3,<0.14.0"]
58
+ build-backend = "uv_build"
59
+
60
+ [tool.ruff]
61
+ line-length = 120
62
+ target-version = "py310"
63
+ extend-exclude = ["*.md"]
64
+
65
+ [tool.ruff.lint]
66
+ select = [
67
+ "E",
68
+ "F",
69
+ "I",
70
+ "N",
71
+ "W",
72
+ ]
73
+ ignore = []
74
+
75
+ [tool.ruff.lint.per-file-ignores]
76
+ "src/smoove/{filter,filter_jax,gpr,kanterp,smoother,utils}.py" = [
77
+ "N801",
78
+ "N802",
79
+ "N803",
80
+ "N806",
81
+ "E741",
82
+ ]
83
+ "src/smoove/kernels/*.py" = [
84
+ "N801",
85
+ "N802",
86
+ "N803",
87
+ "N806",
88
+ "E741",
89
+ ]
90
+ "tests/*.py" = [
91
+ "N802",
92
+ "N803",
93
+ "N806",
94
+ "E741",
95
+ ]
96
+
97
+ [tool.ruff.format]
98
+ quote-style = "double"
99
+ indent-style = "space"
100
+
101
+ [tool.pytest.ini_options]
102
+ testpaths = ["tests"]
103
+ python_files = [
104
+ "test_*.py",
105
+ "*_test.py",
106
+ ]
107
+ python_classes = ["Test*"]
108
+ python_functions = ["test_*"]
109
+ addopts = [
110
+ "--strict-markers",
111
+ "--strict-config",
112
+ "--verbose",
113
+ ]
114
+ markers = [
115
+ "unit: Unit tests",
116
+ "integration: Integration tests",
117
+ "slow: Tests that take more time to run",
118
+ ]
119
+
120
+ [dependency-groups]
121
+ dev = [
122
+ "pytest>=8.0.0",
123
+ "pytest-cov>=5.0.0",
124
+ "ruff>=0.9.0",
125
+ "tbump>=6.11.0",
126
+ "pre-commit>=4.0.0",
127
+ "matplotlib>=3.10.7; python_version >= '3.11'",
128
+ ]
129
+ test = [
130
+ "pytest>=8.0.0",
131
+ "pytest-cov>=5.0.0",
132
+ ]
@@ -0,0 +1,125 @@
1
+ [project]
2
+ name = "smoove"
3
+ version = "0.1.0"
4
+ description = "Miscellaneous fast smoothing utilities"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = "MIT"
8
+ license-files = ["LICENSE"]
9
+ keywords = ["smoothing", "kalman-filter", "gaussian-process", "numerical", "signal-processing"]
10
+ authors = [
11
+ { name = "Landman Bester", email = "lbester@sarao.ac.za" },
12
+ ]
13
+ maintainers = [
14
+ { name = "Landman Bester", email = "lbester@sarao.ac.za" },
15
+ ]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Science/Research",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3 :: Only",
25
+ "Topic :: Scientific/Engineering",
26
+ "Topic :: Scientific/Engineering :: Mathematics",
27
+ ]
28
+ dependencies = [
29
+ "hip-cargo>=0.5.0",
30
+ ]
31
+
32
+ # Lightweight install (default): pip install smoove
33
+ # Only pulls hip-cargo + typer. Suitable for cab consumers (e.g. stimela)
34
+ # and for running commands via container fallback. Generated CLI wrappers
35
+ # lazy-import core/, so when heavy deps are missing the wrapper drops into
36
+ # run_in_container() automatically.
37
+ # This is the only install supported on Python 3.10.
38
+ # Full install: pip install smoove[full] (Python 3.11+)
39
+ # Adds the heavy runtime deps that core/ implementations and the library
40
+ # modules (smoove.kanterp, smoove.filter, smoove.gpr, ...) need.
41
+ # Mark EVERY one with python_version >= '3.11', joined with `and` to any
42
+ # other marker, e.g. "numpy>=2.3; python_version >= '3.11'". On 3.10,
43
+ # [full] then installs nothing and every command uses the container,
44
+ # instead of a partial stack failing part-way. tests/test_extras.py checks.
45
+ # JAX: pip install smoove[full,jax] (Python 3.11+)
46
+ # For smoove.filter_jax only. The container image installs `full` alone.
47
+ [project.optional-dependencies]
48
+ full = [
49
+ "numpy>=1.20; python_version >= '3.11'",
50
+ "scipy>=1.7; python_version >= '3.11'",
51
+ "numba>=0.55; python_version >= '3.11'",
52
+ "sympy>=1.14; python_version >= '3.11'",
53
+ ]
54
+ jax = [
55
+ "jax>=0.4.30; python_version >= '3.11'",
56
+ ]
57
+
58
+ [project.urls]
59
+ Homepage = "https://github.com/landmanbester/smoove"
60
+ Repository = "https://github.com/landmanbester/smoove"
61
+ "Bug Tracker" = "https://github.com/landmanbester/smoove/issues"
62
+ Changelog = "https://github.com/landmanbester/smoove/blob/main/CHANGELOG.md"
63
+
64
+ [project.scripts]
65
+ "smoove" = "smoove.cli:app"
66
+
67
+ [build-system]
68
+ # NOTE: This uv_build constraint is intentionally aligned with hip-cargo's own pyproject.toml.
69
+ # If you bump uv_build in hip-cargo, update this template constraint to match.
70
+ requires = ["uv_build>=0.8.3,<0.14.0"]
71
+ build-backend = "uv_build"
72
+
73
+ [tool.ruff]
74
+ line-length = 120
75
+ target-version = "py310"
76
+ # ruff 0.16+ formats Python code blocks embedded in Markdown. CLAUDE.md and
77
+ # README snippets are illustrative fragments (e.g. aligned comments) that ruff
78
+ # would rewrite, so keep the formatter to real Python files only.
79
+ extend-exclude = ["*.md"]
80
+
81
+ [tool.ruff.lint]
82
+ select = ["E", "F", "I", "N", "W"]
83
+ # The numerical code follows the maths: P0, H, Kfilter, RTSsmoother, l, I, ...
84
+ # Renaming would break the public API, so pep8-naming is off for the library
85
+ # modules. cli/ and core/ keep the full rule set.
86
+ ignore = []
87
+
88
+ [tool.ruff.lint.per-file-ignores]
89
+ "src/smoove/{filter,filter_jax,gpr,kanterp,smoother,utils}.py" = ["N801", "N802", "N803", "N806", "E741"]
90
+ "src/smoove/kernels/*.py" = ["N801", "N802", "N803", "N806", "E741"]
91
+ "tests/*.py" = ["N802", "N803", "N806", "E741"]
92
+
93
+ [tool.ruff.format]
94
+ quote-style = "double"
95
+ indent-style = "space"
96
+
97
+ [tool.pytest.ini_options]
98
+ testpaths = ["tests"]
99
+ python_files = ["test_*.py", "*_test.py"]
100
+ python_classes = ["Test*"]
101
+ python_functions = ["test_*"]
102
+ addopts = [
103
+ "--strict-markers",
104
+ "--strict-config",
105
+ "--verbose",
106
+ ]
107
+ markers = [
108
+ "unit: Unit tests",
109
+ "integration: Integration tests",
110
+ "slow: Tests that take more time to run",
111
+ ]
112
+
113
+ [dependency-groups]
114
+ dev = [
115
+ "pytest>=8.0.0",
116
+ "pytest-cov>=5.0.0",
117
+ "ruff>=0.9.0",
118
+ "tbump>=6.11.0",
119
+ "pre-commit>=4.0.0",
120
+ "matplotlib>=3.10.7; python_version >= '3.11'",
121
+ ]
122
+ test = [
123
+ "pytest>=8.0.0",
124
+ "pytest-cov>=5.0.0",
125
+ ]
@@ -0,0 +1,5 @@
1
+ """Miscellaneous fast smoothing utilities"""
2
+
3
+ __version__ = "0.1.0"
4
+
5
+ __all__ = ["__version__"]
@@ -0,0 +1,14 @@
1
+ CONTAINER_IMAGE = "ghcr.io/landmanbester/smoove:0.1.0"
2
+
3
+ # Optional GPU passthrough for the container-fallback path.
4
+ # Set GPU = True for a CUDA/GPU image, or "auto" to request a GPU only
5
+ # when one is detected (and, for docker/podman, the NVIDIA Container
6
+ # Toolkit is present). Absent => no GPU flags (the default).
7
+ # GPU = True
8
+
9
+ # Optional per-backend extra arguments, passed verbatim to the container
10
+ # runtime during fallback. Example: RUN_ARGS_APPTAINER = ["--ipc=host"].
11
+ # RUN_ARGS_DOCKER = []
12
+ # RUN_ARGS_PODMAN = []
13
+ # RUN_ARGS_APPTAINER = []
14
+ # RUN_ARGS_SINGULARITY = []
@@ -0,0 +1 @@
1
+ """Generated Stimela cab definitions."""
@@ -0,0 +1,10 @@
1
+ cabs:
2
+ onboard:
3
+ flavour: python
4
+ command: smoove.core.onboard.onboard
5
+ name: onboard
6
+ info:
7
+ Print setup instructions for CI/CD, PyPI publishing, and GitHub configuration.
8
+ image: ghcr.io/landmanbester/smoove:0.1.0
9
+ inputs: {}
10
+ outputs: {}
@@ -0,0 +1,23 @@
1
+ """CLI for smoove."""
2
+
3
+ import typer
4
+
5
+ app = typer.Typer(
6
+ name="smoove",
7
+ help="Miscellaneous fast smoothing utilities",
8
+ no_args_is_help=True,
9
+ )
10
+
11
+
12
+ @app.callback()
13
+ def callback() -> None:
14
+ """Miscellaneous fast smoothing utilities"""
15
+ pass
16
+
17
+
18
+ # Register subcommands below. Imports go here (bottom) to avoid circular imports.
19
+ from smoove.cli.onboard import onboard # noqa: E402
20
+
21
+ app.command(name="onboard")(onboard)
22
+
23
+ __all__ = ["app"]
@@ -0,0 +1,68 @@
1
+ from typing import Annotated, Literal
2
+
3
+ import typer
4
+ from hip_cargo import StimelaMeta, stimela_cab
5
+
6
+
7
+ @stimela_cab(
8
+ name="onboard",
9
+ info="Print setup instructions for CI/CD, PyPI publishing, and GitHub configuration.",
10
+ )
11
+ def onboard(
12
+ backend: Annotated[
13
+ Literal["auto", "native", "apptainer", "singularity", "docker", "podman"],
14
+ typer.Option(
15
+ help="Execution backend.",
16
+ ),
17
+ StimelaMeta(
18
+ skip=True,
19
+ ),
20
+ ] = "auto",
21
+ always_pull_images: Annotated[
22
+ bool,
23
+ typer.Option(
24
+ help="Always pull container images, even if cached locally.",
25
+ ),
26
+ StimelaMeta(
27
+ skip=True,
28
+ ),
29
+ ] = False,
30
+ ):
31
+ """
32
+ Print setup instructions for CI/CD, PyPI publishing, and GitHub configuration.
33
+ """
34
+ params = {}
35
+
36
+ if backend == "native" or backend == "auto":
37
+ # Only a missing install falls back to the container, so only the
38
+ # imports and the pre-flight are guarded; the core call is not.
39
+ try:
40
+ from hip_cargo.utils.runner import preflight # noqa: E402
41
+
42
+ # Check the extras this run needs and remote must_exist URIs before any work.
43
+ preflight(onboard, params)
44
+ from smoove.core.onboard import onboard as onboard_core # noqa: E402
45
+ except ImportError as exc:
46
+ # A failed import from this package is a bug, not a missing install.
47
+ if backend == "native" or (exc.name or "").split(".")[0] == "smoove":
48
+ raise
49
+ typer.echo(f"Cannot run natively ({exc!r}); falling back to a container.", err=True)
50
+ else:
51
+ onboard_core(**params)
52
+ return
53
+
54
+ # Resolve container image from installed package metadata
55
+ from hip_cargo.utils.config import get_container_image # noqa: E402
56
+ from hip_cargo.utils.runner import run_in_container # noqa: E402
57
+
58
+ image = get_container_image("smoove")
59
+ if image is None:
60
+ raise RuntimeError("No Container URL in smoove metadata.")
61
+
62
+ run_in_container(
63
+ onboard,
64
+ params,
65
+ image=image,
66
+ backend=backend,
67
+ always_pull_images=always_pull_images,
68
+ )
@@ -0,0 +1 @@
1
+ """Core implementations for smoove."""