In real experiments, the $q_z$ resolution is non infinite. To take this into account in TOF simulations,
one needs to define the spread in $q$ as $dq$, set up a distribution with a given number of samples, n_samples,
and define the desired sigma factor, n_sig (e.g. the range in standard deviations to take into account
during the sample generation).
#!/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_samplesdefget_sample():returnstd_samples.alternating_layers()defget_simulation(sample):"""
Defines and returns specular simulation
with a qz-defined beam
"""n=bp.simargs['n']qzs=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__':bp.parse_args(sim_n=500)sample=get_sample()simulation=get_simulation(sample)result=simulation.simulate()bp.plot_simulation_result(result)