Plot form factors. """ import bornagain as ba from bornagain import nanometer, degree import bornplot2 as bp import math import inspect det = bp.DetPars(400, -.25, .25, -.25, .25) n = 3 results = [] edge = 30 title = 'E=30' trafo = ba.RotationY(26.5651 * degree) ff = ba.FormFactorTruncatedCube(edge * nanometer, 2 * nanometer) sim = bp.get_simulation(det, ff, trafo) data = bp.run_sim(sim, det) results.append(bp.Result(0, data, title)) pool = ff.getParameterPool() print(pool.getParameterNames()) print(ff.getLength()) print(ff.volume()) pool.setParameterValue('Length', 10) print(ff.getLength()) print(ff.volume()) title = 'E=10' data = bp.run_sim(sim, det)
ba.FormFactorCone6(10.0, 13.0, 60.0 * deg), ba.FormFactorCuboctahedron(20.0, 13.0, 0.7, 60.0 * deg), ba.FormFactorCylinder(8.0, 16.0), ba.FormFactorDodecahedron(5.0), ba.FormFactorEllipsoidalCylinder(8.0, 13.0, 16.0), ba.FormFactorFullSphere(8.0), ba.FormFactorFullSpheroid(10.0, 13.0), ba.FormFactorHemiEllipsoid(10.0, 6.0, 8.0), ba.FormFactorIcosahedron(8.0), ba.FormFactorPrism3(10.0, 13.0), ba.FormFactorPrism6(5.0, 11.0), ba.FormFactorPyramid(18.0, 13.0, 60.0 * deg), ba.FormFactorCosineRippleBox(27.0, 20.0, 14.0), ba.FormFactorSawtoothRippleBox(36.0, 25.0, 14.0, 3.0), ba.FormFactorTetrahedron(15.0, 6.0, 60.0 * deg), ba.FormFactorTruncatedCube(15.0, 6.0), ba.FormFactorTruncatedSphere(5.0, 7.0, 0), ba.FormFactorTruncatedSpheroid(7.5, 9.0, 1.2, 0), ] def get_sample(formfactor): """ Returns a one-layer sample that contains particles with given form factor. """ # defining materials m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8) # collection of particles particle = ba.Particle(m_particle, formfactor)
""" Plot form factors. """ import bornagain as ba from bornagain import nanometer, degree import bornplot as bp det = bp.Detector( 200, 0, 5, 0, 5 ) n = 4 results = [] for i in range(n): omega=45*i/(n-1) title = r'$\omega=%d^\circ$' % omega ff = ba.FormFactorTruncatedCube(6.4*nanometer, 1.5*nanometer) trafo = ba.RotationZ(omega*degree) data = bp.run_simulation(det,ff,trafo) results.append( bp.Result(i, data, title) ) bp.make_plot( results, det, "ff_TruncatedCube" )