MSPropagator#

class pyrost.multislice.MSPropagator(params, sample, num_threads=2, fx_arr=None, kernel=None, wf_inc=None, x_arr=None, z_arr=None, beam_profile=None, smp_profile=None)#

One-dimensional Multislice beam propagation class. Generates beam profile, that propagates through the sample using multislice approach.

Parameters
  • params (MSParams) – Experimental parameters.

  • sample (MLL) – Sample class, that generates the sample’s transmission profile.

  • num_threads (int) – Number of threads used in the calculations.

  • kwargs – Attributes specified in init_set.

Notes

Necessary attributes:

  • sample : Sample’s transmission profile generator.

  • num_threads : Number of threads used in the calculations.

  • params : Experimental parameters.

Optional attributes:

  • beam_profile : Beam profiles at each slice.

  • fx_arr : Spatial frequencies array [um^-1].

  • kernel : Diffraction kernel.

  • smp_profile : Sample’s transmission profile at each slice.

  • x_arr : Coordinates array in the transverse plane [um].

  • wf_inc : Wavefront at the entry surface.

  • z_arr : Coordinates array along the propagation axis [um].

beam_downstream(z_arr, step=None, return_coords=True, verbose=True, backend='fftw')#

Return the wavefront at distance z_arr downstream from the exit surface using Rayleigh-Sommerfeld convolution.

Parameters
  • z_arr (ndarray) – Array of distances [um].

  • step (Optional[float]) – Sampling interval of the downstream coordinate array [um]. Equals to the sampling interval at the exit surface if it’s None.

  • return_coords (bool) – Return the coordinates array of the downstream plane.

  • verbose (bool) – Set verbosity of the computation process.

  • backend (str) – Choose between numpy (‘numpy’) or FFTW (‘fftw’) library for the FFT implementation.

Raises

AttributeError – If beam_profile has not been generated. Call MSPropagator.beam_propagate() to generate.

Return type

Tuple[ndarray, ndarray]

Returns

A tuple of two elements (‘wavefronts’, ‘x_arr’). The elements are the following:

  • wavefronts : Set of wavefronts calculated at the distance z_arr downstream from the exit surface.

  • x_arr : Array of coordinates at the plane downstream [um]. Only if return_coords is True.

beam_propagate(verbose=True)#

Perform the multislice beam propagation. The results are written to beam_profile attribute. Generates smp_profile attribute if it wasn’t initialized before.

Parameters

verbose (bool) – Set verbosity of the computation process.

Return type

None

generate_sample(verbose=True)#

Generate the transmission profile of the sample. The results are written to smp_profile attribute.

Parameters

verbose (bool) – Set verbosity of the computation process.

Return type

None

property size: int#

Number of points in a single slice.

Return type

int

update_inc_wavefront(wf_inc)#

Return a new MSPropagator object with the updated wf_inc.

Parameters

wf_inc (ndarray) – Wavefront at the entry surface.

Return type

MSPropagator

Returns

A new MSPropagator object with the updated wf_inc.