tensorwaves 0.4.16__tar.gz → 0.4.17__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 (109) hide show
  1. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.cspell.json +3 -1
  2. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.github/workflows/benchmark.yml +1 -1
  3. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.github/workflows/redirect-gh-pages.yml +1 -1
  4. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.gitignore +5 -0
  5. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.pre-commit-config.yaml +29 -40
  6. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.vscode/extensions.json +2 -1
  7. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.vscode/settings.json +3 -0
  8. tensorwaves-0.4.17/PKG-INFO +93 -0
  9. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/benchmarks/expression.py +9 -7
  10. tensorwaves-0.4.17/benchmarks/precision.py +69 -0
  11. tensorwaves-0.4.17/benchmarks/unbinned_nll.py +450 -0
  12. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/docs/conf.py +8 -5
  13. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/docs/install.md +19 -0
  14. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/pyproject.toml +293 -272
  15. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/__init__.py +2 -0
  16. tensorwaves-0.4.17/src/tensorwaves/config.py +119 -0
  17. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/data/__init__.py +10 -4
  18. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/data/phasespace.py +2 -2
  19. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/data/rng.py +7 -6
  20. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/data/transform.py +1 -1
  21. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/estimator.py +20 -12
  22. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/function/_backend.py +20 -15
  23. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/function/sympy/__init__.py +14 -12
  24. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/function/sympy/_printer.py +2 -2
  25. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/interface.py +3 -6
  26. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/optimizer/__init__.py +2 -2
  27. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/optimizer/callbacks.py +16 -14
  28. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/optimizer/minuit.py +1 -1
  29. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/optimizer/scipy.py +3 -3
  30. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/version.py +3 -3
  31. tensorwaves-0.4.17/src/tensorwaves.egg-info/PKG-INFO +93 -0
  32. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves.egg-info/SOURCES.txt +6 -1
  33. tensorwaves-0.4.17/src/tensorwaves.egg-info/scm_file_list.json +100 -0
  34. tensorwaves-0.4.17/src/tensorwaves.egg-info/scm_version.json +8 -0
  35. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/data/test_transform.py +1 -1
  36. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/function/test_function.py +2 -2
  37. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/function/test_sympy.py +3 -3
  38. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/optimizer/test_fit_simple_model.py +23 -23
  39. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/optimizer/test_gradient.py +46 -1
  40. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/optimizer/test_minuit.py +7 -5
  41. tensorwaves-0.4.17/tests/test_config.py +176 -0
  42. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/uv.lock +1936 -1573
  43. tensorwaves-0.4.16/.taplo.toml +0 -19
  44. tensorwaves-0.4.16/PKG-INFO +0 -284
  45. tensorwaves-0.4.16/src/tensorwaves.egg-info/PKG-INFO +0 -284
  46. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.binder/apt.txt +0 -0
  47. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.binder/postBuild +0 -0
  48. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.binder/runtime.txt +0 -0
  49. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.editorconfig +0 -0
  50. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.envrc +0 -0
  51. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.github/dependabot.yml +0 -0
  52. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.github/release-drafter.yml +0 -0
  53. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.github/workflows/cd.yml +0 -0
  54. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.github/workflows/ci.yml +0 -0
  55. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.github/workflows/clean-caches.yml +0 -0
  56. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.github/workflows/lock.yml +0 -0
  57. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.github/workflows/pr-linting.yml +0 -0
  58. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.github/workflows/release-drafter.yml +0 -0
  59. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.prettierignore +0 -0
  60. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.python-version +0 -0
  61. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.readthedocs.yml +0 -0
  62. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/.vscode/launch.json +0 -0
  63. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/CITATION.cff +0 -0
  64. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/CONTRIBUTING.md +0 -0
  65. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/LICENSE +0 -0
  66. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/README.md +0 -0
  67. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/benchmarks/__init__.py +0 -0
  68. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/benchmarks/ampform.py +0 -0
  69. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/benchmarks/conftest.py +0 -0
  70. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/codecov.yml +0 -0
  71. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/docs/.gitignore +0 -0
  72. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/docs/_static/favicon.ico +0 -0
  73. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/docs/_static/linebreaks-api.css +0 -0
  74. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/docs/amplitude-analysis/analytic-continuation.ipynb +0 -0
  75. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/docs/amplitude-analysis.ipynb +0 -0
  76. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/docs/index.md +0 -0
  77. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/docs/tensorflow.txt +0 -0
  78. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/docs/usage/basics.ipynb +0 -0
  79. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/docs/usage/binned-fit.ipynb +0 -0
  80. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/docs/usage/caching.ipynb +0 -0
  81. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/docs/usage/chi-squared.ipynb +0 -0
  82. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/docs/usage/faster-lambdify.ipynb +0 -0
  83. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/docs/usage/unbinned-fit.ipynb +0 -0
  84. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/docs/usage.ipynb +0 -0
  85. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/setup.cfg +0 -0
  86. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/data/_attrs.py +0 -0
  87. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/data/_data_sample.py +0 -0
  88. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/function/__init__.py +0 -0
  89. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/optimizer/parameter.py +0 -0
  90. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves/py.typed +0 -0
  91. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves.egg-info/dependency_links.txt +0 -0
  92. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves.egg-info/requires.txt +0 -0
  93. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/src/tensorwaves.egg-info/top_level.txt +0 -0
  94. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/__init__.py +0 -0
  95. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/conftest.py +0 -0
  96. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/data/__init__.py +0 -0
  97. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/data/test_data.py +0 -0
  98. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/data/test_phasespace.py +0 -0
  99. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/data/test_rng.py +0 -0
  100. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/function/__init__.py +0 -0
  101. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/function/test_ampform.py +0 -0
  102. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/function/test_backend.py +0 -0
  103. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/optimizer/__init__.py +0 -0
  104. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/optimizer/test_callbacks.py +0 -0
  105. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/optimizer/test_parameter.py +0 -0
  106. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/optimizer/test_scipy.py +0 -0
  107. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/output/.gitignore +0 -0
  108. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/test_estimator.py +0 -0
  109. {tensorwaves-0.4.16 → tensorwaves-0.4.17}/tests/test_interface.py +0 -0
@@ -29,7 +29,6 @@
29
29
  ".pre-commit-config.yaml",
30
30
  ".prettierignore",
31
31
  ".readthedocs.yml",
32
- ".taplo.toml",
33
32
  ".vscode/*",
34
33
  "CITATION.cff",
35
34
  "codecov.yml",
@@ -125,6 +124,7 @@
125
124
  "ncalls",
126
125
  "ncols",
127
126
  "ndarray",
127
+ "njit",
128
128
  "noqa",
129
129
  "noreply",
130
130
  "nrows",
@@ -134,6 +134,7 @@
134
134
  "pcolormesh",
135
135
  "phasespace",
136
136
  "phsp",
137
+ "prange",
137
138
  "precommit",
138
139
  "prefactor",
139
140
  "preorder",
@@ -240,6 +241,7 @@
240
241
  "vectorize",
241
242
  "venv",
242
243
  "weisskopf",
244
+ "wirtinger",
243
245
  "xcode",
244
246
  "Zenodo",
245
247
  "zfit"
@@ -18,7 +18,7 @@ jobs:
18
18
  name: Performance regression
19
19
  runs-on: ubuntu-24.04
20
20
  steps:
21
- - uses: actions/checkout@v6
21
+ - uses: actions/checkout@v7
22
22
  with:
23
23
  fetch-depth: 0
24
24
  - uses: actions/setup-python@v6
@@ -26,7 +26,7 @@ jobs:
26
26
  </body>
27
27
  </html>' > build/index.html
28
28
  - id: deployment
29
- uses: actions/upload-pages-artifact@v4
29
+ uses: actions/upload-pages-artifact@v5
30
30
  with:
31
31
  path: build/
32
32
 
@@ -39,6 +39,11 @@ pyvenv*/
39
39
  # Settings
40
40
  .idea/
41
41
  **.code-workspace
42
+ /.agents
43
+ /.claude/
44
+ /.codex
45
+ /AGENTS.md
46
+ /CLAUDE.md
42
47
 
43
48
  # Exceptions
44
49
  !.cspell.json
@@ -4,6 +4,8 @@ ci:
4
4
  autoupdate_schedule: quarterly
5
5
  skip:
6
6
  - check-jsonschema
7
+ - tombi-format
8
+ - tombi-lint
7
9
  - ty
8
10
  - uv-lock
9
11
 
@@ -14,23 +16,9 @@ repos:
14
16
  - id: check-useless-excludes
15
17
 
16
18
  - repo: https://github.com/ComPWA/policy
17
- rev: 0.8.10
19
+ rev: 0.9.3
18
20
  hooks:
19
21
  - id: check-dev-files
20
- args:
21
- - --doc-apt-packages=graphviz
22
- - --excluded-python-versions=3.14
23
- - --pytest-single-threaded
24
- - --repo-name=tensorwaves
25
- - --repo-title=TensorWaves
26
- - --type-checker=ty
27
- - id: colab-toc-visible
28
- - id: fix-nbformat-version
29
- - id: remove-empty-tags
30
- - id: set-nb-cells
31
- args: [--autolink-concat]
32
- - id: set-nb-display-name
33
- - id: strip-nb-whitespace
34
22
 
35
23
  - repo: https://github.com/kynan/nbstripout
36
24
  rev: 0.9.1
@@ -60,8 +48,19 @@ repos:
60
48
  metadata.varInspector
61
49
  metadata.vscode
62
50
 
51
+ - repo: https://github.com/ComPWA/nbhooks
52
+ rev: 0.0.1
53
+ hooks:
54
+ - id: colab-toc-visible
55
+ - id: fix-nbformat-version
56
+ - id: remove-empty-tags
57
+ - id: set-nb-cells
58
+ args: [--autolink-concat]
59
+ - id: set-nb-display-name
60
+ - id: strip-nb-whitespace
61
+
63
62
  - repo: https://github.com/astral-sh/ruff-pre-commit
64
- rev: v0.15.12
63
+ rev: v0.16.1
65
64
  hooks:
66
65
  - id: ruff-check
67
66
  args: [--fix]
@@ -96,25 +95,20 @@ repos:
96
95
  )$
97
96
  - id: trailing-whitespace
98
97
 
98
+ - repo: https://github.com/tombi-toml/tombi-pre-commit
99
+ rev: v1.2.6
100
+ hooks:
101
+ - id: tombi-format
102
+ - id: tombi-lint
103
+ args: [--error-on-warnings]
104
+
99
105
  - repo: https://github.com/ComPWA/prettier-pre-commit
100
106
  rev: v3.8.1
101
107
  hooks:
102
108
  - id: prettier
103
109
 
104
- - repo: https://github.com/ComPWA/taplo-pre-commit
105
- rev: v0.9.3
106
- hooks:
107
- - id: taplo-format
108
-
109
- - repo: https://github.com/pappasam/toml-sort
110
- rev: v0.24.4
111
- hooks:
112
- - id: toml-sort
113
- args:
114
- - --in-place
115
-
116
110
  - repo: https://github.com/python-jsonschema/check-jsonschema
117
- rev: 0.37.2
111
+ rev: 0.37.4
118
112
  hooks:
119
113
  - id: check-jsonschema
120
114
  name: Check CITATION.cff
@@ -127,13 +121,12 @@ repos:
127
121
  pass_filenames: false
128
122
 
129
123
  - repo: https://github.com/streetsidesoftware/cspell-cli
130
- rev: v10.0.0
124
+ rev: v10.0.1
131
125
  hooks:
132
126
  - id: cspell
133
- language_version: 25.9.0
134
127
 
135
128
  - repo: https://github.com/editorconfig-checker/editorconfig-checker.python
136
- rev: 3.6.1
129
+ rev: 3.8.0
137
130
  hooks:
138
131
  - id: editorconfig-checker
139
132
  name: editorconfig
@@ -143,17 +136,13 @@ repos:
143
136
  .*\.py
144
137
  )$
145
138
 
146
- - repo: local
139
+ - repo: https://github.com/astral-sh/ty-pre-commit
140
+ rev: v0.0.67
147
141
  hooks:
148
142
  - id: ty
149
- name: ty
150
- entry: ty check
151
- args: [--no-progress, --output-format=concise]
152
- require_serial: true
153
- language: system
154
- types_or: [python, pyi, jupyter]
143
+ args: [--group=types, --no-default-groups]
155
144
 
156
145
  - repo: https://github.com/astral-sh/uv-pre-commit
157
- rev: 0.11.13
146
+ rev: 0.12.1
158
147
  hooks:
159
148
  - id: uv-lock
@@ -19,7 +19,7 @@
19
19
  "soulcode.vscode-unwanted-extensions",
20
20
  "stkb.rewrap",
21
21
  "streetsidesoftware.code-spell-checker",
22
- "tamasfe.even-better-toml",
22
+ "tombi-toml.tombi",
23
23
  "yzhang.markdown-all-in-one"
24
24
  ],
25
25
  "unwantedRecommendations": [
@@ -34,6 +34,7 @@
34
34
  "ms-python.vscode-pylance",
35
35
  "ms-toolsai.vscode-jupyter-slideshow",
36
36
  "ryanluker.vscode-coverage-gutters",
37
+ "tamasfe.even-better-toml",
37
38
  "travisillig.vscode-json-stable-stringify",
38
39
  "tyriar.sort-lines"
39
40
  ]
@@ -23,6 +23,9 @@
23
23
  "editor.defaultFormatter": "charliermarsh.ruff",
24
24
  "editor.rulers": [88]
25
25
  },
26
+ "[toml]": {
27
+ "editor.defaultFormatter": "tombi-toml.tombi"
28
+ },
26
29
  "[yaml]": {
27
30
  "editor.defaultFormatter": "esbenp.prettier-vscode"
28
31
  },
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: tensorwaves
3
+ Version: 0.4.17
4
+ Summary: Python fitter package for multiple computational back-ends
5
+ Author-email: Common Partial Wave Analysis <compwa-admin@ep1.rub.de>
6
+ Maintainer-email: compwa-admin@ep1.rub.de
7
+ License-Expression: Apache-2.0
8
+ Project-URL: Changelog, https://github.com/ComPWA/tensorwaves/releases
9
+ Project-URL: Documentation, https://tensorwaves.rtfd.io
10
+ Project-URL: Issues, https://github.com/ComPWA/tensorwaves/issues
11
+ Project-URL: Source, https://github.com/ComPWA/tensorwaves
12
+ Keywords: HEP,PWA,amplitude analysis,partial wave analysis,particle physics,physics,tensorflow
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Education
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: Natural Language :: English
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Scientific/Engineering
25
+ Classifier: Topic :: Scientific/Engineering :: Physics
26
+ Classifier: Typing :: Typed
27
+ Requires-Python: >=3.10
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ Requires-Dist: PyYAML>=5.1
31
+ Requires-Dist: attrs>=20.1.0
32
+ Requires-Dist: iminuit>=2.0
33
+ Requires-Dist: numpy
34
+ Requires-Dist: rich
35
+ Requires-Dist: sympy>=1.9
36
+ Requires-Dist: tqdm>=4.24.0
37
+ Provides-Extra: jax
38
+ Requires-Dist: jax; extra == "jax"
39
+ Requires-Dist: jaxlib; extra == "jax"
40
+ Provides-Extra: numba
41
+ Requires-Dist: numba; extra == "numba"
42
+ Provides-Extra: phsp
43
+ Requires-Dist: phasespace[tf]>=1.7.0; extra == "phsp"
44
+ Requires-Dist: tensorwaves[tf]; extra == "phsp"
45
+ Provides-Extra: pwa
46
+ Requires-Dist: ampform[viz]>=0.12.0; extra == "pwa"
47
+ Requires-Dist: tensorwaves[phsp]; extra == "pwa"
48
+ Provides-Extra: scipy
49
+ Requires-Dist: scipy>=1; extra == "scipy"
50
+ Provides-Extra: tf
51
+ Requires-Dist: tensorboard; extra == "tf"
52
+ Requires-Dist: tensorflow>=2.12; extra == "tf"
53
+ Dynamic: license-file
54
+
55
+ # TensorWaves
56
+
57
+ [![10.5281/zenodo.5526650](https://zenodo.org/badge/doi/10.5281/zenodo.5526650.svg)](https://doi.org/10.5281/zenodo.5526650)
58
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
59
+
60
+ [![PyPI package](https://badge.fury.io/py/tensorwaves.svg)](https://pypi.org/project/tensorwaves)
61
+ [![Conda package](https://anaconda.org/conda-forge/tensorwaves/badges/version.svg)](https://anaconda.org/conda-forge/tensorwaves)
62
+ [![Supported Python versions](https://img.shields.io/pypi/pyversions/tensorwaves)](https://pypi.org/project/tensorwaves)
63
+
64
+ [![Binder](https://static.mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/ComPWA/tensorwaves/stable?urlpath=lab)
65
+ [![Google Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ComPWA/tensorwaves/blob/stable)
66
+ [![Open in Visual Studio Code](https://img.shields.io/badge/vscode-open-blue?logo=visualstudiocode)](https://open.vscode.dev/ComPWA/tensorwaves)
67
+
68
+ [![Documentation build status](https://readthedocs.org/projects/tensorwaves/badge/?version=latest)](https://tensorwaves.readthedocs.io)
69
+ [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/ComPWA/tensorwaves/main.svg)](https://results.pre-commit.ci/latest/github/ComPWA/tensorwaves/main)
70
+ [![CI](https://github.com/ComPWA/tensorwaves/actions/workflows/ci.yml/badge.svg)](https://github.com/ComPWA/tensorwaves/actions/workflows/ci.yml)
71
+ [![Test coverage](https://codecov.io/gh/ComPWA/tensorwaves/branch/main/graph/badge.svg)](https://codecov.io/gh/ComPWA/tensorwaves)
72
+ [![Spelling checked](https://img.shields.io/badge/cspell-checked-brightgreen.svg)](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
73
+ [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
74
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
75
+ [![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
76
+ [![ty](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ty/main/assets/badge/v0.json)](https://github.com/astral-sh/ty)
77
+
78
+ TensorWaves is a fitter package that optimizes mathematical models to data samples. The
79
+ models can be any _symbolic_ mathematical expression that is then converted to any
80
+ computational backend. In addition, TensorWaves provides functionality to generate toy
81
+ Monte Carlo data samples. The package is developed in parallel with
82
+ [AmpForm](https://github.com/ComPWA/ampform), which implements physics models, but its
83
+ 'lambdifying' mechanisms can in principle be used independently.
84
+
85
+ All documentation can be found on
86
+ [tensorwaves.rtfd.io](https://tensorwaves.readthedocs.io).
87
+
88
+ For an overview of **upcoming releases and planned functionality**, see
89
+ [here](https://github.com/ComPWA/tensorwaves/milestones?direction=asc&sort=title&state=open).
90
+
91
+ ## Contribute
92
+
93
+ See [`CONTRIBUTING.md`](./CONTRIBUTING.md)
@@ -26,14 +26,16 @@ def poisson(x: sp.Symbol, k) -> sp.Expr:
26
26
  symbols = sp.symbols("x y (a:c) mu_(:2) sigma_(:2) omega")
27
27
  x, y, a, b, c, mu1, mu2, sigma1, sigma2, omega = symbols
28
28
  expression = (
29
- a * gaussian(x, mu1, sigma1) + b * gaussian(x, mu2, sigma2) + c * poisson(x, k=2)
29
+ a**2 * gaussian(x, mu1, sigma1)
30
+ + b**2 * gaussian(x, mu2, sigma2)
31
+ + c**2 * poisson(x, k=2)
30
32
  ) * sp.cos(y * omega) ** 2
31
33
 
32
34
  domain_boundaries = {"x": (0, 5), "y": (-np.pi, +np.pi)}
33
35
  parameter_defaults = {
34
- a: 0.15,
35
- b: 0.05,
36
- c: 0.3,
36
+ a: np.sqrt(0.15),
37
+ b: np.sqrt(0.05),
38
+ c: np.sqrt(0.3),
37
39
  mu1: 1.0,
38
40
  mu2: 2.7,
39
41
  omega: 0.5,
@@ -41,9 +43,9 @@ parameter_defaults = {
41
43
  sigma2: 0.5,
42
44
  }
43
45
  initial_parameters = {
44
- "a": 0.2,
45
- "b": 0.1,
46
- "c": 0.2,
46
+ "a": np.sqrt(0.2),
47
+ "b": np.sqrt(0.1),
48
+ "c": np.sqrt(0.2),
47
49
  "mu_0": 0.9,
48
50
  "sigma_0": 0.4,
49
51
  "sigma_1": 0.4,
@@ -0,0 +1,69 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ import pytest
6
+ import sympy as sp
7
+
8
+ from tensorwaves import configure
9
+ from tensorwaves.function.sympy import create_function
10
+
11
+ if TYPE_CHECKING:
12
+ from typing import Literal
13
+
14
+ from tensorwaves.config import Precision
15
+ from tensorwaves.interface import DataSample
16
+
17
+ Backend = Literal["jax", "tensorflow"]
18
+
19
+
20
+ @pytest.mark.benchmark(group="precision")
21
+ @pytest.mark.parametrize("backend", ["jax", "tensorflow"])
22
+ @pytest.mark.parametrize("precision", ["float32", "float64"])
23
+ def test_precision(benchmark, backend: Backend, precision: Precision) -> None:
24
+ _configure_backend(backend, precision)
25
+ x = sp.Symbol("x")
26
+ function = create_function(sp.sin(x) ** 2 + sp.exp(-x), backend=backend)
27
+ data = _create_data(backend)
28
+ result = benchmark(lambda: _evaluate(function, data, backend))
29
+ _assert_precision(backend, precision, data, result)
30
+
31
+
32
+ def _configure_backend(backend: Backend, precision: Precision) -> None:
33
+ if backend == "jax":
34
+ configure(jax_precision=precision)
35
+ else:
36
+ configure(tensorflow_precision=precision)
37
+
38
+
39
+ def _create_data(backend: Backend):
40
+ if backend == "jax":
41
+ import jax.numpy as jnp
42
+
43
+ return {"x": jnp.linspace(0, 10, num=1_000_000).block_until_ready()}
44
+
45
+ import tensorflow.experimental.numpy as tnp # ty: ignore[unresolved-import]
46
+
47
+ return {"x": tnp.linspace(0, 10, num=1_000_000)}
48
+
49
+
50
+ def _evaluate(function, data: DataSample, backend: Backend):
51
+ result = function(data)
52
+ if backend == "jax":
53
+ result.block_until_ready()
54
+ return result
55
+
56
+
57
+ def _assert_precision(
58
+ backend: Backend, precision: Precision, data: dict, result
59
+ ) -> None:
60
+ assert data["x"].dtype.name == precision
61
+ assert result.dtype.name == precision
62
+ if backend == "jax":
63
+ import jax
64
+
65
+ assert jax.config.x64_enabled == (precision == "float64")
66
+ else:
67
+ import tensorflow.experimental.numpy as tnp # ty: ignore[unresolved-import]
68
+
69
+ assert tnp.asarray(1.0).dtype.name == precision