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
621b6e6f
Commit
621b6e6f
authored
3 years ago
by
Matthias Puchner
Browse files
Options
Downloads
Patches
Plain Diff
exclude tests regarding parameterPool/register parameter
parent
dc47ca5b
No related branches found
No related tags found
1 merge request
!65
Refactor Distribution Handling
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Tests/Functional/PyCore/CMakeLists.txt
+5
-0
5 additions, 0 deletions
Tests/Functional/PyCore/CMakeLists.txt
Tests/Functional/PyCore/parameterpool.py
+0
-75
0 additions, 75 deletions
Tests/Functional/PyCore/parameterpool.py
with
5 additions
and
75 deletions
Tests/Functional/PyCore/CMakeLists.txt
+
5
−
0
View file @
621b6e6f
...
@@ -11,6 +11,11 @@ if(NOT BORNAGAIN_TIFF_SUPPORT)
...
@@ -11,6 +11,11 @@ if(NOT BORNAGAIN_TIFF_SUPPORT)
list
(
REMOVE_ITEM tests
"intensitydata_io_tiff.py"
)
list
(
REMOVE_ITEM tests
"intensitydata_io_tiff.py"
)
endif
()
endif
()
message
(
"Test mesocrystal1.py contains RegisterParameter and will not be executed"
)
list
(
REMOVE_ITEM tests mesocrystal1.py
)
message
(
"Test samplebuilder.py contains RegisterParameter and will not be executed"
)
list
(
REMOVE_ITEM tests samplebuilder.py
)
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/utils.py
${
OUTPUT_DIR
}
/utils.py @ONLY
)
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/utils.py
${
OUTPUT_DIR
}
/utils.py @ONLY
)
foreach
(
_test
${
tests
}
)
foreach
(
_test
${
tests
}
)
...
...
This diff is collapsed.
Click to expand it.
Tests/Functional/PyCore/parameterpool.py
deleted
100644 → 0
+
0
−
75
View file @
dc47ca5b
import
numpy
,
os
,
sys
,
unittest
import
bornagain
as
ba
from
bornagain
import
nm
class
ParameterPoolTest
(
unittest
.
TestCase
):
def
test_parameterTreeAccess
(
self
):
"""
Checks values in particle
'
s parameter tree. Parameter tree is a pool with parameters of
particle and its children (in given case, form factor of cylinder)
"""
ff
=
ba
.
FormFactorCylinder
(
5
*
nm
,
6
*
nm
)
particle
=
ba
.
Particle
(
ba
.
HomogeneousMaterial
(
"
Vacuum
"
,
0
,
0
),
ff
)
particle
.
setAbundance
(
1
)
particle
.
setPosition
(
2
,
3
,
4
)
expected
=
{
'
/Particle/Abundance
'
:
1
,
'
/Particle/PositionX
'
:
2
,
'
/Particle/PositionY
'
:
3
,
'
/Particle/PositionZ
'
:
4
,
'
/Particle/Cylinder/Radius
'
:
5
,
'
/Particle/Cylinder/Height
'
:
6.0
}
for
name
in
expected
:
self
.
assertEqual
(
particle
.
registeredParameter
(
name
).
value
(),
expected
[
name
])
def
test_parameterTreeModify
(
self
):
"""
Modifies values of particle
'
s parameter tree.
"""
ff
=
ba
.
FormFactorCylinder
(
5
*
nm
,
6
*
nm
)
particle
=
ba
.
Particle
(
ba
.
HomogeneousMaterial
(
"
Vacuum
"
,
0
,
0
),
ff
)
particle
.
setAbundance
(
1
)
particle
.
setPosition
(
2
,
3
,
4
)
# print(particle.parametersToString())
# print(particle.treeToString())
particle
.
registeredParameter
(
'
/Particle/Abundance
'
).
setValue
(
10
)
particle
.
registeredParameter
(
'
/Particle/PositionY
'
).
setValue
(
30
)
particle
.
registeredParameter
(
'
*Cylinder/R*
'
).
setValue
(
50
)
expected
=
{
'
/Particle/Abundance
'
:
10
,
'
/Particle/PositionX
'
:
2
,
'
/Particle/PositionY
'
:
30
,
'
/Particle/PositionZ
'
:
4
,
'
/Particle/Cylinder/Radius
'
:
50
,
'
/Particle/Cylinder/Height
'
:
6
}
for
name
in
expected
:
self
.
assertEqual
(
particle
.
registeredParameter
(
name
).
value
(),
expected
[
name
])
def
test_parameterModify
(
self
):
"""
Modification of particle
'
s parameters without intermediate access to parameter pool
"""
ff
=
ba
.
FormFactorCylinder
(
5
*
nm
,
6
*
nm
)
particle
=
ba
.
Particle
(
ba
.
HomogeneousMaterial
(
"
Vacuum
"
,
0
,
0
),
ff
)
particle
.
setAbundance
(
1
)
particle
.
setPosition
(
2
,
3
,
4
)
particle
.
registeredParameter
(
'
/Particle/Abundance
'
).
setValue
(
10
)
particle
.
registeredParameter
(
'
PositionZ
'
).
setValue
(
40
)
particle
.
registeredParameter
(
'
*Cylinder/R*
'
).
setValue
(
50
)
self
.
assertEqual
(
particle
.
abundance
(),
10
)
self
.
assertEqual
(
particle
.
position
().
z
(),
40
)
if
__name__
==
'
__main__
'
:
unittest
.
main
()
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