signaloid 2.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.
Files changed (49) hide show
  1. signaloid-2.0.0/LICENSE +19 -0
  2. signaloid-2.0.0/PKG-INFO +130 -0
  3. signaloid-2.0.0/README.md +101 -0
  4. signaloid-2.0.0/pyproject.toml +79 -0
  5. signaloid-2.0.0/src/signaloid/circuitpython/README.md +3 -0
  6. signaloid-2.0.0/src/signaloid/circuitpython/__init__.py +0 -0
  7. signaloid-2.0.0/src/signaloid/circuitpython/extended_ulab_numpy.py +397 -0
  8. signaloid-2.0.0/src/signaloid/circuitpython/plot_wrapper.py +562 -0
  9. signaloid-2.0.0/src/signaloid/circuitpython/py.typed +0 -0
  10. signaloid-2.0.0/src/signaloid/distributional/README.md +2 -0
  11. signaloid-2.0.0/src/signaloid/distributional/__init__.py +4 -0
  12. signaloid-2.0.0/src/signaloid/distributional/dirac_delta.py +238 -0
  13. signaloid-2.0.0/src/signaloid/distributional/dirac_delta_test.py +116 -0
  14. signaloid-2.0.0/src/signaloid/distributional/distributional.py +1325 -0
  15. signaloid-2.0.0/src/signaloid/distributional/distributional_test.py +1376 -0
  16. signaloid-2.0.0/src/signaloid/distributional/py.typed +0 -0
  17. signaloid-2.0.0/src/signaloid/distributional/test_ux_value_pairs.csv +786 -0
  18. signaloid-2.0.0/src/signaloid/distributional_distance/README.md +145 -0
  19. signaloid-2.0.0/src/signaloid/distributional_distance/__init__.py +68 -0
  20. signaloid-2.0.0/src/signaloid/distributional_distance/_validators.py +93 -0
  21. signaloid-2.0.0/src/signaloid/distributional_distance/_validators_test.py +195 -0
  22. signaloid-2.0.0/src/signaloid/distributional_distance/binned_wasserstein.py +531 -0
  23. signaloid-2.0.0/src/signaloid/distributional_distance/binned_wasserstein_test.py +588 -0
  24. signaloid-2.0.0/src/signaloid/distributional_distance/ks_distance.py +108 -0
  25. signaloid-2.0.0/src/signaloid/distributional_distance/ks_distance_test.py +286 -0
  26. signaloid-2.0.0/src/signaloid/distributional_distance/py.typed +0 -0
  27. signaloid-2.0.0/src/signaloid/distributional_distance/scalar.py +219 -0
  28. signaloid-2.0.0/src/signaloid/distributional_distance/scalar_test.py +294 -0
  29. signaloid-2.0.0/src/signaloid/distributional_distance/wasserstein.py +484 -0
  30. signaloid-2.0.0/src/signaloid/distributional_distance/wasserstein_test.py +667 -0
  31. signaloid-2.0.0/src/signaloid/distributional_information_plotting/README.md +99 -0
  32. signaloid-2.0.0/src/signaloid/distributional_information_plotting/__init__.py +0 -0
  33. signaloid-2.0.0/src/signaloid/distributional_information_plotting/invalid_ttr_ux_string.dat +1 -0
  34. signaloid-2.0.0/src/signaloid/distributional_information_plotting/plot_histogram_dirac_deltas.py +1015 -0
  35. signaloid-2.0.0/src/signaloid/distributional_information_plotting/plot_histogram_dirac_deltas_test.py +962 -0
  36. signaloid-2.0.0/src/signaloid/distributional_information_plotting/plot_wrapper.py +272 -0
  37. signaloid-2.0.0/src/signaloid/distributional_information_plotting/plot_wrapper_test.py +164 -0
  38. signaloid-2.0.0/src/signaloid/distributional_information_plotting/py.typed +0 -0
  39. signaloid-2.0.0/src/signaloid/distributional_information_plotting/sample_generator.py +232 -0
  40. signaloid-2.0.0/src/signaloid/distributional_information_plotting/sample_generator_test.py +163 -0
  41. signaloid-2.0.0/src/signaloid/statistical_tests/README.md +85 -0
  42. signaloid-2.0.0/src/signaloid/statistical_tests/__init__.py +31 -0
  43. signaloid-2.0.0/src/signaloid/statistical_tests/ks_hypothesis.py +257 -0
  44. signaloid-2.0.0/src/signaloid/statistical_tests/ks_hypothesis_test.py +257 -0
  45. signaloid-2.0.0/src/signaloid/statistical_tests/py.typed +0 -0
  46. signaloid-2.0.0/src/signaloid/uxdata_toolkit/__init__.py +285 -0
  47. signaloid-2.0.0/src/signaloid/uxdata_toolkit/__main__.py +30 -0
  48. signaloid-2.0.0/src/signaloid/uxdata_toolkit/py.typed +0 -0
  49. signaloid-2.0.0/src/signaloid/uxdata_toolkit/uxdata_toolkit_test.py +383 -0
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2024, Signaloid.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,130 @@
1
+ Metadata-Version: 2.4
2
+ Name: signaloid
3
+ Version: 2.0.0
4
+ Summary: Signaloid Data Toolkit for interacting with Signaloid's UxHw®.
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Author: Signaloid
8
+ Author-email: info@signaloid.com
9
+ Requires-Python: >=3.11,<4
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Programming Language :: Python :: 3.15
17
+ Requires-Dist: matplotlib (>=3.10.0) ; python_version >= "3.11" and python_version < "3.14"
18
+ Requires-Dist: matplotlib (>=3.10.5) ; python_version >= "3.11" and python_version < "3.15"
19
+ Requires-Dist: matplotlib (>=3.9.0) ; python_version >= "3.11" and python_version < "3.13"
20
+ Requires-Dist: numpy (>=2.0.0) ; python_version >= "3.11" and python_version < "3.13"
21
+ Requires-Dist: numpy (>=2.1.0) ; python_version >= "3.11" and python_version < "3.14"
22
+ Requires-Dist: numpy (>=2.4.1) ; python_version >= "3.11" and python_version < "3.15"
23
+ Requires-Dist: pillow (>=13.0.0)
24
+ Requires-Dist: scipy (>=1.14.0)
25
+ Project-URL: Homepage, https://signaloid.com
26
+ Project-URL: Repository, https://github.com/signaloid/signaloid-data-toolkit
27
+ Description-Content-Type: text/markdown
28
+
29
+ # Signaloid Data Toolkit
30
+
31
+ The Signaloid Data Toolkit provides tools for interacting with
32
+ applications that utilize Signaloid's UxHw® technology for distributional
33
+ arithmetic. Use the library to analyze Ux Data values from the application.
34
+
35
+ The tools for benchmarking applications against equivalent Monte Carlo
36
+ methods build on this library and live in the separate
37
+ [signaloid-benchmarking](https://github.com/signaloid/signaloid-benchmarking)
38
+ repository.
39
+
40
+ <picture>
41
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/signaloid/signaloid-data-toolkit/main/images/signaloid-external-illustration-signaloid-data-toolkit-diagram-flat-dark-withCR.png">
42
+ <img alt="signaloid-data-toolkit diagram" src="https://raw.githubusercontent.com/signaloid/signaloid-data-toolkit/main/images/signaloid-external-illustration-signaloid-data-toolkit-diagram-flat-light-withCR.png">
43
+ </picture>
44
+
45
+ ## Requirements
46
+
47
+ The Signaloid Data Toolkit requires Python 3.11 or later. See
48
+ `pyproject.toml` for the full list of dependencies.
49
+
50
+ ## Installation
51
+ Install the `signaloid` package via pip (recommended):
52
+ ```bash
53
+ python -m pip install signaloid
54
+ ```
55
+
56
+
57
+ Install the latest version from the GitHub repository:
58
+ ```bash
59
+ python -m pip install git+https://github.com/signaloid/signaloid-data-toolkit
60
+ ```
61
+
62
+ Alternatively, clone this repository and install from source with:
63
+ ```bash
64
+ python -m pip install .
65
+ ```
66
+
67
+ ## Usage
68
+
69
+ ### Parsing Ux Data
70
+ Construct `DistributionalValue` Python objects by parsing
71
+ [Ux Data](https://docs.signaloid.io/docs/uxhw-api/ux-data-format/) in
72
+ Ux-string or Ux Binary format.
73
+
74
+ ```python
75
+ from signaloid.distributional.distributional import DistributionalValue
76
+
77
+ # Intermediate code which writes to ux_string and ux_binary_buffer
78
+ # ...
79
+
80
+ # Parse a Ux-string
81
+ dist_value = DistributionalValue.parse(ux_string)
82
+
83
+ # Parse a Ux Binary buffer
84
+ dist_value = DistributionalValue.parse(ux_binary_buffer)
85
+ ```
86
+
87
+ ### Create Distribution Plots
88
+ Create plots to visualize distributional information by using the
89
+ [`plot` function](https://github.com/signaloid/signaloid-data-toolkit/blob/main/src/signaloid/distributional_information_plotting/plot_wrapper.py)
90
+ with a `PlotData` object built from a `DistributionalValue` containing Ux Data.
91
+ The `plot` function is a wrapper function for the `PlotHistogramDiracDeltas`
92
+ class for plotting a distributional value as a histogram with variable bin
93
+ widths.
94
+
95
+ ```python
96
+ from signaloid.distributional.distributional import DistributionalValue
97
+ from signaloid.distributional_information_plotting.plot_histogram_dirac_deltas import PlotData
98
+ from signaloid.distributional_information_plotting.plot_wrapper import plot
99
+
100
+ # Intermediate code which writes to ux_string
101
+ # ...
102
+
103
+ # Create distributional value object from Ux-string
104
+ dist_value = DistributionalValue.parse(ux_string)
105
+ plot(PlotData(dist_value))
106
+ ```
107
+
108
+ For plotting from raw samples, saving to a file, and the other `plot` options,
109
+ see the package [README.md](https://github.com/signaloid/signaloid-data-toolkit/blob/main/src/signaloid/distributional_information_plotting/README.md).
110
+
111
+ ### Sample from Ux Data
112
+ Draw random samples from a distributional value with the
113
+ [`sample_generator` function](https://github.com/signaloid/signaloid-data-toolkit/blob/main/src/signaloid/distributional_information_plotting/sample_generator.py).
114
+ Samples of the finite part of the distribution are drawn by inverse transform
115
+ sampling of the binned distribution. Distributions that also carry non-finite
116
+ mass (`NaN`, `-Inf`, `+Inf`) are sampled as a mixture, with each sample drawn
117
+ from the finite or the non-finite part in proportion to their masses.
118
+
119
+ ```python
120
+ from signaloid.distributional_information_plotting.sample_generator import sample_generator
121
+
122
+ # Intermediate code which writes to ux_string
123
+ # ...
124
+
125
+ samples = sample_generator(ux_string, n_samples=1000)
126
+ ```
127
+
128
+ To sample from a `DistributionalValue` that is already parsed, use
129
+ `sample_from_distributional_value` from the same module.
130
+
@@ -0,0 +1,101 @@
1
+ # Signaloid Data Toolkit
2
+
3
+ The Signaloid Data Toolkit provides tools for interacting with
4
+ applications that utilize Signaloid's UxHw® technology for distributional
5
+ arithmetic. Use the library to analyze Ux Data values from the application.
6
+
7
+ The tools for benchmarking applications against equivalent Monte Carlo
8
+ methods build on this library and live in the separate
9
+ [signaloid-benchmarking](https://github.com/signaloid/signaloid-benchmarking)
10
+ repository.
11
+
12
+ <picture>
13
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/signaloid/signaloid-data-toolkit/main/images/signaloid-external-illustration-signaloid-data-toolkit-diagram-flat-dark-withCR.png">
14
+ <img alt="signaloid-data-toolkit diagram" src="https://raw.githubusercontent.com/signaloid/signaloid-data-toolkit/main/images/signaloid-external-illustration-signaloid-data-toolkit-diagram-flat-light-withCR.png">
15
+ </picture>
16
+
17
+ ## Requirements
18
+
19
+ The Signaloid Data Toolkit requires Python 3.11 or later. See
20
+ `pyproject.toml` for the full list of dependencies.
21
+
22
+ ## Installation
23
+ Install the `signaloid` package via pip (recommended):
24
+ ```bash
25
+ python -m pip install signaloid
26
+ ```
27
+
28
+
29
+ Install the latest version from the GitHub repository:
30
+ ```bash
31
+ python -m pip install git+https://github.com/signaloid/signaloid-data-toolkit
32
+ ```
33
+
34
+ Alternatively, clone this repository and install from source with:
35
+ ```bash
36
+ python -m pip install .
37
+ ```
38
+
39
+ ## Usage
40
+
41
+ ### Parsing Ux Data
42
+ Construct `DistributionalValue` Python objects by parsing
43
+ [Ux Data](https://docs.signaloid.io/docs/uxhw-api/ux-data-format/) in
44
+ Ux-string or Ux Binary format.
45
+
46
+ ```python
47
+ from signaloid.distributional.distributional import DistributionalValue
48
+
49
+ # Intermediate code which writes to ux_string and ux_binary_buffer
50
+ # ...
51
+
52
+ # Parse a Ux-string
53
+ dist_value = DistributionalValue.parse(ux_string)
54
+
55
+ # Parse a Ux Binary buffer
56
+ dist_value = DistributionalValue.parse(ux_binary_buffer)
57
+ ```
58
+
59
+ ### Create Distribution Plots
60
+ Create plots to visualize distributional information by using the
61
+ [`plot` function](https://github.com/signaloid/signaloid-data-toolkit/blob/main/src/signaloid/distributional_information_plotting/plot_wrapper.py)
62
+ with a `PlotData` object built from a `DistributionalValue` containing Ux Data.
63
+ The `plot` function is a wrapper function for the `PlotHistogramDiracDeltas`
64
+ class for plotting a distributional value as a histogram with variable bin
65
+ widths.
66
+
67
+ ```python
68
+ from signaloid.distributional.distributional import DistributionalValue
69
+ from signaloid.distributional_information_plotting.plot_histogram_dirac_deltas import PlotData
70
+ from signaloid.distributional_information_plotting.plot_wrapper import plot
71
+
72
+ # Intermediate code which writes to ux_string
73
+ # ...
74
+
75
+ # Create distributional value object from Ux-string
76
+ dist_value = DistributionalValue.parse(ux_string)
77
+ plot(PlotData(dist_value))
78
+ ```
79
+
80
+ For plotting from raw samples, saving to a file, and the other `plot` options,
81
+ see the package [README.md](https://github.com/signaloid/signaloid-data-toolkit/blob/main/src/signaloid/distributional_information_plotting/README.md).
82
+
83
+ ### Sample from Ux Data
84
+ Draw random samples from a distributional value with the
85
+ [`sample_generator` function](https://github.com/signaloid/signaloid-data-toolkit/blob/main/src/signaloid/distributional_information_plotting/sample_generator.py).
86
+ Samples of the finite part of the distribution are drawn by inverse transform
87
+ sampling of the binned distribution. Distributions that also carry non-finite
88
+ mass (`NaN`, `-Inf`, `+Inf`) are sampled as a mixture, with each sample drawn
89
+ from the finite or the non-finite part in proportion to their masses.
90
+
91
+ ```python
92
+ from signaloid.distributional_information_plotting.sample_generator import sample_generator
93
+
94
+ # Intermediate code which writes to ux_string
95
+ # ...
96
+
97
+ samples = sample_generator(ux_string, n_samples=1000)
98
+ ```
99
+
100
+ To sample from a `DistributionalValue` that is already parsed, use
101
+ `sample_from_distributional_value` from the same module.
@@ -0,0 +1,79 @@
1
+ [tool.poetry]
2
+ name = "signaloid"
3
+ version = "2.0.0"
4
+ description = "Signaloid Data Toolkit for interacting with Signaloid's UxHw®."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ homepage = "https://signaloid.com"
8
+ repository = "https://github.com/signaloid/signaloid-data-toolkit"
9
+ authors = [
10
+ "Signaloid <info@signaloid.com>"
11
+ ]
12
+
13
+ packages = [
14
+ { include = "signaloid", from = "src" }
15
+ ]
16
+
17
+ [tool.poetry-dynamic-versioning]
18
+ enable = false
19
+ vcs = "git"
20
+ style = "pep440"
21
+
22
+
23
+ [tool.poetry.group.dev.dependencies]
24
+ wheel = "^0.46.3"
25
+ types-toml = "^0.10.8.20240310"
26
+ pytest = "^9.0.3"
27
+ mypy = "^1.19.1"
28
+ flake8 = "^7.3.0"
29
+ toml = "^0.10.2"
30
+ black = "^26.3.1"
31
+
32
+ [build-system]
33
+ requires = ["poetry-core>=1.9.1", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
34
+ build-backend = "poetry_dynamic_versioning.backend"
35
+
36
+ [tool.poetry.dependencies]
37
+ python = ">=3.11,<4"
38
+ numpy = [
39
+ { version = ">=2.0.0", python = ">=3.11,<3.13" },
40
+ { version = ">=2.1.0", python = ">=3.11,<3.14" },
41
+ { version = ">=2.4.1", python = ">=3.11,<3.15" },
42
+ ]
43
+ matplotlib = [
44
+ { version = ">=3.9.0", python = ">=3.11,<3.13" },
45
+ { version = ">=3.10.0", python = ">=3.11,<3.14" },
46
+ { version = ">=3.10.5", python = ">=3.11,<3.15" },
47
+ ]
48
+ pillow = ">=13.0.0"
49
+ scipy = ">=1.14.0"
50
+
51
+ [tool.poetry.scripts]
52
+ signaloid-uxdata-toolkit = "signaloid.uxdata_toolkit:main"
53
+
54
+ [tool.mypy]
55
+ warn_unused_configs = true
56
+ strict = true
57
+ disallow_any_generics = false
58
+ python_version = "3.11"
59
+ exclude = '(^|/)\.venv/'
60
+ # `signaloid` is a PEP 420 namespace package, so it has no top-level `py.typed`
61
+ # marker. Resolve it from the source tree (via `mypy_path`) rather than as an
62
+ # installed distribution, so `mypy -p signaloid` type-checks the sources
63
+ # directly instead of failing on the absent namespace-level marker.
64
+ mypy_path = "src"
65
+ namespace_packages = true
66
+ explicit_package_bases = true
67
+
68
+ [[tool.mypy.overrides]]
69
+ module = [
70
+ "signaloid.distributional_information_plotting.*",
71
+ "signaloid.distributional.*",
72
+ "signaloid.circuitpython.*",
73
+ ]
74
+ disallow_untyped_calls = false
75
+ disallow_untyped_defs = false
76
+ disallow_incomplete_defs = false
77
+ warn_unused_ignores = false
78
+ check_untyped_defs = false
79
+ strict_equality = false
@@ -0,0 +1,3 @@
1
+ ### Helpers for CircuitPython
2
+ - `extended_ulab_numpy.py`: Extends the [ulab numpy implementation](https://docs.circuitpython.org/en/latest/shared-bindings/ulab/numpy/index.html) with extra methods needed for the `distributional` and `distributional_information_plotting` modules.
3
+ - `plot_wrapper.py`: Implements a plot renderer specifically for Signaloid Ux histograms.