pysrw.lib.srwlib.SRWLOptG#

class pysrw.lib.srwlib.SRWLOptG(_mirSub, _m=1, _grDen=100, _grDen1=0, _grDen2=0, _grDen3=0, _grDen4=0, _grAng=0, _e_avg=0, _cff=None, _ang_graz=0, _ang_roll=0)[source]#

Bases: SRWLOpt

Optical Element: Grating

__init__(_mirSub, _m=1, _grDen=100, _grDen1=0, _grDen2=0, _grDen3=0, _grDen4=0, _grAng=0, _e_avg=0, _cff=None, _ang_graz=0, _ang_roll=0)[source]#
Parameters:
  • _mirSub – SRWLOptMir (or derived) type object defining substrate of the grating

  • _m – output (diffraction) order

  • _grDen – groove density [lines/mm] (coefficient a0 in the polynomial groove density: a0 + a1*y + a2*y^2 + a3*y^3 + a4*y^4)

  • _grDen1 – groove density polynomial coefficient a1 [lines/mm^2]

  • _grDen2 – groove density polynomial coefficient a2 [lines/mm^3]

  • _grDen3 – groove density polynomial coefficient a3 [lines/mm^4]

  • _grDen4 – groove density polynomial coefficient a4 [lines/mm^5]

  • _grAng – angle between the grove direction and the saggital direction of the substrate [rad] (by default, groves are made along saggital direction (_grAng=0))

  • _e_avg – average photon energy [eV] the grating should be aligned for (is taken into account if > 0)

  • _cff – PGM cff parameter, i.e. cos(beta)/cos(alpha); it will be taken into account if _e_avg != 0

  • _ang_graz – grazing incidence angle [rad] the grating should be aligned for; it will be taken into account if _e_avg != 0 and _cff is None

  • _ang_roll – roll angle [rad] (i.e. angle of diffraction plane angle rotation about incident beam axis) the grating should be alligned for: it is taken into account when _e_avg != 0; _ang_roll = 0 corresponds to the vertical beam deflection; pi/2 to the horizontal deflection; any value in between is allowed

Methods

__init__(_mirSub[, _m, _grDen, _grDen1, ...])

param _mirSub:

SRWLOptMir (or derived) type object defining substrate of the grating

ang2cff(_en, _ang_graz)

Calculates Grating grazing angle and deflection angle from photon energy and PGM parameters :param _en: radiation photon energy [eV] :param _ang_graz: grazing incidence angle [rad] the grating should be aligned for; it will be taken into account if _e_avg != 0 and _cff is None :return: PGM cff parameter, i.e. cos(beta)/cos(alpha) and deflection angle.

angcff2en(_cff, _ang_graz)

Calculates Grating grazing angle and deflection angle from photon energy and PGM parameters :param _cff: PGM cff parameter, i.e. cos(beta)/cos(alpha)_en: radiation photon energy [eV] :param _ang_graz: grazing incidence angle [rad] the grating should be aligned for; it will be taken into account if _e_avg != 0 and _cff is None :return: radiation photon energy [eV] and deflection angle.

cff2ang(_en, _cff)

Calculates Grating grazing angle and deflection angle from photon energy and PGM parameters :param _en: radiation photon energy [eV] :param _cff: PGM cff parameter, i.e. cos(beta)/cos(alpha) :return: grating grazing angle and deflection angle (NOTE: PGM mirror grazing angle aquals to half deflection angle).

find_orient(_en[, _cff, _ang_graz, _ang_roll])

Finds optimal crystal orientation in the input beam frame (i.e. surface normal and tangential vectors) and the orientation of the output beam frame (i.e. coordinates of the longitudinal and horizontal vectors in the input beam frame) :param _en: photon energy [eV] :param _cff: PGM cff parameter, i.e. cos(beta)/cos(alpha); it will be taken into account if _e_avg != 0; if _cff is not None, it dominates over _ang_graz (i.e. it forces its recalculation) :param _ang_graz: grazing incidence angle [rad] the grating should be aligned for; it will be taken into account if _e_avg != 0 and _cff is None :param _ang_roll: roll angle [rad] (i.e. angle of diffraction plane angle rotation about incident beam axis) the grating should be alligned for: it is taken into account when _e_avg != 0; _ang_roll = 0 corresponds to the vertical beam deflection; pi/2 to the horizontal deflection; any value in between is allowed.

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_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]

ang2cff(_en, _ang_graz)[source]#

Calculates Grating grazing angle and deflection angle from photon energy and PGM parameters :param _en: radiation photon energy [eV] :param _ang_graz: grazing incidence angle [rad] the grating should be aligned for; it will be taken into account if _e_avg != 0 and _cff is None :return: PGM cff parameter, i.e. cos(beta)/cos(alpha) and deflection angle

angcff2en(_cff, _ang_graz)[source]#

Calculates Grating grazing angle and deflection angle from photon energy and PGM parameters :param _cff: PGM cff parameter, i.e. cos(beta)/cos(alpha)_en: radiation photon energy [eV] :param _ang_graz: grazing incidence angle [rad] the grating should be aligned for; it will be taken into account if _e_avg != 0 and _cff is None :return: radiation photon energy [eV] and deflection angle

cff2ang(_en, _cff)[source]#

Calculates Grating grazing angle and deflection angle from photon energy and PGM parameters :param _en: radiation photon energy [eV] :param _cff: PGM cff parameter, i.e. cos(beta)/cos(alpha) :return: grating grazing angle and deflection angle (NOTE: PGM mirror grazing angle aquals to half deflection angle)

find_orient(_en, _cff=None, _ang_graz=0, _ang_roll=0)[source]#

Finds optimal crystal orientation in the input beam frame (i.e. surface normal and tangential vectors) and the orientation of the output beam frame (i.e. coordinates of the longitudinal and horizontal vectors in the input beam frame) :param _en: photon energy [eV] :param _cff: PGM cff parameter, i.e. cos(beta)/cos(alpha); it will be taken into account if _e_avg != 0; if _cff is not None, it dominates over _ang_graz (i.e. it forces its recalculation) :param _ang_graz: grazing incidence angle [rad] the grating should be aligned for; it will be taken into account if _e_avg != 0 and _cff is None :param _ang_roll: roll angle [rad] (i.e. angle of diffraction plane angle rotation about incident beam axis) the grating should be alligned for: it is taken into account when _e_avg != 0; _ang_roll = 0 corresponds to the vertical beam deflection; pi/2 to the horizontal deflection; any value in between is allowed

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]