vector 1.6.0__tar.gz → 1.6.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.
Files changed (297) hide show
  1. {vector-1.6.0 → vector-1.6.2}/.github/workflows/cd.yml +1 -1
  2. {vector-1.6.0 → vector-1.6.2}/.github/workflows/ci.yml +1 -1
  3. {vector-1.6.0 → vector-1.6.2}/.pre-commit-config.yaml +5 -4
  4. {vector-1.6.0 → vector-1.6.2}/CITATION.cff +1 -1
  5. {vector-1.6.0 → vector-1.6.2}/PKG-INFO +1 -1
  6. {vector-1.6.0 → vector-1.6.2}/docs/index.md +16 -0
  7. vector-1.6.2/docs/src/numba.ipynb +336 -0
  8. {vector-1.6.0 → vector-1.6.2}/pyproject.toml +1 -1
  9. {vector-1.6.0 → vector-1.6.2}/src/vector/_methods.py +1 -1
  10. {vector-1.6.0 → vector-1.6.2}/src/vector/_version.py +9 -4
  11. {vector-1.6.0 → vector-1.6.2}/src/vector/backends/awkward.py +29 -1
  12. vector-1.6.2/tests/backends/test_awkward.py +1172 -0
  13. vector-1.6.0/docs/src/numba.ipynb +0 -221
  14. vector-1.6.0/tests/backends/test_awkward.py +0 -930
  15. {vector-1.6.0 → vector-1.6.2}/.all-contributorsrc +0 -0
  16. {vector-1.6.0 → vector-1.6.2}/.git_archival.txt +0 -0
  17. {vector-1.6.0 → vector-1.6.2}/.gitattributes +0 -0
  18. {vector-1.6.0 → vector-1.6.2}/.github/CONTRIBUTING.md +0 -0
  19. {vector-1.6.0 → vector-1.6.2}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  20. {vector-1.6.0 → vector-1.6.2}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  21. {vector-1.6.0 → vector-1.6.2}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  22. {vector-1.6.0 → vector-1.6.2}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  23. {vector-1.6.0 → vector-1.6.2}/.github/codecov.yml +0 -0
  24. {vector-1.6.0 → vector-1.6.2}/.github/dependabot.yml +0 -0
  25. {vector-1.6.0 → vector-1.6.2}/.github/matchers/pylint.json +0 -0
  26. {vector-1.6.0 → vector-1.6.2}/.github/workflows/notebooks.yml +0 -0
  27. {vector-1.6.0 → vector-1.6.2}/.gitignore +0 -0
  28. {vector-1.6.0 → vector-1.6.2}/.readthedocs.yml +0 -0
  29. {vector-1.6.0 → vector-1.6.2}/LICENSE +0 -0
  30. {vector-1.6.0 → vector-1.6.2}/README.md +0 -0
  31. {vector-1.6.0 → vector-1.6.2}/docs/Makefile +0 -0
  32. {vector-1.6.0 → vector-1.6.2}/docs/_images/LogoSrc.svg +0 -0
  33. {vector-1.6.0 → vector-1.6.2}/docs/_images/coordinate-systems.png +0 -0
  34. {vector-1.6.0 → vector-1.6.2}/docs/_images/coordinate-systems.svg +0 -0
  35. {vector-1.6.0 → vector-1.6.2}/docs/_images/vector-logo.png +0 -0
  36. {vector-1.6.0 → vector-1.6.2}/docs/conf.py +0 -0
  37. {vector-1.6.0 → vector-1.6.2}/docs/make.bat +0 -0
  38. {vector-1.6.0 → vector-1.6.2}/docs/src/awkward.ipynb +0 -0
  39. {vector-1.6.0 → vector-1.6.2}/docs/src/common.md +0 -0
  40. {vector-1.6.0 → vector-1.6.2}/docs/src/make_awkward.md +0 -0
  41. {vector-1.6.0 → vector-1.6.2}/docs/src/make_numpy.md +0 -0
  42. {vector-1.6.0 → vector-1.6.2}/docs/src/make_object.md +0 -0
  43. {vector-1.6.0 → vector-1.6.2}/docs/src/make_sympy.md +0 -0
  44. {vector-1.6.0 → vector-1.6.2}/docs/src/momentum2d.md +0 -0
  45. {vector-1.6.0 → vector-1.6.2}/docs/src/momentum3d.md +0 -0
  46. {vector-1.6.0 → vector-1.6.2}/docs/src/momentum4d.md +0 -0
  47. {vector-1.6.0 → vector-1.6.2}/docs/src/numpy.ipynb +0 -0
  48. {vector-1.6.0 → vector-1.6.2}/docs/src/object.ipynb +0 -0
  49. {vector-1.6.0 → vector-1.6.2}/docs/src/sympy.ipynb +0 -0
  50. {vector-1.6.0 → vector-1.6.2}/docs/src/talks.md +0 -0
  51. {vector-1.6.0 → vector-1.6.2}/docs/src/vector2d.md +0 -0
  52. {vector-1.6.0 → vector-1.6.2}/docs/src/vector3d.md +0 -0
  53. {vector-1.6.0 → vector-1.6.2}/docs/src/vector4d.md +0 -0
  54. {vector-1.6.0 → vector-1.6.2}/environment.yml +0 -0
  55. {vector-1.6.0 → vector-1.6.2}/noxfile.py +0 -0
  56. {vector-1.6.0 → vector-1.6.2}/src/vector/__init__.py +0 -0
  57. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/__init__.py +0 -0
  58. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/Et.py +0 -0
  59. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/Et2.py +0 -0
  60. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/Mt.py +0 -0
  61. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/Mt2.py +0 -0
  62. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/__init__.py +0 -0
  63. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/add.py +0 -0
  64. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/beta.py +0 -0
  65. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/boostX_beta.py +0 -0
  66. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/boostX_gamma.py +0 -0
  67. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/boostY_beta.py +0 -0
  68. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/boostY_gamma.py +0 -0
  69. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/boostZ_beta.py +0 -0
  70. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/boostZ_gamma.py +0 -0
  71. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/boost_beta3.py +0 -0
  72. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/boost_p4.py +0 -0
  73. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/deltaRapidityPhi.py +0 -0
  74. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/deltaRapidityPhi2.py +0 -0
  75. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/dot.py +0 -0
  76. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/equal.py +0 -0
  77. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/gamma.py +0 -0
  78. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/is_lightlike.py +0 -0
  79. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/is_spacelike.py +0 -0
  80. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/is_timelike.py +0 -0
  81. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/isclose.py +0 -0
  82. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/not_equal.py +0 -0
  83. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/rapidity.py +0 -0
  84. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/scale.py +0 -0
  85. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/subtract.py +0 -0
  86. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/t.py +0 -0
  87. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/t2.py +0 -0
  88. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/tau.py +0 -0
  89. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/tau2.py +0 -0
  90. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/to_beta3.py +0 -0
  91. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/transform4D.py +0 -0
  92. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/lorentz/unit.py +0 -0
  93. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/__init__.py +0 -0
  94. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/add.py +0 -0
  95. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/deltaphi.py +0 -0
  96. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/dot.py +0 -0
  97. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/equal.py +0 -0
  98. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/is_antiparallel.py +0 -0
  99. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/is_parallel.py +0 -0
  100. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/is_perpendicular.py +0 -0
  101. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/isclose.py +0 -0
  102. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/not_equal.py +0 -0
  103. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/phi.py +0 -0
  104. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/rho.py +0 -0
  105. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/rho2.py +0 -0
  106. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/rotateZ.py +0 -0
  107. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/scale.py +0 -0
  108. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/subtract.py +0 -0
  109. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/transform2D.py +0 -0
  110. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/unit.py +0 -0
  111. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/x.py +0 -0
  112. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/planar/y.py +0 -0
  113. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/__init__.py +0 -0
  114. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/add.py +0 -0
  115. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/costheta.py +0 -0
  116. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/cottheta.py +0 -0
  117. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/cross.py +0 -0
  118. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/deltaR.py +0 -0
  119. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/deltaR2.py +0 -0
  120. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/deltaangle.py +0 -0
  121. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/deltaeta.py +0 -0
  122. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/dot.py +0 -0
  123. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/equal.py +0 -0
  124. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/eta.py +0 -0
  125. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/is_antiparallel.py +0 -0
  126. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/is_parallel.py +0 -0
  127. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/is_perpendicular.py +0 -0
  128. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/isclose.py +0 -0
  129. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/mag.py +0 -0
  130. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/mag2.py +0 -0
  131. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/not_equal.py +0 -0
  132. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/rotateX.py +0 -0
  133. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/rotateY.py +0 -0
  134. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/rotate_axis.py +0 -0
  135. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/rotate_euler.py +0 -0
  136. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/rotate_quaternion.py +0 -0
  137. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/scale.py +0 -0
  138. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/subtract.py +0 -0
  139. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/theta.py +0 -0
  140. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/transform3D.py +0 -0
  141. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/unit.py +0 -0
  142. {vector-1.6.0 → vector-1.6.2}/src/vector/_compute/spatial/z.py +0 -0
  143. {vector-1.6.0 → vector-1.6.2}/src/vector/_lib.py +0 -0
  144. {vector-1.6.0 → vector-1.6.2}/src/vector/_typeutils.py +0 -0
  145. {vector-1.6.0 → vector-1.6.2}/src/vector/_version.pyi +0 -0
  146. {vector-1.6.0 → vector-1.6.2}/src/vector/backends/__init__.py +0 -0
  147. {vector-1.6.0 → vector-1.6.2}/src/vector/backends/_numba.py +0 -0
  148. {vector-1.6.0 → vector-1.6.2}/src/vector/backends/_numba_object.py +0 -0
  149. {vector-1.6.0 → vector-1.6.2}/src/vector/backends/awkward_constructors.py +0 -0
  150. {vector-1.6.0 → vector-1.6.2}/src/vector/backends/numba_numpy.py +0 -0
  151. {vector-1.6.0 → vector-1.6.2}/src/vector/backends/numpy.py +0 -0
  152. {vector-1.6.0 → vector-1.6.2}/src/vector/backends/object.py +0 -0
  153. {vector-1.6.0 → vector-1.6.2}/src/vector/backends/sympy.py +0 -0
  154. {vector-1.6.0 → vector-1.6.2}/src/vector/py.typed +0 -0
  155. {vector-1.6.0 → vector-1.6.2}/tests/__init__.py +0 -0
  156. {vector-1.6.0 → vector-1.6.2}/tests/backends/__init__.py +0 -0
  157. {vector-1.6.0 → vector-1.6.2}/tests/backends/test_awkward_numba.py +0 -0
  158. {vector-1.6.0 → vector-1.6.2}/tests/backends/test_dask_awkward.py +0 -0
  159. {vector-1.6.0 → vector-1.6.2}/tests/backends/test_numba_numpy.py +0 -0
  160. {vector-1.6.0 → vector-1.6.2}/tests/backends/test_numba_object.py +0 -0
  161. {vector-1.6.0 → vector-1.6.2}/tests/backends/test_numpy.py +0 -0
  162. {vector-1.6.0 → vector-1.6.2}/tests/backends/test_object.py +0 -0
  163. {vector-1.6.0 → vector-1.6.2}/tests/backends/test_operators.py +0 -0
  164. {vector-1.6.0 → vector-1.6.2}/tests/backends/test_sympy.py +0 -0
  165. {vector-1.6.0 → vector-1.6.2}/tests/compute/__init__.py +0 -0
  166. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/__init__.py +0 -0
  167. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_Et.py +0 -0
  168. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_Et2.py +0 -0
  169. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_Mt.py +0 -0
  170. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_Mt2.py +0 -0
  171. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_beta.py +0 -0
  172. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_boostX_beta.py +0 -0
  173. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_boostX_gamma.py +0 -0
  174. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_boostY_beta.py +0 -0
  175. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_boostY_gamma.py +0 -0
  176. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_boostZ_beta.py +0 -0
  177. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_boostZ_gamma.py +0 -0
  178. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_boost_beta3.py +0 -0
  179. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_boost_p4.py +0 -0
  180. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_deltaRapidityPhi.py +0 -0
  181. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_deltaRapidityPhi2.py +0 -0
  182. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_gamma.py +0 -0
  183. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_is_lightlike.py +0 -0
  184. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_is_spacelike.py +0 -0
  185. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_is_timelike.py +0 -0
  186. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_rapidity.py +0 -0
  187. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_t.py +0 -0
  188. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_t2.py +0 -0
  189. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_tau.py +0 -0
  190. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_tau2.py +0 -0
  191. {vector-1.6.0 → vector-1.6.2}/tests/compute/lorentz/test_to_beta3.py +0 -0
  192. {vector-1.6.0 → vector-1.6.2}/tests/compute/planar/__init__.py +0 -0
  193. {vector-1.6.0 → vector-1.6.2}/tests/compute/planar/test_deltaphi.py +0 -0
  194. {vector-1.6.0 → vector-1.6.2}/tests/compute/planar/test_phi.py +0 -0
  195. {vector-1.6.0 → vector-1.6.2}/tests/compute/planar/test_rho.py +0 -0
  196. {vector-1.6.0 → vector-1.6.2}/tests/compute/planar/test_rho2.py +0 -0
  197. {vector-1.6.0 → vector-1.6.2}/tests/compute/planar/test_rotateZ.py +0 -0
  198. {vector-1.6.0 → vector-1.6.2}/tests/compute/planar/test_x.py +0 -0
  199. {vector-1.6.0 → vector-1.6.2}/tests/compute/planar/test_y.py +0 -0
  200. {vector-1.6.0 → vector-1.6.2}/tests/compute/spatial/__init__.py +0 -0
  201. {vector-1.6.0 → vector-1.6.2}/tests/compute/spatial/test_costheta.py +0 -0
  202. {vector-1.6.0 → vector-1.6.2}/tests/compute/spatial/test_cottheta.py +0 -0
  203. {vector-1.6.0 → vector-1.6.2}/tests/compute/spatial/test_cross.py +0 -0
  204. {vector-1.6.0 → vector-1.6.2}/tests/compute/spatial/test_deltaR.py +0 -0
  205. {vector-1.6.0 → vector-1.6.2}/tests/compute/spatial/test_deltaR2.py +0 -0
  206. {vector-1.6.0 → vector-1.6.2}/tests/compute/spatial/test_deltaangle.py +0 -0
  207. {vector-1.6.0 → vector-1.6.2}/tests/compute/spatial/test_deltaeta.py +0 -0
  208. {vector-1.6.0 → vector-1.6.2}/tests/compute/spatial/test_eta.py +0 -0
  209. {vector-1.6.0 → vector-1.6.2}/tests/compute/spatial/test_mag.py +0 -0
  210. {vector-1.6.0 → vector-1.6.2}/tests/compute/spatial/test_mag2.py +0 -0
  211. {vector-1.6.0 → vector-1.6.2}/tests/compute/spatial/test_rotateX.py +0 -0
  212. {vector-1.6.0 → vector-1.6.2}/tests/compute/spatial/test_rotateY.py +0 -0
  213. {vector-1.6.0 → vector-1.6.2}/tests/compute/spatial/test_rotate_axis.py +0 -0
  214. {vector-1.6.0 → vector-1.6.2}/tests/compute/spatial/test_rotate_euler.py +0 -0
  215. {vector-1.6.0 → vector-1.6.2}/tests/compute/spatial/test_rotate_quaternion.py +0 -0
  216. {vector-1.6.0 → vector-1.6.2}/tests/compute/spatial/test_theta.py +0 -0
  217. {vector-1.6.0 → vector-1.6.2}/tests/compute/spatial/test_z.py +0 -0
  218. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/__init__.py +0 -0
  219. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_Et.py +0 -0
  220. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_Et2.py +0 -0
  221. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_Mt.py +0 -0
  222. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_Mt2.py +0 -0
  223. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_beta.py +0 -0
  224. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_boostX_beta.py +0 -0
  225. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_boostX_gamma.py +0 -0
  226. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_boostY_beta.py +0 -0
  227. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_boostY_gamma.py +0 -0
  228. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_boostZ_beta.py +0 -0
  229. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_boostZ_gamma.py +0 -0
  230. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_boost_beta3.py +0 -0
  231. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_boost_p4.py +0 -0
  232. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_deltaRapidityPhi.py +0 -0
  233. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_deltaRapidityPhi2.py +0 -0
  234. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_gamma.py +0 -0
  235. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_is_lightlike.py +0 -0
  236. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_is_spacelike.py +0 -0
  237. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_is_timelike.py +0 -0
  238. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_rapidity.py +0 -0
  239. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_t.py +0 -0
  240. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_t2.py +0 -0
  241. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_tau.py +0 -0
  242. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_tau2.py +0 -0
  243. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/lorentz/test_to_beta3.py +0 -0
  244. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/planar/__init__.py +0 -0
  245. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/planar/test_deltaphi.py +0 -0
  246. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/planar/test_phi.py +0 -0
  247. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/planar/test_rho.py +0 -0
  248. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/planar/test_rho2.py +0 -0
  249. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/planar/test_rotateZ.py +0 -0
  250. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/planar/test_x.py +0 -0
  251. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/planar/test_y.py +0 -0
  252. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/spatial/__init__.py +0 -0
  253. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/spatial/test_costheta.py +0 -0
  254. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/spatial/test_cottheta.py +0 -0
  255. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/spatial/test_cross.py +0 -0
  256. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/spatial/test_deltaR.py +0 -0
  257. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/spatial/test_deltaR2.py +0 -0
  258. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/spatial/test_deltaangle.py +0 -0
  259. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/spatial/test_deltaeta.py +0 -0
  260. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/spatial/test_eta.py +0 -0
  261. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/spatial/test_mag.py +0 -0
  262. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/spatial/test_mag2.py +0 -0
  263. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/spatial/test_rotateX.py +0 -0
  264. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/spatial/test_rotateY.py +0 -0
  265. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/spatial/test_rotate_axis.py +0 -0
  266. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/spatial/test_rotate_euler.py +0 -0
  267. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/spatial/test_rotate_quaternion.py +0 -0
  268. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/spatial/test_theta.py +0 -0
  269. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/spatial/test_z.py +0 -0
  270. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/test_add.py +0 -0
  271. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/test_conversions.py +0 -0
  272. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/test_dot.py +0 -0
  273. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/test_equal.py +0 -0
  274. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/test_is_antiparallel.py +0 -0
  275. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/test_is_parallel.py +0 -0
  276. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/test_is_perpendicular.py +0 -0
  277. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/test_not_equal.py +0 -0
  278. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/test_scale.py +0 -0
  279. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/test_subtract.py +0 -0
  280. {vector-1.6.0 → vector-1.6.2}/tests/compute/sympy/test_unit.py +0 -0
  281. {vector-1.6.0 → vector-1.6.2}/tests/compute/test_add.py +0 -0
  282. {vector-1.6.0 → vector-1.6.2}/tests/compute/test_conversions.py +0 -0
  283. {vector-1.6.0 → vector-1.6.2}/tests/compute/test_dot.py +0 -0
  284. {vector-1.6.0 → vector-1.6.2}/tests/compute/test_equal.py +0 -0
  285. {vector-1.6.0 → vector-1.6.2}/tests/compute/test_is_antiparallel.py +0 -0
  286. {vector-1.6.0 → vector-1.6.2}/tests/compute/test_is_parallel.py +0 -0
  287. {vector-1.6.0 → vector-1.6.2}/tests/compute/test_is_perpendicular.py +0 -0
  288. {vector-1.6.0 → vector-1.6.2}/tests/compute/test_isclose.py +0 -0
  289. {vector-1.6.0 → vector-1.6.2}/tests/compute/test_not_equal.py +0 -0
  290. {vector-1.6.0 → vector-1.6.2}/tests/compute/test_scale.py +0 -0
  291. {vector-1.6.0 → vector-1.6.2}/tests/compute/test_subtract.py +0 -0
  292. {vector-1.6.0 → vector-1.6.2}/tests/compute/test_unit.py +0 -0
  293. {vector-1.6.0 → vector-1.6.2}/tests/samples/issue-161-v2.pkl +0 -0
  294. {vector-1.6.0 → vector-1.6.2}/tests/test_compute_features.py +0 -0
  295. {vector-1.6.0 → vector-1.6.2}/tests/test_issues.py +0 -0
  296. {vector-1.6.0 → vector-1.6.2}/tests/test_methods.py +0 -0
  297. {vector-1.6.0 → vector-1.6.2}/tests/test_notebooks.py +0 -0
@@ -37,7 +37,7 @@ jobs:
37
37
  run: ls -l dist/
38
38
 
39
39
  - name: Generate artifact attestation for sdist and wheel
40
- uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0
40
+ uses: actions/attest-build-provenance@c074443f1aee8d4aeeae555aebba3282517141b2 # v2.2.3
41
41
  with:
42
42
  subject-path: "dist/vector-*"
43
43
 
@@ -93,7 +93,7 @@ jobs:
93
93
  run: nox -s coverage-${{ matrix.python-version }} --verbose
94
94
 
95
95
  - name: Upload coverage report
96
- uses: codecov/codecov-action@v5.1.2
96
+ uses: codecov/codecov-action@v5.4.2
97
97
  with:
98
98
  token: ${{ secrets.CODECOV_TOKEN }}
99
99
 
@@ -19,14 +19,14 @@ repos:
19
19
  - id: trailing-whitespace
20
20
 
21
21
  - repo: https://github.com/astral-sh/ruff-pre-commit
22
- rev: "v0.9.1"
22
+ rev: "v0.11.6"
23
23
  hooks:
24
24
  - id: ruff
25
25
  args: ["--fix", "--show-fixes"]
26
26
  - id: ruff-format
27
27
 
28
28
  - repo: https://github.com/pre-commit/mirrors-mypy
29
- rev: v1.14.1
29
+ rev: v1.15.0
30
30
  hooks:
31
31
  - id: mypy
32
32
  files: src
@@ -37,13 +37,14 @@ repos:
37
37
  - sympy
38
38
 
39
39
  - repo: https://github.com/codespell-project/codespell
40
- rev: v2.3.0
40
+ rev: v2.4.1
41
41
  hooks:
42
42
  - id: codespell
43
+ args: ["-LHEP"]
43
44
  exclude: ^docs/usage/intro.ipynb$
44
45
 
45
46
  - repo: https://github.com/rbubley/mirrors-prettier
46
- rev: "v3.4.2"
47
+ rev: "v3.5.3"
47
48
  hooks:
48
49
  - id: prettier
49
50
  types_or: [yaml, markdown, html, css, scss, javascript, json]
@@ -15,7 +15,7 @@ authors:
15
15
  - family-names: "Chopra"
16
16
  given-names: "Saransh"
17
17
  orcid: "https://orcid.org/0000-0003-3046-7675"
18
- affiliation: "University of Delhi"
18
+ affiliation: "University College London"
19
19
  doi: 10.5281/zenodo.5942082
20
20
  repository-code: "https://github.com/scikit-hep/vector"
21
21
  url: "https://vector.readthedocs.io/"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vector
3
- Version: 1.6.0
3
+ Version: 1.6.2
4
4
  Summary: Vector classes and utilities
5
5
  Project-URL: Bug Tracker, https://github.com/scikit-hep/vector/issues
6
6
  Project-URL: Changelog, https://vector.readthedocs.io/en/latest/changelog.html
@@ -65,6 +65,22 @@ Finally, vectors come in two flavors:
65
65
 
66
66
  Names and coordinate conventions were chosen to align with [ROOT](https://root.cern/)'s [TLorentzVector](https://root.cern.ch/doc/master/classTLorentzVector.html) and [Math::LorentzVector](https://root.cern.ch/doc/master/classROOT_1_1Math_1_1LorentzVector.html), as well as [scikit-hep/math](https://github.com/scikit-hep/scikit-hep/tree/master/skhep/math), [uproot-methods TLorentzVector](https://github.com/scikit-hep/uproot3-methods/blob/master/uproot3_methods/classes/TLorentzVector.py), [henryiii/hepvector](https://github.com/henryiii/hepvector), and [coffea.nanoevents.methods.vector](https://coffea-hep.readthedocs.io/en/latest/modules/coffea.nanoevents.methods.vector.html).
67
67
 
68
+ Vector follows the $(-, -, -, +)$ (`x, y, z, t`) metric convention for Lorentz vectors. The $(-,-,-,+)$ metric convention for Lorentz vectors corresponds to the Minkowski metric:
69
+
70
+ ```{math}
71
+ g_{\mu\nu} = \text{diag}(-1, -1, -1, +1)
72
+ ```
73
+
74
+ For a Lorentz vector $p^\mu = (p_x, p_y, p_z, E)$, the squared norm (or invariant mass squared) is given by:
75
+
76
+ ```{math}
77
+ p^\mu p_\mu = g_{\mu\nu} p^\mu p^\nu = E^2 - p_x^2 - p_y^2 - p_z^2
78
+ ```
79
+
80
+ This convention is widely used in high-energy physics (HEP), including frameworks such as ROOT.
81
+
82
+ Further, the transformations and rotations (including boosts) are active, and the Euler angle conventions align with the formalisations in the [GenVector package](https://root.cern/topical/GenVector.pdf). More precisely, the implementation of `rotate_euler` uses the matrices defined in the [wikipedia article](https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix).
83
+
68
84
  ## Getting help
69
85
 
70
86
  - Source code on GitHub: [scikit-hep/vector](https://github.com/scikit-hep/vector)
@@ -0,0 +1,336 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "1af51709-6860-4e5c-96c9-6a437eaed606",
6
+ "metadata": {},
7
+ "source": [
8
+ "# Compiling functions on vectors with Numba"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "id": "03064225-ea6b-4f6b-a5bf-08a47b62350e",
14
+ "metadata": {},
15
+ "source": [
16
+ "First, [install](../index.md#installation) and import Vector and [Numba](https://numba.pydata.org/)."
17
+ ]
18
+ },
19
+ {
20
+ "cell_type": "code",
21
+ "execution_count": 1,
22
+ "id": "df8bea35-cf3c-4f87-8e3d-8ffe06264811",
23
+ "metadata": {},
24
+ "outputs": [],
25
+ "source": [
26
+ "import vector\n",
27
+ "import numba as nb\n",
28
+ "import numpy as np"
29
+ ]
30
+ },
31
+ {
32
+ "cell_type": "markdown",
33
+ "id": "7fff9620-227b-4e5e-a211-4daf1fb96298",
34
+ "metadata": {},
35
+ "source": [
36
+ "Numba is a just-in-time (JIT) compiler for a mathematically relevant subset of NumPy and Python. It allows you to write fast code without leaving the Python environment. The drawback of Numba is that it can only compile code blocks involving objects and functions that it recognizes.\n",
37
+ "\n",
38
+ "The Vector library includes extensions to inform Numba about [vector objects](object.md), [arrays of vectors](numpy.md), and [arrays of Awkward Arrays](awkward.md). At the time of writing, the implementation of vector NumPy arrays is incomplete (see issue [#43](https://github.com/scikit-hep/vector/issues/43)).\n",
39
+ "\n",
40
+ "Consider the following function:"
41
+ ]
42
+ },
43
+ {
44
+ "cell_type": "code",
45
+ "execution_count": 2,
46
+ "id": "0e7f7c5c-2ce3-4f55-9159-363910fac6b9",
47
+ "metadata": {},
48
+ "outputs": [],
49
+ "source": [
50
+ "def compute_mass(v1, v2):\n",
51
+ " return (v1 + v2).mass"
52
+ ]
53
+ },
54
+ {
55
+ "cell_type": "code",
56
+ "execution_count": 3,
57
+ "id": "16d0fe04-fc8d-4d1f-bb68-0f869c1d2bdb",
58
+ "metadata": {},
59
+ "outputs": [
60
+ {
61
+ "name": "stdout",
62
+ "output_type": "stream",
63
+ "text": [
64
+ "18.3 μs ± 144 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)\n"
65
+ ]
66
+ }
67
+ ],
68
+ "source": [
69
+ "%timeit compute_mass(vector.obj(px=1, py=2, pz=3, E=4), vector.obj(px=-1, py=-2, pz=-3, E=4))"
70
+ ]
71
+ },
72
+ {
73
+ "cell_type": "code",
74
+ "execution_count": 4,
75
+ "id": "22516614-48eb-47de-96a9-12781fdeb66f",
76
+ "metadata": {},
77
+ "outputs": [],
78
+ "source": [
79
+ "@nb.njit\n",
80
+ "def compute_mass(v1, v2):\n",
81
+ " return (v1 + v2).mass"
82
+ ]
83
+ },
84
+ {
85
+ "cell_type": "code",
86
+ "execution_count": 5,
87
+ "id": "293e83fa-d059-4f14-a70f-3c4d91de8f9b",
88
+ "metadata": {},
89
+ "outputs": [
90
+ {
91
+ "name": "stdout",
92
+ "output_type": "stream",
93
+ "text": [
94
+ "The slowest run took 27658.64 times longer than the fastest. This could mean that an intermediate result is being cached.\n",
95
+ "93 ms ± 227 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
96
+ ]
97
+ }
98
+ ],
99
+ "source": [
100
+ "%timeit -n 1 compute_mass(vector.obj(px=1, py=2, pz=3, E=4), vector.obj(px=-1, py=-2, pz=-3, E=4))"
101
+ ]
102
+ },
103
+ {
104
+ "cell_type": "markdown",
105
+ "id": "69c36f6d-3b54-4db8-9890-9245d64fefe7",
106
+ "metadata": {},
107
+ "source": [
108
+ "When the two `MomentumObject4D` objects are passed as arguments, Numba recognizes them and replaces the Python objects with low-level structs. When it compiles the function, it recognizes `+` as the 4D `add` function and recognizes `.mass` as the `tau` component of the result.\n",
109
+ "\n",
110
+ "Although this demonstrates that Numba can manipulate vector objects, there is no performance advantage (and a likely disadvantage) to compiling a calculation on just a few vectors. The `@nb.njit` result showcases this behavior, where the run (the actual just-in-time compilation + the run) takes much longer to run that the non-JIT version.\n",
111
+ "\n",
112
+ "Once the function has been JIT-compiled, the subsequent runs are comparable to the non-JIT version, but is no performance advantage on just a few vectors."
113
+ ]
114
+ },
115
+ {
116
+ "cell_type": "code",
117
+ "execution_count": 6,
118
+ "id": "d0fb0559-b944-43d1-b44e-1b959c1bbbd4",
119
+ "metadata": {},
120
+ "outputs": [
121
+ {
122
+ "name": "stdout",
123
+ "output_type": "stream",
124
+ "text": [
125
+ "24.1 μs ± 116 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n"
126
+ ]
127
+ }
128
+ ],
129
+ "source": [
130
+ "%timeit compute_mass(vector.obj(px=1, py=2, pz=3, E=4), vector.obj(px=-1, py=-2, pz=-3, E=4))"
131
+ ]
132
+ },
133
+ {
134
+ "cell_type": "markdown",
135
+ "id": "0bb7c5d1-2310-4a9a-8fdb-176179e3f84f",
136
+ "metadata": {},
137
+ "source": [
138
+ "However, the real advantage comes when many vectors are involved, in arrays."
139
+ ]
140
+ },
141
+ {
142
+ "cell_type": "code",
143
+ "execution_count": 7,
144
+ "id": "63f614a2-969d-465d-8d74-a44f6f77eab4",
145
+ "metadata": {},
146
+ "outputs": [
147
+ {
148
+ "data": {
149
+ "text/html": [
150
+ "<pre>[[{x: -1.47, y: -0.254, z: 1.44, t: 11}, ..., {x: -0.96, y: -0.5, z: ..., ...}],\n",
151
+ " [{x: 0.46, y: -1.97, z: -0.815, t: 9.54}, ..., {x: 0.399, y: 1.36, ...}],\n",
152
+ " [],\n",
153
+ " [{x: -0.484, y: 1.29, z: -0.875, t: 9.92}, {x: 1.05, y: -1.39, ...}],\n",
154
+ " [{x: -0.441, y: -0.38, z: -1.99, t: 10.2}],\n",
155
+ " [{x: -0.974, y: -0.324, z: 0.0935, t: 8.76}, {x: 0.989, y: 0.577, ...}],\n",
156
+ " [{x: -2.34, y: 0.919, z: 2.36, t: 10.6}],\n",
157
+ " [{x: 0.109, y: 0.589, z: -0.555, t: 11.3}, ..., {x: 0.681, y: -0.827, ...}],\n",
158
+ " [{x: 0.716, y: 0.122, z: 0.21, t: 10}, ..., {x: -1.41, y: -1.53, z: ..., ...}],\n",
159
+ " [],\n",
160
+ " ...,\n",
161
+ " [{x: 1.51, y: -1.67, z: 0.00979, t: 10.5}, ..., {x: -0.347, y: -0.968, ...}],\n",
162
+ " [{x: 0.765, y: -0.107, z: 0.0998, t: 10.2}],\n",
163
+ " [{x: 1.96, y: -0.0284, z: -0.204, t: 8.2}, {x: 0.411, y: -1.67, ...}],\n",
164
+ " [{x: 0.398, y: 0.242, z: -0.609, t: 8.86}],\n",
165
+ " [{x: -0.429, y: 1.23, z: 1.44, t: 10.1}],\n",
166
+ " [{x: -0.52, y: -0.614, z: 0.586, t: 10.6}, ..., {x: -0.732, y: 0.394, ...}],\n",
167
+ " [{x: -0.21, y: -0.225, z: 0.503, t: 11.6}],\n",
168
+ " [],\n",
169
+ " [{x: -1.63, y: 0.324, z: 0.701, t: 9.05}, {x: -0.000179, y: -0.59, ...}]]\n",
170
+ "---------------------------------------------------------------------------------------------\n",
171
+ "backend: cpu\n",
172
+ "nbytes: 3.0 kB\n",
173
+ "type: 50 * var * Momentum4D[\n",
174
+ " x: float64,\n",
175
+ " y: float64,\n",
176
+ " z: float64,\n",
177
+ " t: float64\n",
178
+ "]</pre>"
179
+ ],
180
+ "text/plain": [
181
+ "<MomentumArray4D [[{x: -1.47, y: -0.254, ...}, ...], ...] type='50 * var * ...'>"
182
+ ]
183
+ },
184
+ "execution_count": 7,
185
+ "metadata": {},
186
+ "output_type": "execute_result"
187
+ }
188
+ ],
189
+ "source": [
190
+ "# This is still not a large number. You want millions.\n",
191
+ "array = vector.Array(\n",
192
+ " [\n",
193
+ " [\n",
194
+ " dict(\n",
195
+ " {x: np.random.normal(0, 1) for x in (\"px\", \"py\", \"pz\")},\n",
196
+ " E=np.random.normal(10, 1),\n",
197
+ " )\n",
198
+ " for inner in range(np.random.poisson(1.5))\n",
199
+ " ]\n",
200
+ " for outer in range(50)\n",
201
+ " ]\n",
202
+ ")\n",
203
+ "array"
204
+ ]
205
+ },
206
+ {
207
+ "cell_type": "code",
208
+ "execution_count": 8,
209
+ "id": "f6edd6c9-a423-4662-bcae-c685686633c8",
210
+ "metadata": {},
211
+ "outputs": [],
212
+ "source": [
213
+ "def compute_masses(array):\n",
214
+ " out = np.empty(len(array), np.float64)\n",
215
+ " for i, event in enumerate(array):\n",
216
+ " total = vector.obj(px=0.0, py=0.0, pz=0.0, E=0.0)\n",
217
+ " for vec in event:\n",
218
+ " total = total + vec\n",
219
+ " out[i] = total.mass\n",
220
+ " return out"
221
+ ]
222
+ },
223
+ {
224
+ "cell_type": "code",
225
+ "execution_count": 9,
226
+ "id": "fa854373-aeba-4274-8ab8-c1c85d5a931b",
227
+ "metadata": {
228
+ "scrolled": true
229
+ },
230
+ "outputs": [
231
+ {
232
+ "name": "stdout",
233
+ "output_type": "stream",
234
+ "text": [
235
+ "98.5 ms ± 305 μs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
236
+ ]
237
+ }
238
+ ],
239
+ "source": [
240
+ "%timeit compute_masses(array)"
241
+ ]
242
+ },
243
+ {
244
+ "cell_type": "code",
245
+ "execution_count": 10,
246
+ "id": "a6ca1a20-3f5f-485b-8cc0-663cdbf70ec6",
247
+ "metadata": {},
248
+ "outputs": [],
249
+ "source": [
250
+ "@nb.njit\n",
251
+ "def compute_masses(array):\n",
252
+ " out = np.empty(len(array), np.float64)\n",
253
+ " for i, event in enumerate(array):\n",
254
+ " total = vector.obj(px=0.0, py=0.0, pz=0.0, E=0.0)\n",
255
+ " for vec in event:\n",
256
+ " total = total + vec\n",
257
+ " out[i] = total.mass\n",
258
+ " return out"
259
+ ]
260
+ },
261
+ {
262
+ "cell_type": "code",
263
+ "execution_count": 11,
264
+ "id": "c9bbfba4-1000-4d86-9804-340f8494076d",
265
+ "metadata": {},
266
+ "outputs": [
267
+ {
268
+ "name": "stdout",
269
+ "output_type": "stream",
270
+ "text": [
271
+ "The slowest run took 2514.01 times longer than the fastest. This could mean that an intermediate result is being cached.\n",
272
+ "69.1 ms ± 169 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
273
+ ]
274
+ }
275
+ ],
276
+ "source": [
277
+ "%timeit -n 1 compute_masses(array)"
278
+ ]
279
+ },
280
+ {
281
+ "cell_type": "markdown",
282
+ "id": "48d33ad4-a1ad-47f5-ac19-d8d2359265cb",
283
+ "metadata": {},
284
+ "source": [
285
+ "This time, given that the function operates on a large array, the subsequent runs are much faster (by a considerable factor) than the non-JIT version runs."
286
+ ]
287
+ },
288
+ {
289
+ "cell_type": "code",
290
+ "execution_count": 12,
291
+ "id": "56f6f10d-ee09-47c8-81da-a639a27a9645",
292
+ "metadata": {},
293
+ "outputs": [
294
+ {
295
+ "name": "stdout",
296
+ "output_type": "stream",
297
+ "text": [
298
+ "194 μs ± 2.57 μs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n"
299
+ ]
300
+ }
301
+ ],
302
+ "source": [
303
+ "%timeit compute_masses(array)"
304
+ ]
305
+ },
306
+ {
307
+ "cell_type": "code",
308
+ "execution_count": null,
309
+ "id": "950f1c48-956b-436b-8b8e-9a2b65fe45d8",
310
+ "metadata": {},
311
+ "outputs": [],
312
+ "source": []
313
+ }
314
+ ],
315
+ "metadata": {
316
+ "kernelspec": {
317
+ "display_name": "Python 3 (ipykernel)",
318
+ "language": "python",
319
+ "name": "python3"
320
+ },
321
+ "language_info": {
322
+ "codemirror_mode": {
323
+ "name": "ipython",
324
+ "version": 3
325
+ },
326
+ "file_extension": ".py",
327
+ "mimetype": "text/x-python",
328
+ "name": "python",
329
+ "nbconvert_exporter": "python",
330
+ "pygments_lexer": "ipython3",
331
+ "version": "3.11.11"
332
+ }
333
+ },
334
+ "nbformat": 4,
335
+ "nbformat_minor": 5
336
+ }
@@ -137,7 +137,7 @@ isort.required-imports = [
137
137
  "T20",
138
138
  ]
139
139
  "docs/src/*.ipynb" = [
140
- "T20", "I001", "I002"
140
+ "T20", "I001", "I002", "F811"
141
141
  ]
142
142
  "src/vector/backends/_numba_object.py" = [
143
143
  "PGH003",
@@ -4400,7 +4400,7 @@ def _lib_of(*objects: VectorProtocol) -> Module: # NumPy-like module
4400
4400
  if isinstance(obj, Vector):
4401
4401
  if lib is None:
4402
4402
  lib = obj.lib
4403
- elif lib is not obj.lib:
4403
+ elif lib != obj.lib:
4404
4404
  raise TypeError(
4405
4405
  f"cannot use {lib} and {obj.lib} in the same calculation"
4406
4406
  )
@@ -1,8 +1,13 @@
1
- # file generated by setuptools_scm
1
+ # file generated by setuptools-scm
2
2
  # don't change, don't track in version control
3
+
4
+ __all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
5
+
3
6
  TYPE_CHECKING = False
4
7
  if TYPE_CHECKING:
5
- from typing import Tuple, Union
8
+ from typing import Tuple
9
+ from typing import Union
10
+
6
11
  VERSION_TUPLE = Tuple[Union[int, str], ...]
7
12
  else:
8
13
  VERSION_TUPLE = object
@@ -12,5 +17,5 @@ __version__: str
12
17
  __version_tuple__: VERSION_TUPLE
13
18
  version_tuple: VERSION_TUPLE
14
19
 
15
- __version__ = version = '1.6.0'
16
- __version_tuple__ = version_tuple = (1, 6, 0)
20
+ __version__ = version = '1.6.2'
21
+ __version_tuple__ = version_tuple = (1, 6, 2)
@@ -622,10 +622,38 @@ class AwkwardProtocol(Protocol):
622
622
  def __getitem__(self, where: typing.Any) -> float | ak.Array | ak.Record | None: ...
623
623
 
624
624
 
625
+ class _lib(typing.NamedTuple):
626
+ """a wrapper that respects the numpy-like interface of awkward-array and the module interface of numpy"""
627
+
628
+ module: types.ModuleType
629
+ nplike: ak._nplikes.numpy_like.NumpyLike
630
+
631
+ def __eq__(self, other: typing.Any) -> bool:
632
+ if isinstance(other, _lib):
633
+ return self.module is other.module and self.nplike is other.nplike
634
+ else:
635
+ return self.module is other
636
+
637
+ def __ne__(self, other: typing.Any) -> bool:
638
+ return not self.__eq__(other)
639
+
640
+ def __getattr__(self, name: str) -> typing.Any:
641
+ if fun := getattr(self.nplike, name, False):
642
+ return fun
643
+ else:
644
+ return getattr(self.module, name)
645
+
646
+
625
647
  class VectorAwkward:
626
648
  """Mixin class for Awkward vectors."""
627
649
 
628
- lib: types.ModuleType = numpy
650
+ @property
651
+ def lib(self): # type:ignore[no-untyped-def]
652
+ if (
653
+ nplike := self.layout.backend.nplike # type:ignore[attr-defined]
654
+ ) is ak._nplikes.typetracer.TypeTracer.instance():
655
+ return _lib(module=numpy, nplike=nplike)
656
+ return numpy
629
657
 
630
658
  def _wrap_result(
631
659
  self: AwkwardProtocol,