Skip to content

Commit 64ad9ae

Browse files
Implement all math (#34)
* Move the NaN-checks into the math functions, right outside the operations that might fail. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * deltaphi * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Refactor to allow rotateZ to return a vector or an array of vectors. * cottheta * Implemented 'cross' and tested it for Cartesian coordinates. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Implemented but have not tested coordinate transformation methods. * Tested coordinate system transformation methods and 'cross'. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * deltaeta. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * deltaR2 * deltaR * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * rotateX * rotateY * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * rotate_axis * fixed flake8 * Implemented but HAVE NOT TESTED rotate_euler * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * rotate_euler has been tested (target value comes from ROOT) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * rotate_nautical * Generate methods for rotate_axis as they are generated for rotate_euler. * Generate methods for cross as they are generated for rotate_axis. * Comments and complain about mixing libraries. * rotate_quaternion * Added (but didn't test) generic transformations. * Transformations don't have to be objects. Methods are fine. * If we don't have Transformation objects, we don't need the vector/point distinction. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update inheritance diagram. * Forgot a couple of lines. * One more line. * cosdeltaphi * The momentum classes on the diagram was wrong; fixed. * Spatial.dot is working. * Fix flake8. * Follow ROOT's rules for sqrt of negative Lorentz metric. * Conversions to other coordinate systems can be centralized. * 'cosdeltaphi' and 'cosdeltaangle' are not distinct from 'dot'. * 'deltaphi' should stay within -pi .. pi. * deltaangle * beta and gamma * rapidity * Et and Et2 * Mt and Mt2 * Implemented but HAVE NOT TESTED 'unit'. It should not change the coordinate system. * Tested 'unit'. * boost_p4 * boost_beta3 * boostZ_gamma * boostZ_beta * Preserve tau (mass) in boosts. * boostX_beta and boostX_gamma * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * boostY_beta and boostY_gamma * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix imports. * Implemented but have not tested is_* methods. * Momentum vectors present themselves with momentum coordinates. * Better interface functions. * to_beta3 * Merge vector.geometry into vector.methods because the distinction wasn't meaningful and the name was unclear. * scale * equal, not_equal, and isclose * add and subtract * Added the NumPy methods to catch ufuncs (and added equivalent stubs on VectorObject). There are no tests for this yet. Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 9635bab commit 64ad9ae

File tree

144 files changed

+21517
-2848
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+21517
-2848
lines changed

docs/api/inheritance.svg

Lines changed: 1732 additions & 1549 deletions
Loading

src/vector/__init__.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,43 @@
44
# or https://github.com/scikit-hep/vector for details.
55

66

7+
from .backends.numpy_ import ( # noqa: 401
8+
MomentumNumpy2D,
9+
MomentumNumpy3D,
10+
MomentumNumpy4D,
11+
VectorNumpy2D,
12+
VectorNumpy3D,
13+
VectorNumpy4D,
14+
array,
15+
)
16+
from .backends.object_ import ( # noqa: 401
17+
MomentumObject2D,
18+
MomentumObject3D,
19+
MomentumObject4D,
20+
VectorObject2D,
21+
VectorObject3D,
22+
VectorObject4D,
23+
obj,
24+
)
25+
from .methods import ( # noqa: 401
26+
Azimuthal,
27+
AzimuthalRhoPhi,
28+
AzimuthalXY,
29+
Coordinates,
30+
Longitudinal,
31+
LongitudinalEta,
32+
LongitudinalTheta,
33+
LongitudinalZ,
34+
Momentum,
35+
Temporal,
36+
TemporalT,
37+
TemporalTau,
38+
Vector,
39+
Vector2D,
40+
Vector3D,
41+
Vector4D,
42+
)
43+
744
# from .version import version as __version__
845

946
# __all__ = ("__version__",)

0 commit comments

Comments
 (0)