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
ac09f2d4
Commit
ac09f2d4
authored
7 years ago
by
Pospelov, Gennady
Browse files
Options
Downloads
Patches
Plain Diff
Python persistence example template now relies on example's run_simulation()
parent
91ba74e1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Examples/python/simulation/ex02_LayeredStructures/BuriedParticles.py
+1
-0
1 addition, 0 deletions
...thon/simulation/ex02_LayeredStructures/BuriedParticles.py
Tests/Functional/PyCore/persistence/example_template.py
+15
-4
15 additions, 4 deletions
Tests/Functional/PyCore/persistence/example_template.py
with
16 additions
and
4 deletions
Examples/python/simulation/ex02_LayeredStructures/BuriedParticles.py
+
1
−
0
View file @
ac09f2d4
...
...
@@ -4,6 +4,7 @@ Spherical particles embedded in the middle of the layer on top of substrate.
import
bornagain
as
ba
from
bornagain
import
deg
,
angstrom
,
nm
def
get_sample
():
"""
Returns a sample with spherical particles in an layer between air and substrate.
...
...
This diff is collapsed.
Click to expand it.
Tests/Functional/PyCore/persistence/example_template.py
+
15
−
4
View file @
ac09f2d4
...
...
@@ -15,6 +15,8 @@ output_dir = "@OUTPUT_DIR@"
sys
.
path
.
append
(
example_dir
)
example
=
__import__
(
example_name
)
simulationObject
=
None
def
get_minified_simulation
():
"""
...
...
@@ -33,14 +35,23 @@ def get_minified_simulation():
return
simulation
def
get_simulation
():
"""
Returns minified simulation to be used in example
"""
global
simulationObject
return
simulationObject
def
run_simulation
():
"""
Runs simulation and returns resulting intensity map.
"""
simulation
=
get_minified_simulation
()
simulation
.
setSample
(
example
.
get_sample
())
simulation
.
runSimulation
()
return
simulation
.
getIntensityData
()
global
simulationObject
simulationObject
=
get_minified_simulation
()
# replacing get_simulation() method of example with templated
example
.
get_simulation
=
get_simulation
return
example
.
run_simulation
()
if
__name__
==
'
__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