Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
0d26c6d8
Commit
0d26c6d8
authored
2 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
test slicing more compact
parent
1624317d
No related branches found
No related tags found
1 merge request
!1222
Py fu tests: merge -> known_slicing; start auto_slicing tests
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Tests/Py/Functional/PyFuTestInfrastructure.py
+14
-1
14 additions, 1 deletion
Tests/Py/Functional/PyFuTestInfrastructure.py
Tests/Py/Functional/slicing.py
+2
-8
2 additions, 8 deletions
Tests/Py/Functional/slicing.py
with
16 additions
and
9 deletions
Tests/Py/Functional/PyFuTestInfrastructure.py
+
14
−
1
View file @
0d26c6d8
...
@@ -5,9 +5,22 @@ Collection of utils for testing
...
@@ -5,9 +5,22 @@ Collection of utils for testing
import
bornagain
as
ba
import
bornagain
as
ba
from
bornagain
import
deg
,
angstrom
from
bornagain
import
deg
,
angstrom
# same as test::makeSimulation::MiniGISAS
def
get_simulation_MiniGISAS
(
sample
):
def
get_simulation_MiniGISAS
(
sample
):
n
=
25
n
=
25
detector
=
ba
.
SphericalDetector
(
n
,
-
2
*
deg
,
2
*
deg
,
n
,
0
,
2
*
deg
)
detector
=
ba
.
SphericalDetector
(
n
,
-
2
*
deg
,
2
*
deg
,
n
,
0
,
2
*
deg
)
beam
=
ba
.
Beam
(
1.
,
1
*
angstrom
,
ba
.
Direction
(
0.2
*
deg
,
0
))
beam
=
ba
.
Beam
(
1.
,
1
*
angstrom
,
ba
.
Direction
(
0.2
*
deg
,
0
))
return
ba
.
ScatteringSimulation
(
beam
,
sample
,
detector
)
return
ba
.
ScatteringSimulation
(
beam
,
sample
,
detector
)
def
diff_MiniGISAS
(
sample1
,
sample2
):
"""
Run standard GISAS simulation for two sample models, and return diff of results.
"""
n
=
11
detector
=
ba
.
SphericalDetector
(
n
,
0
,
5
*
deg
,
n
,
0
,
4
*
deg
)
beam
=
ba
.
Beam
(
1.
,
1
*
angstrom
,
ba
.
Direction
(
0.2
*
deg
,
0
))
data1
=
ba
.
ScatteringSimulation
(
beam
,
sample1
,
detector
).
simulate
()
data2
=
ba
.
ScatteringSimulation
(
beam
,
sample2
,
detector
).
simulate
()
return
ba
.
meanRelativeDifference
(
data1
,
data2
)
This diff is collapsed.
Click to expand it.
Tests/Py/Functional/slicing.py
+
2
−
8
View file @
0d26c6d8
...
@@ -42,18 +42,12 @@ class SlicedSpheresTest(unittest.TestCase):
...
@@ -42,18 +42,12 @@ class SlicedSpheresTest(unittest.TestCase):
return
sample
return
sample
def
get_result
(
self
,
particle
,
sliced
):
sample
=
self
.
get_sample
(
particle
,
sliced
)
simulation
=
infrastruct
.
get_simulation_MiniGISAS
(
sample
)
return
simulation
.
simulate
()
def
testSlicingPyramid
(
self
):
def
testSlicingPyramid
(
self
):
ff
=
ba
.
Pyramid3
(
8.
,
10.
,
80
*
ba
.
deg
)
ff
=
ba
.
Pyramid3
(
8.
,
10.
,
80
*
ba
.
deg
)
particle
=
ba
.
Particle
(
matSubstrate
,
ff
)
particle
=
ba
.
Particle
(
matSubstrate
,
ff
)
dataA
=
self
.
get_result
(
particle
,
False
)
dataB
=
self
.
get_result
(
particle
,
True
)
diff
=
ba
.
meanRelativeDifference
(
dataA
,
dataB
)
diff
=
infrastruct
.
diff_MiniGISAS
(
self
.
get_sample
(
particle
,
False
),
self
.
get_sample
(
particle
,
True
))
self
.
assertLess
(
diff
,
1e-13
)
self
.
assertLess
(
diff
,
1e-13
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment