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

PyExamples: don't show progress counter in ctest log

parent 932cfadc
No related branches found
No related tags found
No related merge requests found
......@@ -48,7 +48,8 @@ def get_simulation(integration_flag):
simulation.setDetectorParameters(200, -2.0*deg, 2.0*deg, 200, 0.0*deg, 2.0*deg)
simulation.setBeamParameters(1.0*angstrom, 0.2*deg, 0.0*deg)
simulation.getOptions().setMonteCarloIntegration(integration_flag, 50)
simulation.setTerminalProgressMonitor()
if not "__no_terminal__" in globals():
simulation.setTerminalProgressMonitor()
return simulation
......
......@@ -71,7 +71,8 @@ def run_simulation():
"""
simulation = get_simulation()
simulation.setSample(get_sample())
simulation.setTerminalProgressMonitor()
if not "__no_terminal__" in globals():
simulation.setTerminalProgressMonitor()
simulation.runSimulation()
return simulation.result()
......@@ -87,4 +88,3 @@ if __name__ == '__main__':
plt.plot(xpeaks, ypeaks, linestyle='None', marker='x', color='white',
markersize=10)
plt.show()
......@@ -62,7 +62,8 @@ def run_simulation():
"""
simulation = get_simulation()
simulation.setSample(get_sample())
simulation.setTerminalProgressMonitor()
if not "__no_terminal__" in globals():
simulation.setTerminalProgressMonitor()
simulation.runSimulation()
return simulation.result()
......
......@@ -59,7 +59,8 @@ def run_simulation():
"""
simulation = get_simulation()
simulation.setSample(get_sample())
simulation.setTerminalProgressMonitor()
if not "__no_terminal__" in globals():
simulation.setTerminalProgressMonitor()
simulation.runSimulation()
return simulation.result()
......
......@@ -69,7 +69,8 @@ def run_simulation():
"""
simulation = get_simulation()
simulation.setSample(get_sample())
simulation.setTerminalProgressMonitor()
if not "__no_terminal__" in globals():
simulation.setTerminalProgressMonitor()
simulation.runSimulation()
return simulation.result()
......
......@@ -70,12 +70,14 @@ def run_simulation():
"""
simulation = get_simulation()
simulation.setSample(get_sample())
simulation.setTerminalProgressMonitor()
if not "__no_terminal__" in globals():
simulation.setTerminalProgressMonitor()
simulation.runSimulation()
return simulation.result()
if __name__ == '__main__':
interactive = True
result = run_simulation().histogram2d()
ba.plot_histogram(result, cmap='jet', aspect='auto')
......
......@@ -55,7 +55,8 @@ def get_offspec_simulation():
# create OffSpecular simulation
simulation = ba.OffSpecSimulation()
simulation.setTerminalProgressMonitor()
if not "__no_terminal__" in globals():
simulation.setTerminalProgressMonitor()
# define detector parameters
n_alpha, alpha_min, alpha_max = 300, 0.0*deg, 4.0*deg
......
......@@ -40,8 +40,9 @@ def exec_full(filepath):
global_namespace = {
"__file__": filepath,
"__name__": "__main__",
"__no_terminal__": True
}
sys.argv = [] # FIXME after cleanup in plot_utils
sys.argv = [] # TODO: FIXME after cleanup in plot_utils
with open(filepath, 'rb') as file:
exec(compile(file.read(), filepath, 'exec'), global_namespace)
......@@ -53,11 +54,12 @@ def run_example(filename):
if not os.path.exists(filename):
raise Exception("Example script '" + filename + "' not found")
print("Input script: " + filename)
print("Input script: " + filename, flush=True)
fig = get_figure(filename)
exec_full(filename)
print("Input script completed.", flush=True)
plot_file_name = os.path.join(
output_dir,
......@@ -76,8 +78,6 @@ def run_example(filename):
if __name__ == '__main__':
if len(sys.argv) != 2:
exit(
"Auxiliary script check_functionality called with wrong number of arguments"
)
exit("check_functionality called with wrong number of arguments")
run_example(sys.argv[1])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment