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

mv -> std_simulations.sas

parent 2187bb9c
No related branches found
No related tags found
1 merge request!761mv code to std_samples and std_simulations
#!/usr/bin/env python3
import bornagain as ba
from bornagain import nm, deg, std_samples
from bornagain import nm, deg, std_samples, std_simulations
import bornplot2 as bp2
m_particle = ba.HomogeneousMaterial("Particle", 1e-5, 0)
......@@ -16,8 +16,9 @@ def simulate_at(omega):
particle.setRotation(ba.RotationZ(omega*deg))
sample = std_samples.sas_sample_with_particle(particle)
result = bp2.run_sas(sample, npix)
return bp2.NamedResult(result, title)
simulation = std_simulations.sas(sample, npix)
simulation.runSimulation()
return bp2.NamedResult(simulation.result(), title)
namedResults = [simulate_at(omega) for omega in [0, 30]]
......
......@@ -12,7 +12,6 @@ rc('image', cmap='inferno')
mpl.rcParams['image.interpolation'] = 'none'
import bornagain as ba
from bornagain import deg, angstrom
from bornagain import ba_plot as bp
......@@ -137,14 +136,3 @@ def make_plot(namedResults, name, ncol):
# Show or export
plt.savefig(name + ".pdf", format="pdf", bbox_inches='tight')
# plt.show()
def run_sas(sample, npix):
"""
Run simulation and plot results
"""
beam = ba.Beam(1, 1*angstrom, ba.Direction(1e-8*deg, 0))
det = ba.SphericalDetector(npix, 10*deg, 0, 0)
simulation = ba.ScatteringSimulation(beam, sample, det)
simulation.runSimulation()
return simulation.result()
......@@ -13,3 +13,13 @@ def specular(sample, scan_size=500):
simulation.setScan(scan)
simulation.setSample(sample)
return simulation
def sas(sample, npix=201):
"""
A standard simulation in small-angle scattering geometry.
Incident beam is almost horizontal.
"""
beam = ba.Beam(1, 1*angstrom, ba.Direction(1e-8*deg, 0))
det = ba.SphericalDetector(npix, 10*deg, 0, 0)
return ba.ScatteringSimulation(beam, sample, det)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment