Commit de0eeb9e authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

gisas1 model now nicely imperfect

parent e469e112
"""
Parametric model of a GISAS simulation.
Dilute cylinders on a substrate.
The idealized sample model consists of dilute cylinders on a substrate.
"""
import bornagain as ba
......@@ -37,21 +37,11 @@ def get_simulation(params):
sample = get_sample(params)
simulation = ba.GISASSimulation(beam, sample, det)
if 'lg(background)' in params:
simulation.setBackground(
ba.ConstantBackground(10**params['lg(background)']))
return simulation
def model_parameters_and_bg():
return ({
'lg(intensity)': 6,
'cylinder_height': 4*nm,
'cylinder_radius': 5*nm,
}, 10**0.5)
def start_parameters_1():
params = ba.Parameters()
params.add("lg(intensity)", 5)
......
#!/usr/bin/env python3
"""
Fake GISAS data according to sample model from gisas_fit2d, with added noise.
Fake GISAS data for testing and benchmarking 2D fits.
The sample model basically consists of dilute cylinders on a substrate.
There are, however, some systematic distortions:
* Refractive indices changed, and absorption strongly enhanced;
* Cylinders replaced by a mixture of cones and segmented spheroids;
* Beam wavelength and alpha_i slightly changed.
* Detector x-axis skewed;
"""
import bornagain as ba
from bornagain import deg, nm
import numpy as np
mat_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0)
mat_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8)
mat_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8)
# nominal material constants are (6e-6, 2e-8) and (6e-4, 2e-8)
mat_substrate = ba.HomogeneousMaterial("Substrate", 6.3e-6, 4e-7)
mat_particle = ba.HomogeneousMaterial("Particle", 5.8e-4, 2e-7)
def get_sample(params):
cylinder_height = params["cylinder_height"]
cylinder_radius = params["cylinder_radius"]
h = params["cylinder_height"]
r = params["cylinder_radius"]
ff1 = ba.FormFactorCone(1.1*r, h, 80*deg)
ff2 = ba.FormFactorTruncatedSpheroid(r, 3.3*h, 2.5*h/r, 2.2*h)
ff = ba.FormFactorCylinder(cylinder_radius, cylinder_height)
cylinder = ba.Particle(mat_particle, ff)
layout = ba.ParticleLayout()
layout.addParticle(cylinder)
layout.addParticle(ba.Particle(mat_particle, ff1), .4)
layout.addParticle(ba.Particle(mat_particle, ff2), .6)
layer_1 = ba.Layer(mat_vacuum)
layer_1.addLayout(layout)
......@@ -33,12 +41,17 @@ def get_sample(params):
def get_simulation(params):
beam = ba.Beam(10**params['lg(intensity)'], 0.1*nm,
ba.Direction(0.2*deg, 0))
det = ba.SphericalDetector(100, -1.5*deg, 1.5*deg, 100, 0, 3*deg)
# nominal beam parameters are 0.1*nm, 0.2*deg
beam = ba.Beam(10**params['lg(intensity)'], 0.0993*nm,
ba.Direction(0.202*deg, 0))
# nominal detector x-axis starts from -1.5*deg
det = ba.SphericalDetector(100, -1.49*deg, 1.5*deg, 100, 0, 3*deg)
sample = get_sample(params)
simulation = ba.GISASSimulation(beam, sample, det)
if 'lg(background)' in params:
simulation.setBackground(
ba.ConstantBackground(10**params['lg(background)']))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment