Core Classes#
The following classes are central to pyrost.simulation module:
pyrost.simulation.STSim
accepts a set of simulation parameters frompyrost.simulation.STParams
and performs the wavefront propagation of an X-ray beam from the lens plane to the detector to generate a speckle tracking dataset.pyrost.simulation.STConverter
takes the generated data frompyrost.simulation.STSim
and a CXI protocolpyrost.CXIProtocol
to transfer the data to a data containerpyrost.STData
or to save it to a CXI file.
pyrost.simulation.STSim
does the heavy lifting of calculating the wavefront
propagation to the detector plane. pyrost.simulation.STConverter
exports
simulated data to a CXI format file accordingly to
the provided pyrost.CXIProtocol
object and saves the protocol and experimental
parameters to the same folder.
Examples
Perform the simulation for a given pyrost.simulation.STParams
object
params with pyrost.simulation.STSim
. Then generate a stack frames with
pyrost.simulation.STSim.frames()
, and save the simulated data to a
CXI file using the default protocol as follows:
>>> import pyrost.simulation as st_sim
>>> params = st_sim.STParams.import_default()
>>> sim_obj = st_sim.STSim(params)
>>> data = sim_obj.frames()
>>> st_conv = st_sim.STConverter()
>>> st_conv.save_sim(data, sim_obj, 'test')