Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galumph
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
30
Issues
30
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
grp-svergun
galumph
Commits
4676b8e8
Verified
Commit
4676b8e8
authored
May 25, 2020
by
Chris Kerr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove tests for the F2Py wignerSymbols module
parent
98dafc91
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
52 deletions
+5
-52
test/test_formulae.py
test/test_formulae.py
+5
-52
No files found.
test/test_
wigner
.py
→
test/test_
formulae
.py
View file @
4676b8e8
"""Test various mathematical formulae used in GALUMPH.
This uses symbolic algebra to verify various simplified formulae.
"""
# SPDX-FileCopyrightText: 2018 Christopher Kerr
#
# SPDX-License-Identifier: LGPL-3.0-or-later
from
hypothesis
import
assume
,
given
,
HealthCheck
,
settings
import
hypothesis.strategies
as
st
import
pytest
from
galumph
import
wignerSymbols
sympy
=
pytest
.
importorskip
(
'sympy'
)
from
sympy.physics.wigner
import
wigner_3j
# noqa: E402
LMAX_TEST
=
63
def
iLMKP
(
L
,
M
,
K
,
P
,
check
=
True
):
...
...
@@ -37,25 +34,6 @@ def assert_sympy_equal(a, b):
assert
sympy
.
simplify
(
a
-
b
)
==
0
@
pytest
.
fixture
(
scope
=
'module'
)
def
wigner_matrix_large
():
"""Fixture to calculate the Wigner matrix once and reuse it."""
mat
=
wignerSymbols
.
shzmat
(
LMAX_TEST
)
LMAX1
=
LMAX_TEST
+
1
LMAX2
=
LMAX_TEST
+
2
LMAX3
=
LMAX_TEST
+
3
assert
mat
.
shape
==
(
LMAX1
*
LMAX2
**
2
*
LMAX3
/
12
,)
return
mat
def
sympy_matrix_element
(
L
,
M
,
K
,
P
):
"""Calculate an element of the dlmkp matrix using sympy."""
wigner0
=
wigner_3j
(
L
,
P
,
K
,
0
,
0
,
0
)
wignerM
=
wigner_3j
(
L
,
P
,
K
,
-
M
,
0
,
M
)
prefactor
=
(
2
*
P
+
1
)
*
sympy
.
sqrt
((
2
*
L
+
1
)
*
(
2
*
K
+
1
))
return
prefactor
*
wigner0
*
wignerM
def
test_packed_sizes_offsets
():
"""Check formulae for sizes of and offsets into packed dlmkp matrices."""
def
psize
(
K
):
...
...
@@ -147,28 +125,3 @@ def test_packed_sizes_offsets():
check_sizes
()
check_formulae
()
@
settings
(
suppress_health_check
=
[
HealthCheck
.
filter_too_much
])
@
given
(
L
=
st
.
integers
(
min_value
=
0
,
max_value
=
LMAX_TEST
),
K
=
st
.
integers
(
min_value
=
0
,
max_value
=
LMAX_TEST
),
M
=
st
.
integers
(
min_value
=
0
,
max_value
=
LMAX_TEST
),
P
=
st
.
integers
(
min_value
=
0
,
max_value
=
2
*
LMAX_TEST
),
)
def
test_wigner_sympy_large
(
wigner_matrix_large
,
L
,
K
,
M
,
P
):
"""Test elements of the dlmkp matrix using sympy."""
assume
(
L
>=
M
)
assume
(
M
>=
0
)
assume
(
K
>=
M
)
assume
((
L
+
K
)
>=
P
)
assume
(
abs
(
L
-
K
)
<=
P
)
expected_symbolic
=
sympy_matrix_element
(
L
,
M
,
K
,
P
)
if
(
L
+
K
+
P
)
%
2
!=
0
:
assert
expected_symbolic
==
0
return
expected
=
float
(
expected_symbolic
)
if
L
>=
K
:
assert
wigner_matrix_large
[
iLMKP
(
L
,
M
,
K
,
P
)]
==
pytest
.
approx
(
expected
)
else
:
assert
wigner_matrix_large
[
iLMKP
(
K
,
M
,
L
,
P
)]
==
pytest
.
approx
(
expected
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment