pysrw.lib.srwlib.SRWLStokes#

class pysrw.lib.srwlib.SRWLStokes(_arS=None, _typeStokes='f', _eStart=0, _eFin=0, _ne=0, _xStart=0, _xFin=0, _nx=0, _yStart=0, _yFin=0, _ny=0, _mutual=0, _n_comp=4, _itStFin=None)[source]#

Bases: object

Radiation Stokes Parameters

__init__(_arS=None, _typeStokes='f', _eStart=0, _eFin=0, _ne=0, _xStart=0, _xFin=0, _nx=0, _yStart=0, _yFin=0, _ny=0, _mutual=0, _n_comp=4, _itStFin=None)[source]#
Parameters:
  • _arS – flat C-aligned array of all Stokes components (outmost loop over Stokes parameter number); NOTE: only ‘f’ (float) is supported for the moment (Jan. 2012)

  • _typeStokes – numerical type: ‘f’ (float) or ‘d’ (double, not supported yet)

  • _eStart – initial value of photon energy (/time)

  • _eFin – final value of photon energy (/time)

  • _ne – numbers of points vs photon energy

  • _xStart – initial value of horizontal position

  • _xFin – final value of photon horizontal position

  • _nx – numbers of points vs horizontal position

  • _yStart – initial value of vertical position

  • _yFin – final value of vertical position

  • _ny – numbers of points vs vertical position

  • _mutual – switch specifying that mutual Stokes components should be or are defined (2*_n_comp*(_ne*_nx*_ny_)^2 values)

  • _n_comp – number of Stoke components (1 to 4)

  • _itStFin – pair of start and end index values of general conjugated coordinate (for partial allocation of Mutual Intensity)

Methods

__init__([_arS, _typeStokes, _eStart, ...])

param _arS:

flat C-aligned array of all Stokes components (outmost loop over Stokes parameter number); NOTE: only 'f' (float) is supported for the moment (Jan. 2012)

add_stokes(_st[, _n_comp, _mult, _meth])

Add Another Stokes structure :param _st: Stokes structure to be added :param _n_comp: number of components to treat :param _mult: multiplier :param _meth: method of adding the Stokes structure _st: 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[, _typeStokes, ...])

avg_update_interp(_more_stokes, _iter, _ord)

Update this Stokes data structure with new data, contained in the _more_stokes structure, calculated on a different 2D mesh, so that it would represent estimation of average of (_iter + 1) structures :param _more_stokes: Stokes data structure to "add" to the estimation of average :param _iter: number of Stokes structures already "added" previously :param _ord: order of 2D interpolation to use (1- bilinear, ..., 3- bi-cubic) :param _n_stokes_comp: number of Stokes components to treat (1 to 4) :param _mult: optional multiplier of the _more_stokes

avg_update_interp_mutual(_more_stokes, _iter)

Update this Stokes data structure with new data, contained in the _more_stokes structure, calculated on a different 2D mesh, so that it would represent estimation of average of (_iter + 1) structures :param _more_stokes: Stokes data structure to "add" to the estimation of average :param _iter: number of Stokes structures already "added" previously :param _n_stokes_comp: number of Stokes components to treat (1 to 4) :param _mult: optional multiplier of the _more_stokes

avg_update_same_mesh(_more_stokes, _iter[, ...])

Update this Stokes data structure with new data, contained in the _more_stokes structure, calculated on the same mesh, so that this structure would represent estimation of average of (_iter + 1) structures :param _more_stokes: Stokes data structure to "add" to the estimation of average :param _iter: number of Stokes structures already "added" previously :param _n_stokes_comp: number of Stokes components to treat (1 to 4) :param _mult: optional multiplier of the _more_stokes

to_deg_coh([_rel_zer_tol, _rot])

Calculates / "extracts" Degree of Coherence from the Mutual Intensity (first Stokes component, s0) :param _rel_zer_tol: relative zero tolerance to use at normalizing (dividing) by the intensity :param _rot: rotate or not the degree of coherence data :return: 1D array with (C-aligned) resulting degree of coherence data

to_int([_pol])

Calculates / "extracts" intensity at a given polarization from the Stokes components :param _pol: polarization component to extract: 0- Linear Horizontal; 1- Linear Vertical; 2- Linear 45 degrees; 3- Linear 135 degrees; 4- Circular Right; 5- Circular Left; 6- Total :return: 1D array with (C-aligned) resulting intensity data

add_stokes(_st, _n_comp=4, _mult=1, _meth=0)[source]#

Add Another Stokes structure :param _st: Stokes structure to be added :param _n_comp: number of components to treat :param _mult: multiplier :param _meth: method of adding the Stokes structure _st: 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)

avg_update_interp(_more_stokes, _iter, _ord, _n_stokes_comp=4, _mult=1.0, _sum=False)[source]#

Update this Stokes data structure with new data, contained in the _more_stokes structure, calculated on a different 2D mesh, so that it would represent estimation of average of (_iter + 1) structures :param _more_stokes: Stokes data structure to “add” to the estimation of average :param _iter: number of Stokes structures already “added” previously :param _ord: order of 2D interpolation to use (1- bilinear, …, 3- bi-cubic) :param _n_stokes_comp: number of Stokes components to treat (1 to 4) :param _mult: optional multiplier of the _more_stokes

avg_update_interp_mutual(_more_stokes, _iter, _n_stokes_comp=4, _mult=1.0, _sum=False)[source]#

Update this Stokes data structure with new data, contained in the _more_stokes structure, calculated on a different 2D mesh, so that it would represent estimation of average of (_iter + 1) structures :param _more_stokes: Stokes data structure to “add” to the estimation of average :param _iter: number of Stokes structures already “added” previously :param _n_stokes_comp: number of Stokes components to treat (1 to 4) :param _mult: optional multiplier of the _more_stokes

avg_update_same_mesh(_more_stokes, _iter, _n_stokes_comp=4, _mult=1.0, _sum=False)[source]#

Update this Stokes data structure with new data, contained in the _more_stokes structure, calculated on the same mesh, so that this structure would represent estimation of average of (_iter + 1) structures :param _more_stokes: Stokes data structure to “add” to the estimation of average :param _iter: number of Stokes structures already “added” previously :param _n_stokes_comp: number of Stokes components to treat (1 to 4) :param _mult: optional multiplier of the _more_stokes

to_deg_coh(_rel_zer_tol=0.0001, _rot=True)[source]#

Calculates / “extracts” Degree of Coherence from the Mutual Intensity (first Stokes component, s0) :param _rel_zer_tol: relative zero tolerance to use at normalizing (dividing) by the intensity :param _rot: rotate or not the degree of coherence data :return: 1D array with (C-aligned) resulting degree of coherence data

to_int(_pol=6)[source]#

Calculates / “extracts” intensity at a given polarization from the Stokes components :param _pol: polarization component to extract:

0- Linear Horizontal; 1- Linear Vertical; 2- Linear 45 degrees; 3- Linear 135 degrees; 4- Circular Right; 5- Circular Left; 6- Total

Returns:

1D array with (C-aligned) resulting intensity data