pysrw.wavefronts.Wavefront#

class pysrw.wavefronts.Wavefront(observer, wavelength)[source]#

Bases: SRWLWfr

__init__(observer, wavelength)[source]#

Class to represent the spatial distribution of the radiation field.

Parameters:
  • observer – an observation mesh instance of Observer.

  • wavelength – the observation wavelength in nanometer.

Methods

__init__(observer, wavelength)

Class to represent the spatial distribution of the radiation field.

addE(_wfr[, _meth])

Add Another Electric Field Wavefront :param _wfr: wavefront to be added :param _meth: method of adding the wavefront _wfr: 0- simple addition assuming _wfr to have same mesh as this wavefront 1- add using bilinear interpolation (taking into account meshes of the two wavefronts) 2- add using bi-quadratic interpolation (taking into account meshes of the two wavefronts) 3- add using bi-cubic interpolation (taking into account meshes of the two wavefronts)

allocate(_ne, _nx, _ny[, _EXNeeded, ...])

Allocate Electric Field data :param _ne: number of points vs photon energy / time :param _nx: number of points vs horizontal position / angle :param _ny: number of points vs vertical position / angle :param _EXNeeded: switch specifying whether Ex data is necessary or not (1 or 0) :param _EYNeeded: switch specifying whether Ey data is necessary or not (1 or 0) :param _typeE: numerical type of Electric Field data: float (single precision) or double ('f' or 'd'); double is not yet supported :param _backupNeeded: switch specifying whether backup of Electric Field data (arExAux, arEyAux) should be created or not (1 or 0)

calc_stokes(_stokes[, _n_stokes_comp, ...])

Calculate Stokes parameters from Electric Field

copy_comp(_stokes)

Copy compenents of Electric Field to Stokes structure

delE([_type, _treatEX, _treatEY])

Delete Electric Field data :param _type: type of data to be deleted: 0- arEx, arEy, arExAux, arEyAux; 1- arEx, arEy only; 2- arExAux, arEyAux only :param _treatEX: switch specifying whether Ex data should be deleted or not (1 or 0) :param _treatEY: switch specifying whether Ey data should be deleted or not (1 or 0)

getWfrField()

Extract the array of each field component from the wavefront.

getWfrFieldMat()

Extract the matrix of each field component from the wavefront.

getWfrI([pol, practicalUnits])

Compute the optical of the selected polarization component.

getWfrPhase([pol])

Extract the phase of wavefront.

replaceWfrFieldWithFieldMat(ExR, ExI, EyR, EyI)

Replace the field of this wavefront with the passed matrices.

sim_src_offset(_dx, _dxp, _dy, _dyp[, ...])

Simulate offset of the wavefront source in horizontal / vertical position and/or angle (version using opt.

getWfrField()[source]#

Extract the array of each field component from the wavefront. Use getWfrFieldMat() if you want to extract the field components as two-dimensional matrices.

Returns:

list of Re{Ex}, Im{Ex}, Re{Ey}, Re{Ey} components of the field as arrays.

Return type:

list

getWfrFieldMat()[source]#

Extract the matrix of each field component from the wavefront.

Returns:

list of Re{Ex}, Im{Ex}, Re{Ey}, Re{Ey} components of the field as two-dimensional matrices.

Return type:

list

getWfrI(pol='TOT', practicalUnits=True)[source]#

Compute the optical of the selected polarization component.

Parameters:
  • pol (optional) – one of the POL polarization states or an angle in degrees for any arbitrary linear polarization. Defaults to “TOT”.

  • practicalUnits (optional) – if True, the intensity is computed in ph/(s mm^2 nm) otherwise the default ph/(s mm^2 0.1%BW) are used. Defaults to True.

Returns:

a dictionary containing the two coordinate axes as long as the matrix of the intensity data.

Return type:

dict

getWfrPhase(pol='H')[source]#

Extract the phase of wavefront.

Parameters:

pol (optional) – the ‘H’ or ‘V’ polarization component. Defaults to “H”.

Returns:

an intensity-like dictionary with the phase as ‘data’.

Return type:

dict

replaceWfrFieldWithFieldMat(ExR, ExI, EyR, EyI)[source]#

Replace the field of this wavefront with the passed matrices. The shape of the passed matrices must be consistent with the current mesh of the wavefront.

Parameters:
  • ExR – matrix of the real-horizontal field component.

  • ExI – matrix of the imaginary-horizontal field component.

  • EyR – matrix of the real-vertical field component.

  • EyI – matrix of the imaginary-vertical field component.