Skip to content

Commit

Permalink
Add regression test for rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
APJansen committed Jul 18, 2023
1 parent 4e0e226 commit becbf9d
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions n3fit/src/n3fit/tests/test_rotations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import numpy as np

from n3fit.backends import operations as op
from n3fit.layers import FkRotation, FlavourToEvolution


def test_fk():
rotation = FkRotation()
gridpoints = 2
np.random.seed(0)
pdf = op.numpy_to_tensor(np.random.rand(1, gridpoints, 9))
pdf_rotated = rotation(pdf)
pdf_rotated_known = op.numpy_to_tensor(
[
[
[
0.0,
0.5488135,
0.71518934,
0.60276335,
0.5448832,
0.4236548,
0.96366274,
0.60276335,
0.60276335,
0.6458941,
0.4375872,
-3.0182784,
0.5488135,
0.5488135,
],
[
0.0,
0.3834415,
0.79172504,
0.5288949,
0.56804454,
0.92559665,
0.83261985,
0.5288949,
0.5288949,
0.07103606,
0.0871293,
0.30256793,
0.3834415,
0.3834415,
],
]
]
)
np.testing.assert_allclose(pdf_rotated.numpy(), pdf_rotated_known.numpy(), rtol=1e-5)

0 comments on commit becbf9d

Please sign in to comment.