Background is applied before the specular simulation is normalized, so the threshold value will also be divided by the probe beam intensity.
Intensity image
The script below shows how to add a constant background in the context of a GISAXS simulation of an air-substrate bilayer with cylindrical particles embedded.
#!/usr/bin/env python3"""
Cylinder form factor in DWBA with constant background
"""importbornagainasbafrombornagainimportba_plotasbp,deg,nmdefget_sample():frombornagainimportstd_samplesreturnstd_samples.cylinders()defget_simulation(sample):beam=ba.Beam(1e6,0.1*nm,0.2*deg)detector=ba.SphericalDetector(100,2*deg,1*deg,1*deg)simulation=ba.ScatteringSimulation(beam,sample,detector)background=ba.ConstantBackground(1e3)simulation.setBackground(background)returnsimulationif__name__=='__main__':sample=get_sample()simulation=get_simulation(sample)result=simulation.simulate()bp.plot_simulation_result(result)