wpg.wavefront module

This module contains base wrapper for SRWLWfr (Wavefront). It’s implement numpy inter operations to SRWLWfr structure, serialization to HDF5, visualization tools, etc.

class wpg.wavefront.Wavefront(srwl_wavefront=None)[source]

Bases: object

This is base class for manipulation with wavefronts in wpg module.

One of most important field is _srwl_wf (instance of srwlib.SRWLWfr). SEtting and getting this field allows to call all SRWLpy functions.

Create wavefront instance.

The most important wavefront fields dynamically initialize from wpg.glossry

Parameters:srwl_wavefront (srwlib.SRWLWfr) – if present, wavefront inits with it’s parameters
Returns:Wavefront instance.
get_imag_part(slice_number=None, polarization=None)[source]

Return imaginary part of wavefront.

Parameters:
  • polarization (string) – ‘total’ or ‘horizontal’ or ‘vertical’
  • slice_number (int or range) – slice number ti return, if None - get 3D array (all slices)
Returns:

array of imaginary parts

get_intensity(slice_number=None, polarization=None)[source]

Return intensity of wavefront

Parameters:
  • polarization (string) – ‘total’ or ‘horizontal’ or ‘vertical’
  • slice_number (int or range) – slice number ti return, if None - get 3D array (all slices)
Returns:

array of intensities

get_limits(axis='z')[source]

Get wavefront mesh limits [xmin, xmax, ….].

Used in 2D visualization tools (as pylab.imshow(wfr_data, extends=wrf.get_limits()))

Params axis:‘x’,’y’ or ‘z’
Returns:list of integers
get_phase(slice_number=None, polarization=None)[source]

Return phase of wavefront.

Parameters:
  • polarization (string) – ‘total’ or ‘horizontal’ or ‘vertical’
  • slice_number (int or range) – slice number ti return, if None - get 3D array (all slices)
Returns:

array of phases

get_real_part(slice_number=None, polarization=None)[source]

Return real part of wavefront.

Parameters:
  • polarization (string) – ‘total’ or ‘horizontal’ or ‘vertical’
  • slice_number (int or range) – slice number ti return, if None - get 3D array (all slices)
Returns:

array of real parts

load_hdf5(file_name)[source]

Load wavefront from HDF5 file.

Parameters:file_name (string) – output HDF5 file name
srw_info()[source]

Print self._srwl_wf string representation. Used for debugging.

Returns:string
store_hdf5(file_name)[source]

Store wavefront to HDF5 file (attributes and values).

Parameters:file_name (string) – output HDF5 file name