Skip to content
Snippets Groups Projects
Commit ac09f2d4 authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

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
......@@ -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.
......
......@@ -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__':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment