tensorwaves 0.4.15__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 (111) hide show
  1. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.cspell.json +3 -1
  2. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.github/dependabot.yml +5 -0
  3. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.github/workflows/benchmark.yml +1 -1
  4. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.github/workflows/redirect-gh-pages.yml +2 -2
  5. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.github/workflows/release-drafter.yml +1 -1
  6. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.gitignore +5 -0
  7. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.pre-commit-config.yaml +31 -41
  8. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.vscode/extensions.json +2 -1
  9. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.vscode/settings.json +3 -0
  10. tensorwaves-0.4.17/PKG-INFO +93 -0
  11. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/benchmarks/expression.py +9 -7
  12. tensorwaves-0.4.17/benchmarks/precision.py +69 -0
  13. tensorwaves-0.4.17/benchmarks/unbinned_nll.py +450 -0
  14. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/docs/amplitude-analysis/analytic-continuation.ipynb +4 -5
  15. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/docs/amplitude-analysis.ipynb +8 -6
  16. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/docs/conf.py +10 -4
  17. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/docs/install.md +19 -0
  18. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/docs/usage/basics.ipynb +13 -9
  19. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/docs/usage/binned-fit.ipynb +2 -3
  20. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/docs/usage/caching.ipynb +4 -5
  21. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/docs/usage/chi-squared.ipynb +2 -3
  22. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/docs/usage/faster-lambdify.ipynb +2 -3
  23. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/docs/usage/unbinned-fit.ipynb +2 -3
  24. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/docs/usage.ipynb +2 -3
  25. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/pyproject.toml +297 -263
  26. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves/__init__.py +2 -0
  27. tensorwaves-0.4.17/src/tensorwaves/config.py +119 -0
  28. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves/data/__init__.py +10 -4
  29. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves/data/phasespace.py +2 -2
  30. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves/data/rng.py +7 -6
  31. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves/data/transform.py +1 -1
  32. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves/estimator.py +20 -12
  33. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves/function/__init__.py +1 -1
  34. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves/function/_backend.py +20 -15
  35. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves/function/sympy/__init__.py +23 -17
  36. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves/function/sympy/_printer.py +2 -2
  37. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves/interface.py +3 -6
  38. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves/optimizer/__init__.py +2 -2
  39. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves/optimizer/callbacks.py +126 -10
  40. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves/optimizer/minuit.py +1 -5
  41. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves/optimizer/scipy.py +3 -8
  42. tensorwaves-0.4.17/src/tensorwaves/version.py +24 -0
  43. tensorwaves-0.4.17/src/tensorwaves.egg-info/PKG-INFO +93 -0
  44. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves.egg-info/SOURCES.txt +6 -1
  45. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves.egg-info/requires.txt +2 -0
  46. tensorwaves-0.4.17/src/tensorwaves.egg-info/scm_file_list.json +100 -0
  47. tensorwaves-0.4.17/src/tensorwaves.egg-info/scm_version.json +8 -0
  48. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/data/test_transform.py +3 -3
  49. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/function/test_function.py +2 -2
  50. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/function/test_sympy.py +3 -3
  51. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/optimizer/test_fit_simple_model.py +25 -24
  52. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/optimizer/test_gradient.py +46 -1
  53. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/optimizer/test_minuit.py +7 -5
  54. tensorwaves-0.4.17/tests/test_config.py +176 -0
  55. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/test_estimator.py +1 -1
  56. tensorwaves-0.4.17/uv.lock +6230 -0
  57. tensorwaves-0.4.15/.taplo.toml +0 -19
  58. tensorwaves-0.4.15/PKG-INFO +0 -282
  59. tensorwaves-0.4.15/src/tensorwaves/version.py +0 -34
  60. tensorwaves-0.4.15/src/tensorwaves.egg-info/PKG-INFO +0 -282
  61. tensorwaves-0.4.15/uv.lock +0 -5719
  62. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.binder/apt.txt +0 -0
  63. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.binder/postBuild +0 -0
  64. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.binder/runtime.txt +0 -0
  65. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.editorconfig +0 -0
  66. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.envrc +0 -0
  67. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.github/release-drafter.yml +0 -0
  68. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.github/workflows/cd.yml +0 -0
  69. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.github/workflows/ci.yml +0 -0
  70. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.github/workflows/clean-caches.yml +0 -0
  71. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.github/workflows/lock.yml +0 -0
  72. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.github/workflows/pr-linting.yml +0 -0
  73. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.prettierignore +0 -0
  74. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.python-version +0 -0
  75. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.readthedocs.yml +0 -0
  76. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/.vscode/launch.json +0 -0
  77. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/CITATION.cff +0 -0
  78. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/CONTRIBUTING.md +0 -0
  79. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/LICENSE +0 -0
  80. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/README.md +0 -0
  81. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/benchmarks/__init__.py +0 -0
  82. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/benchmarks/ampform.py +0 -0
  83. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/benchmarks/conftest.py +0 -0
  84. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/codecov.yml +0 -0
  85. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/docs/.gitignore +0 -0
  86. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/docs/_static/favicon.ico +0 -0
  87. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/docs/_static/linebreaks-api.css +0 -0
  88. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/docs/index.md +0 -0
  89. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/docs/tensorflow.txt +0 -0
  90. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/setup.cfg +0 -0
  91. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves/data/_attrs.py +0 -0
  92. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves/data/_data_sample.py +0 -0
  93. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves/optimizer/parameter.py +0 -0
  94. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves/py.typed +0 -0
  95. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves.egg-info/dependency_links.txt +0 -0
  96. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/src/tensorwaves.egg-info/top_level.txt +0 -0
  97. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/__init__.py +0 -0
  98. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/conftest.py +0 -0
  99. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/data/__init__.py +0 -0
  100. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/data/test_data.py +0 -0
  101. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/data/test_phasespace.py +0 -0
  102. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/data/test_rng.py +0 -0
  103. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/function/__init__.py +0 -0
  104. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/function/test_ampform.py +0 -0
  105. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/function/test_backend.py +0 -0
  106. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/optimizer/__init__.py +0 -0
  107. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/optimizer/test_callbacks.py +0 -0
  108. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/optimizer/test_parameter.py +0 -0
  109. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/optimizer/test_scipy.py +0 -0
  110. {tensorwaves-0.4.15 → tensorwaves-0.4.17}/tests/output/.gitignore +0 -0
  111. {tensorwaves-0.4.15 → 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"
@@ -12,6 +12,11 @@ updates:
12
12
  labels: [⬆️ Lock]
13
13
  multi-ecosystem-group: lock
14
14
  patterns: ["*"]
15
+ - package-ecosystem: pre-commit
16
+ directory: "/"
17
+ labels: [⬆️ Lock]
18
+ multi-ecosystem-group: lock
19
+ patterns: ["*"]
15
20
  - package-ecosystem: uv
16
21
  directory: "/"
17
22
  labels: [⬆️ Lock]
@@ -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
 
@@ -41,4 +41,4 @@ jobs:
41
41
  runs-on: ubuntu-24.04
42
42
  steps:
43
43
  - id: deployment
44
- uses: actions/deploy-pages@v4
44
+ uses: actions/deploy-pages@v5
@@ -11,6 +11,6 @@ jobs:
11
11
  update_release_draft:
12
12
  runs-on: ubuntu-slim
13
13
  steps:
14
- - uses: release-drafter/release-drafter@v6
14
+ - uses: release-drafter/release-drafter@v7
15
15
  env:
16
16
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -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
@@ -1,8 +1,11 @@
1
1
  ci:
2
2
  autofix_commit_msg: "MAINT: implement pre-commit autofixes"
3
3
  autoupdate_commit_msg: "MAINT: upgrade lock files"
4
+ autoupdate_schedule: quarterly
4
5
  skip:
5
6
  - check-jsonschema
7
+ - tombi-format
8
+ - tombi-lint
6
9
  - ty
7
10
  - uv-lock
8
11
 
@@ -13,26 +16,12 @@ repos:
13
16
  - id: check-useless-excludes
14
17
 
15
18
  - repo: https://github.com/ComPWA/policy
16
- rev: 0.8.3
19
+ rev: 0.9.3
17
20
  hooks:
18
21
  - id: check-dev-files
19
- args:
20
- - --doc-apt-packages=graphviz
21
- - --excluded-python-versions=3.14
22
- - --pytest-single-threaded
23
- - --repo-name=tensorwaves
24
- - --repo-title=TensorWaves
25
- - --type-checker=ty
26
- - id: colab-toc-visible
27
- - id: fix-nbformat-version
28
- - id: remove-empty-tags
29
- - id: set-nb-cells
30
- args: [--autolink-concat]
31
- - id: set-nb-display-name
32
- - id: strip-nb-whitespace
33
22
 
34
23
  - repo: https://github.com/kynan/nbstripout
35
- rev: 0.9.0
24
+ rev: 0.9.1
36
25
  hooks:
37
26
  - id: nbstripout
38
27
  args:
@@ -59,8 +48,19 @@ repos:
59
48
  metadata.varInspector
60
49
  metadata.vscode
61
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
+
62
62
  - repo: https://github.com/astral-sh/ruff-pre-commit
63
- rev: v0.15.1
63
+ rev: v0.16.1
64
64
  hooks:
65
65
  - id: ruff-check
66
66
  args: [--fix]
@@ -95,25 +95,20 @@ repos:
95
95
  )$
96
96
  - id: trailing-whitespace
97
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
+
98
105
  - repo: https://github.com/ComPWA/prettier-pre-commit
99
106
  rev: v3.8.1
100
107
  hooks:
101
108
  - id: prettier
102
109
 
103
- - repo: https://github.com/ComPWA/taplo-pre-commit
104
- rev: v0.9.3
105
- hooks:
106
- - id: taplo-format
107
-
108
- - repo: https://github.com/pappasam/toml-sort
109
- rev: v0.24.3
110
- hooks:
111
- - id: toml-sort
112
- args:
113
- - --in-place
114
-
115
110
  - repo: https://github.com/python-jsonschema/check-jsonschema
116
- rev: 0.36.2
111
+ rev: 0.37.4
117
112
  hooks:
118
113
  - id: check-jsonschema
119
114
  name: Check CITATION.cff
@@ -126,12 +121,12 @@ repos:
126
121
  pass_filenames: false
127
122
 
128
123
  - repo: https://github.com/streetsidesoftware/cspell-cli
129
- rev: v9.6.0
124
+ rev: v10.0.1
130
125
  hooks:
131
126
  - id: cspell
132
127
 
133
128
  - repo: https://github.com/editorconfig-checker/editorconfig-checker.python
134
- rev: 3.6.0
129
+ rev: 3.8.0
135
130
  hooks:
136
131
  - id: editorconfig-checker
137
132
  name: editorconfig
@@ -141,18 +136,13 @@ repos:
141
136
  .*\.py
142
137
  )$
143
138
 
144
- - repo: local
139
+ - repo: https://github.com/astral-sh/ty-pre-commit
140
+ rev: v0.0.67
145
141
  hooks:
146
142
  - id: ty
147
- name: ty
148
- entry: ty check
149
- args: [--no-progress, --output-format=concise]
150
- pass_filenames: false
151
- require_serial: true
152
- language: system
153
- types_or: [python, pyi, jupyter]
143
+ args: [--group=types, --no-default-groups]
154
144
 
155
145
  - repo: https://github.com/astral-sh/uv-pre-commit
156
- rev: 0.10.3
146
+ rev: 0.12.1
157
147
  hooks:
158
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