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
36d072dd
Commit
36d072dd
authored
3 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
test_performance.py: start modernization
parent
17a9ee76
No related branches found
No related tags found
1 merge request
!325
remove performance tests
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/Performance/Python/test_performance.py
+6
-24
6 additions, 24 deletions
Tests/Performance/Python/test_performance.py
with
6 additions
and
24 deletions
Tests/Performance/Python/test_performance.py
+
6
−
24
View file @
36d072dd
...
@@ -76,30 +76,13 @@ class CustomFormFactor(IBornFF):
...
@@ -76,30 +76,13 @@ class CustomFormFactor(IBornFF):
# class for performance test, constructed using sample factories
# class for performance test, constructed using sample factories
class
FactoryTest
:
class
FactoryTest
:
def
__init__
(
self
,
name
,
simulation_name
,
sample_builder
,
def
__init__
(
self
,
name
,
simulation
,
nrepetitions
):
nrepetitions
):
self
.
m_test_name
=
name
self
.
m_test_name
=
name
self
.
m_simulation_name
=
simulation_name
self
.
m_simulation
=
simulation
self
.
m_sample_builder_name
=
sample_builder
self
.
m_nrepetitions
=
nrepetitions
self
.
m_nrepetitions
=
nrepetitions
self
.
m_cpu_time
=
0.0
self
.
m_cpu_time
=
0.0
self
.
m_wall_time
=
0.0
self
.
m_wall_time
=
0.0
self
.
m_sample
=
None
if
simulation_name
!=
None
and
sample_builder
!=
None
:
self
.
m_sample_factory
=
SampleBuilderFactory
()
self
.
m_simulation_factory
=
SimulationFactory
()
self
.
m_simulation
=
self
.
m_simulation_factory
.
createItem
(
self
.
m_simulation_name
)
self
.
m_sample
=
self
.
m_sample_factory
.
createSampleByName
(
self
.
m_sample_builder_name
)
else
:
self
.
m_sample_factory
=
None
self
.
m_simulation_factory
=
None
self
.
m_simulation
=
None
self
.
m_sample
=
None
def
prepare
(
self
):
def
prepare
(
self
):
pass
pass
...
@@ -107,7 +90,6 @@ class FactoryTest:
...
@@ -107,7 +90,6 @@ class FactoryTest:
def
run_loop
(
self
):
def
run_loop
(
self
):
# actual work is done here
# actual work is done here
for
i
in
range
(
self
.
m_nrepetitions
):
for
i
in
range
(
self
.
m_nrepetitions
):
self
.
m_simulation
.
setSample
(
self
.
m_sample
)
self
.
m_simulation
.
runSimulation
()
self
.
m_simulation
.
runSimulation
()
def
run
(
self
):
def
run
(
self
):
...
@@ -145,13 +127,11 @@ class CustomTest(FactoryTest):
...
@@ -145,13 +127,11 @@ class CustomTest(FactoryTest):
self
.
m_simulation
=
None
self
.
m_simulation
=
None
def
prepare
(
self
):
def
prepare
(
self
):
self
.
m_sample
=
self
.
get_sample
()
self
.
m_simulation
=
self
.
get_simulation
(
self
.
get_sample
())
self
.
m_simulation
=
self
.
get_simulation
()
# do the actual work
# do the actual work
def
run_loop
(
self
):
def
run_loop
(
self
):
for
i
in
range
(
self
.
m_nrepetitions
):
for
i
in
range
(
self
.
m_nrepetitions
):
self
.
m_simulation
.
setSample
(
self
.
m_sample
)
self
.
m_simulation
.
runSimulation
()
self
.
m_simulation
.
runSimulation
()
def
get_sample
(
self
):
def
get_sample
(
self
):
...
@@ -178,7 +158,7 @@ class CustomTest(FactoryTest):
...
@@ -178,7 +158,7 @@ class CustomTest(FactoryTest):
multi_layer
.
addLayer
(
substrate_layer
)
multi_layer
.
addLayer
(
substrate_layer
)
return
multi_layer
return
multi_layer
def
get_simulation
(
self
):
def
get_simulation
(
self
,
sample
):
"""
"""
Create and return GISAXS simulation with beam and detector defined
Create and return GISAXS simulation with beam and detector defined
IMPORTANT NOTE:
IMPORTANT NOTE:
...
@@ -189,6 +169,7 @@ class CustomTest(FactoryTest):
...
@@ -189,6 +169,7 @@ class CustomTest(FactoryTest):
simulation
.
setDetectorParameters
(
100
,
phi_min
*
deg
,
phi_max
*
deg
,
simulation
.
setDetectorParameters
(
100
,
phi_min
*
deg
,
phi_max
*
deg
,
100
,
alpha_min
*
deg
,
alpha_max
*
deg
)
100
,
alpha_min
*
deg
,
alpha_max
*
deg
)
simulation
.
setBeamParameters
(
1
*
angstrom
,
0.2
*
deg
,
0
)
simulation
.
setBeamParameters
(
1
*
angstrom
,
0.2
*
deg
,
0
)
simulation
.
setSample
(
sample
)
return
simulation
return
simulation
...
@@ -202,6 +183,7 @@ class PerformanceTests:
...
@@ -202,6 +183,7 @@ class PerformanceTests:
self
.
m_pyversion
=
""
self
.
m_pyversion
=
""
self
.
m_filename
=
filename
self
.
m_filename
=
filename
# TODO: directly add simulation
self
.
add
(
"
MultiLayer
"
,
"
MaxiGISAS
"
,
self
.
add
(
"
MultiLayer
"
,
"
MaxiGISAS
"
,
"
MultiLayerWithRoughnessBuilder
"
,
1
)
"
MultiLayerWithRoughnessBuilder
"
,
1
)
self
.
add
(
"
CylindersInDWBA
"
,
"
MaxiGISAS
"
,
"
CylindersInDWBABuilder
"
,
self
.
add
(
"
CylindersInDWBA
"
,
"
MaxiGISAS
"
,
"
CylindersInDWBABuilder
"
,
...
...
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