Skip to content
Snippets Groups Projects
Commit 8b8b04bd authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

more verbose output; simplify one example

parent 8edbe6c1
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ import bornagain as ba ...@@ -7,7 +7,7 @@ import bornagain as ba
from bornagain import deg, angstrom, nm from bornagain import deg, angstrom, nm
def get_sample(lattice_rotation_angle=45*deg): def get_sample():
""" """
Returns a sample with a grating on a substrate, Returns a sample with a grating on a substrate,
modelled by very long boxes forming a 1D lattice with Cauchy correlations. modelled by very long boxes forming a 1D lattice with Cauchy correlations.
...@@ -21,8 +21,7 @@ def get_sample(lattice_rotation_angle=45*deg): ...@@ -21,8 +21,7 @@ def get_sample(lattice_rotation_angle=45*deg):
lattice_length = 30*nm lattice_length = 30*nm
# collection of particles # collection of particles
interference = ba.InterferenceFunction1DLattice(lattice_length, interference = ba.InterferenceFunction1DLattice(lattice_length, 45*deg)
lattice_rotation_angle)
pdf = ba.FTDecayFunction1DCauchy(1000.0) pdf = ba.FTDecayFunction1DCauchy(1000.0)
interference.setDecayFunction(pdf) interference.setDecayFunction(pdf)
......
...@@ -43,8 +43,12 @@ def substitute_sample(ti, tc): ...@@ -43,8 +43,12 @@ def substitute_sample(ti, tc):
def retrieve_sample(ti, fname): def retrieve_sample(ti, fname):
c = compile(ti, fname, 'exec') c = compile(ti, fname, 'exec')
if verbose:
print(f'.. compiled sample code')
ns = {} ns = {}
exec(c, ns) exec(c, ns)
if verbose:
print(f'.. executed sample code')
globals().update(ns) globals().update(ns)
return get_sample() return get_sample()
...@@ -54,6 +58,8 @@ def cycle_sample(ti, fname): ...@@ -54,6 +58,8 @@ def cycle_sample(ti, fname):
Returns normalized version of script ti as obtained from BornAgain's export-to-Python function. Returns normalized version of script ti as obtained from BornAgain's export-to-Python function.
""" """
sam = retrieve_sample(ti, fname) sam = retrieve_sample(ti, fname)
if verbose:
print(f'.. retrieved sample')
res = ba.generateSampleCode(sam) res = ba.generateSampleCode(sam)
if verbose: if verbose:
print(f'.. cycled get_sample, {len(res.split())} lines') print(f'.. cycled get_sample, {len(res.split())} lines')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment