pysrw.lib.srwlib.SRWLMagFldU#

class pysrw.lib.srwlib.SRWLMagFldU(_arHarm=None, _per=0, _nPer=0)[source]#

Bases: SRWLMagFld

Magnetic Field: Undulator

__init__(_arHarm=None, _per=0, _nPer=0)[source]#
Parameters:
  • _arHarm – array of field harmonics

  • _per – period length [m]

  • _nPer – number of periods (will be rounded to integer)

Methods

E1_2_B(_e1[, _en_elec])

Estimate deflection parameter from :param _e1: fundamental photon energy [eV] :param _en_elec: electron energy [GeV] :return: magnetic field amplitude [T]

E1_2_K(_e1[, _en_elec])

Estimate deflection parameter from :param _e1: fundamental photon energy [eV] :param _en_elec: electron energy [GeV] :return: deflection parameter

K_2_B(K)

Convert K (deflection parameter) to B (magnetic field amplitude)

__init__([_arHarm, _per, _nPer])

param _arHarm:

array of field harmonics

allocate(_nHarm)

get_E1([_en_elec, _unit])

Estimate fundamental photon energy :param _en_elec: electron energy [GeV] :return: fundamental photon energy [eV]

get_K()

Estimate K (deflection parameter) value

set_sin([_per, _len, _bx, _by, _phx, _phy, ...])

Setup basic undulator with sinusoidal magnetic field :param _per: period length [m] :param _len: undulator length [m] :param _bx: horizontal magnetic field amplitude [m] :param _by: vertical magnetic field amplitude [m] :param _phx: initial phase of the horizontal magnetic field [rad] :param _phx: initial phase of the vertical magnetic field [rad] :param _sx: symmetry of the horizontal magnetic field vs longitudinal position 1 - symmetric (B ~ cos(2*Pi*n*z/per + ph)) , -1 - anti-symmetric (B ~ sin(2*Pi*n*z/per + ph)) :param _sy: symmetry of the vertical magnetic field vs longitudinal position

E1_2_B(_e1, _en_elec=3.0)[source]#

Estimate deflection parameter from :param _e1: fundamental photon energy [eV] :param _en_elec: electron energy [GeV] :return: magnetic field amplitude [T]

E1_2_K(_e1, _en_elec=3.0)[source]#

Estimate deflection parameter from :param _e1: fundamental photon energy [eV] :param _en_elec: electron energy [GeV] :return: deflection parameter

K_2_B(K)[source]#

Convert K (deflection parameter) to B (magnetic field amplitude)

get_E1(_en_elec=3.0, _unit='eV')[source]#

Estimate fundamental photon energy :param _en_elec: electron energy [GeV] :return: fundamental photon energy [eV]

get_K()[source]#

Estimate K (deflection parameter) value

set_sin(_per=0.02, _len=1, _bx=0, _by=0, _phx=0, _phy=0, _sx=1, _sy=1)[source]#

Setup basic undulator with sinusoidal magnetic field :param _per: period length [m] :param _len: undulator length [m] :param _bx: horizontal magnetic field amplitude [m] :param _by: vertical magnetic field amplitude [m] :param _phx: initial phase of the horizontal magnetic field [rad] :param _phx: initial phase of the vertical magnetic field [rad] :param _sx: symmetry of the horizontal magnetic field vs longitudinal position 1 - symmetric (B ~ cos(2*Pi*n*z/per + ph)) , -1 - anti-symmetric (B ~ sin(2*Pi*n*z/per + ph)) :param _sy: symmetry of the vertical magnetic field vs longitudinal position