-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
final set of tests + xfail a few tests on numpy 2
- Loading branch information
1 parent
50e27ff
commit 1642243
Showing
4 changed files
with
169 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright (c) 2019-2024, Jonas Eschle, Jim Pivarski, Eduardo Rodrigues, and Henry Schreiner. | ||
# | ||
# Distributed under the 3-clause BSD license, see accompanying file LICENSE | ||
# or https://github.com/scikit-hep/vector for details. | ||
|
||
from __future__ import annotations | ||
|
||
import pytest | ||
|
||
import vector | ||
|
||
sympy = pytest.importorskip("sympy") | ||
|
||
pytestmark = pytest.mark.sympy | ||
|
||
x, y, z, t = sympy.symbols("x y z t", real=True) | ||
values = {x: 3, y: 2, z: 1, t: 10} | ||
|
||
|
||
def test(): | ||
vec = vector.VectorSympy4D( | ||
azimuthal=vector.backends.sympy.AzimuthalSympyXY(x, y), | ||
longitudinal=vector.backends.sympy.LongitudinalSympyZ(z), | ||
temporal=vector.backends.sympy.TemporalSympyT(t), | ||
) | ||
out = vec.boostX(gamma=3) | ||
assert out.x == 2 * sympy.sqrt(2) * t + 3 * x | ||
assert out.y == y | ||
assert out.z == z | ||
assert out.t == 3 * t + 2 * sympy.sqrt(2) * x | ||
|
||
for t1 in ( | ||
"xyzt", | ||
"xythetat", | ||
"xyetat", | ||
"rhophizt", | ||
"rhophithetat", | ||
"rhophietat", | ||
"xyztau", | ||
"xythetatau", | ||
"xyetatau", | ||
"rhophiztau", | ||
"rhophithetatau", | ||
"rhophietatau", | ||
): | ||
tvec = getattr(vec, "to_" + t1)() | ||
out = tvec.boostX(gamma=3) | ||
assert out.x.subs(values).evalf() == pytest.approx(37.2842712474619) | ||
assert out.y.subs(values).evalf() == pytest.approx(2) | ||
assert out.z.subs(values).evalf() == pytest.approx(1) | ||
assert out.t.subs(values).evalf() == pytest.approx(38.4852813742386) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright (c) 2019-2024, Jonas Eschle, Jim Pivarski, Eduardo Rodrigues, and Henry Schreiner. | ||
# | ||
# Distributed under the 3-clause BSD license, see accompanying file LICENSE | ||
# or https://github.com/scikit-hep/vector for details. | ||
|
||
from __future__ import annotations | ||
|
||
import pytest | ||
|
||
import vector | ||
|
||
sympy = pytest.importorskip("sympy") | ||
|
||
pytestmark = pytest.mark.sympy | ||
|
||
x, y, z, t = sympy.symbols("x y z t", real=True) | ||
values = {x: 2, y: 3, z: 1, t: 4} | ||
|
||
|
||
def test(): | ||
vec = vector.VectorSympy4D( | ||
azimuthal=vector.backends.sympy.AzimuthalSympyXY(x, y), | ||
longitudinal=vector.backends.sympy.LongitudinalSympyZ(z), | ||
temporal=vector.backends.sympy.TemporalSympyT(t), | ||
) | ||
out = vec.boostY(gamma=3) | ||
assert out.x == x | ||
assert out.y == 2 * sympy.sqrt(2) * t + 3 * y | ||
assert out.z == z | ||
assert out.t == 3 * t + 2 * sympy.sqrt(2) * y | ||
|
||
for t1 in ( | ||
"xyzt", | ||
"xythetat", | ||
"xyetat", | ||
"rhophizt", | ||
"rhophithetat", | ||
"rhophietat", | ||
"xyztau", | ||
"xythetatau", | ||
"xyetatau", | ||
"rhophiztau", | ||
"rhophithetatau", | ||
"rhophietatau", | ||
): | ||
tvec = getattr(vec, "to_" + t1)() | ||
out = tvec.boostY(gamma=3) | ||
assert out.x.subs(values).evalf() == pytest.approx(2) | ||
assert out.y.subs(values).evalf() == pytest.approx(20.3137084989848) | ||
assert out.z.subs(values).evalf() == pytest.approx(1) | ||
assert out.t.subs(values).evalf() == pytest.approx(20.4852813742386) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright (c) 2019-2024, Jonas Eschle, Jim Pivarski, Eduardo Rodrigues, and Henry Schreiner. | ||
# | ||
# Distributed under the 3-clause BSD license, see accompanying file LICENSE | ||
# or https://github.com/scikit-hep/vector for details. | ||
|
||
from __future__ import annotations | ||
|
||
import pytest | ||
|
||
import vector | ||
|
||
sympy = pytest.importorskip("sympy") | ||
|
||
pytestmark = pytest.mark.sympy | ||
|
||
x, y, z, t = sympy.symbols("x y z t", real=True) | ||
values = {x: 1, y: 2, z: 3, t: 4} | ||
|
||
|
||
def test(): | ||
vec = vector.VectorSympy4D( | ||
azimuthal=vector.backends.sympy.AzimuthalSympyXY(x, y), | ||
longitudinal=vector.backends.sympy.LongitudinalSympyZ(z), | ||
temporal=vector.backends.sympy.TemporalSympyT(t), | ||
) | ||
out = vec.boostZ(gamma=3) | ||
assert out.x == x | ||
assert out.y == y | ||
assert out.z.subs(values).evalf() == pytest.approx(20.3137084989848) | ||
assert out.t.subs(values).evalf() == pytest.approx(20.4852813742386) | ||
|
||
for t1 in ( | ||
"xyzt", | ||
"xythetat", | ||
"xyetat", | ||
"rhophizt", | ||
"rhophithetat", | ||
"rhophietat", | ||
"xyztau", | ||
"xythetatau", | ||
"xyetatau", | ||
"rhophiztau", | ||
"rhophithetatau", | ||
"rhophietatau", | ||
): | ||
tvec = getattr(vec, "to_" + t1)() | ||
out = tvec.boostZ(gamma=3) | ||
assert out.x.subs(values).evalf() == pytest.approx(1) | ||
assert out.y.subs(values).evalf() == pytest.approx(2) | ||
assert out.z.subs(values).evalf() == pytest.approx(20.3137084989848) | ||
assert out.t.subs(values).evalf() == pytest.approx(20.4852813742386) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters