In the following reflectometry example, each scan point has a distribution of $q_z$ values.
The constructor
ba.DistributionGaussian(0.,1.,25,2.)
specifies a Gaussian distribution with mean 0, standard deviation 1,
25 sampling points, and a cut-off at 2 sigma. For other distributions (besides Gaussian),
see distributions.
take arrays qzs and dq as arguments. These arrays must have the same length n.
For each scan point (i=0,..,n-1), the $q_z$ values have a Gaussian distribution with
mean qzs[i] and dq[i].
#!/usr/bin/env python3"""
An example of defining reflectometry instrument
for time of flight experiment. In this example
we will use purely qz-defined beam,
without explicitly specifying
incident angle or a wavelength.
Additionally we will set pointwise resolution
to the scan.
Note that these approaches work with SLD-based
materials only.
"""importnumpyasnpimportbornagainasbafrombornagainimportba_plotasbp,std_samplesimportmatplotlib.pyplotaspltdefget_sample():returnstd_samples.alternating_layers()defget_simulation(sample):"Specular simulation with a qz-defined beam"n=500qzs=np.linspace(0.01,1,n)# qz-valuesdq=0.03*qzsdistr=ba.DistributionGaussian(0.,1.,25,2.)scan=ba.QzScan(qzs)scan.setVectorResolution(distr,dq)returnba.SpecularSimulation(scan,sample)if__name__=='__main__':sample=get_sample()simulation=get_simulation(sample)result=simulation.simulate()bp.plot_simulation_result(result)plt.show()