diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/InterferenceParaCrystal1D.py b/Examples/python/simulation/ex03_InterferenceFunctions/Interference1DRadialParaCrystal.py similarity index 98% rename from Examples/python/simulation/ex03_InterferenceFunctions/InterferenceParaCrystal1D.py rename to Examples/python/simulation/ex03_InterferenceFunctions/Interference1DRadialParaCrystal.py index 20c3bf59026741947f42a6e5f53aed6610887038..db98777126714406b9c0be85e21ff95673974fa9 100644 --- a/Examples/python/simulation/ex03_InterferenceFunctions/InterferenceParaCrystal1D.py +++ b/Examples/python/simulation/ex03_InterferenceFunctions/Interference1DRadialParaCrystal.py @@ -1,5 +1,5 @@ """ -radial paracrystal (IsGISAXS example ex-4) +radial paracrystal """ import numpy import matplotlib diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/InterferenceParaCrystal2D.py b/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DParaCrystal.py similarity index 98% rename from Examples/python/simulation/ex03_InterferenceFunctions/InterferenceParaCrystal2D.py rename to Examples/python/simulation/ex03_InterferenceFunctions/Interference2DParaCrystal.py index 0f8dd59534bdd1aa9d7c16a702327386b989aa05..5a60aa00ed0a5ca7f80cb685b1a002398aef4de7 100644 --- a/Examples/python/simulation/ex03_InterferenceFunctions/InterferenceParaCrystal2D.py +++ b/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DParaCrystal.py @@ -1,5 +1,5 @@ """ -2D paracrystal (IsGISAXS example ex-4) +2D paracrystal """ import numpy import matplotlib diff --git a/Examples/python/simulation/ex04_ComplexShapes/CustomFormFactor.py b/Examples/python/simulation/ex04_ComplexShapes/CustomFormFactor.py index 8e667baf39ee54a637b774e1579e20d32f127049..e2e76daeb4fa23be0328d975acee7ce01afb0359 100644 --- a/Examples/python/simulation/ex04_ComplexShapes/CustomFormFactor.py +++ b/Examples/python/simulation/ex04_ComplexShapes/CustomFormFactor.py @@ -10,32 +10,42 @@ from bornagain import * phi_min, phi_max = -1.0, 1.0 alpha_min, alpha_max = 0.0, 2.0 +def sinc(x): + if abs(x) == 0.: + return 1. + else: + return cmath.sin(x)/x class CustomFormFactor(IFormFactorBorn): """ A custom defined form factor - The form factor is V sech(q L) with - V volume of particle - L length scale which defines mean radius + The particle is a polyhedron, whose planar cross section is a "plus" shape + with a side length L. + H is the height of particle """ - def __init__(self, V, L): + def __init__(self, L, H): IFormFactorBorn.__init__(self) # parameters describing the form factor - self.V = V self.L = L + self.H = H + def clone(self): """ IMPORTANT NOTE: The clone method needs to call transferToCPP() on the cloned object to transfer the ownership of the clone to the cpp code """ - cloned_ff = CustomFormFactor(self.V, self.L) + cloned_ff = CustomFormFactor(self.L, self.H) cloned_ff.transferToCPP() return cloned_ff def evaluate_for_q(self, q): - return self.V*1.0/cmath.cosh(q.mag()*self.L) + qzhH = 0.5*q.z()*self.H + qxhL = 0.5*q.x()*self.L + qyhL = 0.5*q.y()*self.L + return 0.5*self.H*self.L**2*cmath.exp(complex(0.,1.)*qzhH)*sinc(qzhH)*(sinc(0.5*qyhL)*(sinc(qxhL) - 0.5*sinc(0.5*qxhL)) + sinc(0.5*qxhL)*sinc(qyhL)) + def get_sample(): @@ -48,7 +58,7 @@ def get_sample(): m_particle = HomogeneousMaterial("Particle", 6e-4, 2e-8) # collection of particles - ff = CustomFormFactor(343.0*nanometer, 7.0*nanometer) + ff = CustomFormFactor(20.0*nanometer, 15.0*nanometer) particle = Particle(m_particle, ff) particle_layout = ParticleLayout() particle_layout.addParticle(particle, 0.0, 1.0) diff --git a/Examples/python/simulation/ex05_BeamAndDetector/OffSpecularSimulation.py b/Examples/python/simulation/ex05_BeamAndDetector/OffSpecularSimulation.py index c2c15acd5e2a1af699abff11530050e9a11cc656..e5a17834230d9d183e01709539b2427183ea9237 100644 --- a/Examples/python/simulation/ex05_BeamAndDetector/OffSpecularSimulation.py +++ b/Examples/python/simulation/ex05_BeamAndDetector/OffSpecularSimulation.py @@ -74,7 +74,7 @@ def run_simulation(): extent=[alpha_i_min, alpha_i_max, alpha_f_min, alpha_f_max], aspect='auto') cb = pylab.colorbar(im) cb.set_label(r'Intensity (arb. u.)', fontsize=16) - pylab.xlabel(r'$\phi_f (^{\circ})$', fontsize=16) + pylab.xlabel(r'$\alpha_i (^{\circ})$', fontsize=16) pylab.ylabel(r'$\alpha_f (^{\circ})$', fontsize=16) pylab.show()