pysrw.lib.srwlib.SRWLOptMir#

class pysrw.lib.srwlib.SRWLOptMir[source]#

Bases: SRWLOpt

Optical Element: Mirror (focusing)

__init__()#

Methods

__init__()

get_orient([_e])

randomize()

Randomizes parameters of optical element according to self.RandParam to simulate e.g. impact of vibrations on coherence (in P-C calculations).

set_all([_size_tang, _size_sag, _ap_shape, ...])

param _size_tang:

size in tangential direction [m]

set_dim_sim_meth([_size_tang, _size_sag, ...])

Sets Mirror Dimensions, Aperture Shape and its simulation method :param _size_tang: size in tangential direction [m] :param _size_sag: size in sagital direction [m] :param _ap_shape: shape of aperture in local frame ('r' for rectangular, 'e' for elliptical) :param _sim_meth: simulation method (1 for "thin" approximation, 2 for "thick" approximation) :param _npt: number of mesh points to represent mirror in tangential direction (used for "thin" approximation) :param _nps: number of mesh points to represent mirror in sagital direction (used for "thin" approximation) :param _treat_in_out: switch specifying how to treat input and output wavefront before and after the main propagation through the optical element: 0- assume that the input wavefront is defined in the plane before the optical element, and the output wavefront is required in a plane just after the element; 1- assume that the input wavefront is defined in the plane at the optical element center and the output wavefront is also required at the element center; 2- assume that the input wavefront is defined in the plane at the optical element center and the output wavefront is also required at the element center; however, before the propagation though the optical element, the wavefront should be propagated through a drift back to a plane just before the optical element, then a special propagator will bring the wavefront to a plane at the optical element exit, and after this the wavefront will be propagated through a drift back to the element center; :param _ext_in: optical element extent on the input side, i.e. distance between the input plane and the optical center (positive, in [m]) to be used at wavefront propagation manipulations; if 0, this extent will be calculated internally from optical element parameters :param _ext_out: optical element extent on the output side, i.e. distance between the optical center and the output plane (positive, in [m]) to be used at wavefront propagation manipulations; if 0, this extent will be calculated internally from optical element parameters.

set_orient([_nvx, _nvy, _nvz, _tvx, _tvy, ...])

Defines Mirror Orientation in the frame of the incident photon beam :param _nvx: horizontal coordinate of central normal vector :param _nvy: vertical coordinate of central normal vector :param _nvz: longitudinal coordinate of central normal vector :param _tvx: horizontal coordinate of central tangential vector :param _tvy: vertical coordinate of central tangential vector :param _x: horizontal position of mirror center [m] :param _y: vertical position of mirror center [m]

set_rand_par(_rand_par)

Sets list of params to be eventually randomized in some types of calculations :param _rand_par: list of params to be randomized; each element of this list should be: ['param_name', val_avg, val_range, meth]

set_reflect([_refl, _n_ph_en, _n_ang, ...])

Sets Mirror Reflectivity :param _refl: reflectivity coefficient to set (can be one number or C-aligned flat array complex array vs photon energy vs grazing angle vs component (sigma, pi)) :param _n_ph_en: number of photon energy values for which the reflectivity coefficient is specified :param _n_ang: number of grazing angle values for which the reflectivity coefficient is specified :param _n_comp: number of electric field components for which the reflectivity coefficient is specified (can be 1 or 2) :param _ph_en_start: initial photon energy value for which the reflectivity coefficient is specified :param _ph_en_fin: final photon energy value for which the reflectivity coefficient is specified :param _ph_en_scale_type: photon energy sampling type ('lin' for linear, 'log' for logarithmic) :param _ang_start: initial grazing angle value for which the reflectivity coefficient is specified :param _ang_fin: final grazing angle value for which the reflectivity coefficient is specified :param _ang_scale_type: angle sampling type ('lin' for linear, 'log' for logarithmic)

set_all(_size_tang=1, _size_sag=1, _ap_shape='r', _sim_meth=2, _npt=100, _nps=100, _treat_in_out=1, _ext_in=0, _ext_out=0, _nvx=0, _nvy=0, _nvz=-1, _tvx=1, _tvy=0, _x=0, _y=0, _refl=1, _n_ph_en=1, _n_ang=1, _n_comp=1, _ph_en_start=1000.0, _ph_en_fin=1000.0, _ph_en_scale_type='lin', _ang_start=0, _ang_fin=0, _ang_scale_type='lin')[source]#
Parameters:
  • _size_tang – size in tangential direction [m]

  • _size_sag – size in sagital direction [m]

  • _ap_shape – shape of aperture in local frame (‘r’ for rectangular, ‘e’ for elliptical)

  • _sim_meth – simulation method (1 for “thin” approximation, 2 for “thick” approximation)

  • _treat_in_out – switch specifying how to treat input and output wavefront before and after the main propagation through the optical element: 0- assume that the input wavefront is defined in the plane before the optical element, and the output wavefront is required in a plane just after the element; 1- assume that the input wavefront is defined in the plane at the optical element center and the output wavefront is also required at the element center; 2- assume that the input wavefront is defined in the plane at the optical element center and the output wavefront is also required at the element center; however, before the propagation though the optical element, the wavefront should be propagated through a drift back to a plane just before the optical element, then a special propagator will bring the wavefront to a plane at the optical element exit, and after that the wavefront will be propagated through a drift back to the element center;

  • _ext_in – optical element extent on the input side, i.e. distance between the input plane and the optical center (positive, in [m]) to be used at wavefront propagation manipulations; if 0, this extent will be calculated internally from optical element parameters

  • _ext_out – optical element extent on the output side, i.e. distance between the optical center and the output plane (positive, in [m]) to be used at wavefront propagation manipulations; if 0, this extent will be calculated internally from optical element parameters

  • _nvx – horizontal coordinate of central normal vector

  • _nvy – vertical coordinate of central normal vector

  • _nvz – longitudinal coordinate of central normal vector

  • _tvx – horizontal coordinate of central tangential vector

  • _tvy – vertical coordinate of central tangential vector

  • _x – horizontal position of mirror center [m]

  • _y – vertical position of mirror center [m]

  • _refl – reflectivity coefficient to set (can be one number or C-aligned flat complex array vs photon energy vs grazing angle vs component (sigma, pi))

  • _n_ph_en – number of photon energy values for which the reflectivity coefficient is specified

  • _n_ang – number of grazing angle values for which the reflectivity coefficient is specified

  • _n_comp – number of electric field components for which the reflectivity coefficient is specified (can be 1 or 2)

  • _ph_en_start – initial photon energy value for which the reflectivity coefficient is specified

  • _ph_en_fin – final photon energy value for which the reflectivity coefficient is specified

  • _ph_en_scale_type – photon energy sampling type (‘lin’ for linear, ‘log’ for logarithmic)

  • _ang_start – initial grazing angle value for which the reflectivity coefficient is specified

  • _ang_fin – final grazing angle value for which the reflectivity coefficient is specified

  • _ang_scale_type – angle sampling type (‘lin’ for linear, ‘log’ for logarithmic)

set_dim_sim_meth(_size_tang=1, _size_sag=1, _ap_shape='r', _sim_meth=2, _npt=500, _nps=500, _treat_in_out=1, _ext_in=0, _ext_out=0)[source]#

Sets Mirror Dimensions, Aperture Shape and its simulation method :param _size_tang: size in tangential direction [m] :param _size_sag: size in sagital direction [m] :param _ap_shape: shape of aperture in local frame (‘r’ for rectangular, ‘e’ for elliptical) :param _sim_meth: simulation method (1 for “thin” approximation, 2 for “thick” approximation) :param _npt: number of mesh points to represent mirror in tangential direction (used for “thin” approximation) :param _nps: number of mesh points to represent mirror in sagital direction (used for “thin” approximation) :param _treat_in_out: switch specifying how to treat input and output wavefront before and after the main propagation through the optical element:

0- assume that the input wavefront is defined in the plane before the optical element, and the output wavefront is required in a plane just after the element; 1- assume that the input wavefront is defined in the plane at the optical element center and the output wavefront is also required at the element center; 2- assume that the input wavefront is defined in the plane at the optical element center and the output wavefront is also required at the element center; however, before the propagation though the optical element, the wavefront should be propagated through a drift back to a plane just before the optical element, then a special propagator will bring the wavefront to a plane at the optical element exit, and after this the wavefront will be propagated through a drift back to the element center;

Parameters:
  • _ext_in – optical element extent on the input side, i.e. distance between the input plane and the optical center (positive, in [m]) to be used at wavefront propagation manipulations; if 0, this extent will be calculated internally from optical element parameters

  • _ext_out – optical element extent on the output side, i.e. distance between the optical center and the output plane (positive, in [m]) to be used at wavefront propagation manipulations; if 0, this extent will be calculated internally from optical element parameters

set_orient(_nvx=0, _nvy=0, _nvz=-1, _tvx=1, _tvy=0, _x=0, _y=0)[source]#

Defines Mirror Orientation in the frame of the incident photon beam :param _nvx: horizontal coordinate of central normal vector :param _nvy: vertical coordinate of central normal vector :param _nvz: longitudinal coordinate of central normal vector :param _tvx: horizontal coordinate of central tangential vector :param _tvy: vertical coordinate of central tangential vector :param _x: horizontal position of mirror center [m] :param _y: vertical position of mirror center [m]

set_reflect(_refl=1, _n_ph_en=1, _n_ang=1, _n_comp=1, _ph_en_start=0, _ph_en_fin=0, _ph_en_scale_type='lin', _ang_start=0, _ang_fin=0, _ang_scale_type='lin')[source]#

Sets Mirror Reflectivity :param _refl: reflectivity coefficient to set (can be one number or C-aligned flat array complex array vs photon energy vs grazing angle vs component (sigma, pi)) :param _n_ph_en: number of photon energy values for which the reflectivity coefficient is specified :param _n_ang: number of grazing angle values for which the reflectivity coefficient is specified :param _n_comp: number of electric field components for which the reflectivity coefficient is specified (can be 1 or 2) :param _ph_en_start: initial photon energy value for which the reflectivity coefficient is specified :param _ph_en_fin: final photon energy value for which the reflectivity coefficient is specified :param _ph_en_scale_type: photon energy sampling type (‘lin’ for linear, ‘log’ for logarithmic) :param _ang_start: initial grazing angle value for which the reflectivity coefficient is specified :param _ang_fin: final grazing angle value for which the reflectivity coefficient is specified :param _ang_scale_type: angle sampling type (‘lin’ for linear, ‘log’ for logarithmic)