pysrw.lib.srwlib#
Functions
|
Setup Transmission type Optical Element which simulates Compound Refractive Lens (CRL) :param _foc_plane: plane of focusing: 1- horizontal, 2- vertical, 3- both :param _delta: refractive index decrement (can be one number of array vs photon energy) :param _atten_len: attenuation length [m] (can be one number of array vs photon energy) :param _shape: 1- parabolic, 2- circular (spherical) :param _apert_h: horizontal aperture size [m] :param _apert_v: vertical aperture size [m] :param _r_min: radius (on tip of parabola for parabolic shape) [m] :param _n: number of lenses (/"holes") :param _wall_thick: min. |
|
Setup Transmission type Optical Element which simulates a mask array for at-wavelength metrology. |
|
Setup Transmission type Optical Element which simulates a Harmann sensor, i.e. mask array/matrix for at-wavelength metrology. |
|
Setup Transmission type Optical Element which simulates a set of Gaussian-shape "Bumps" randomly placed in transverse plane :param _ampl: amplitude of bumps [m] or list of min. |
|
Setup Transmission type Optical Element which simulates Cylindrical Fiber :param _foc_plane: plane of focusing: 1- horizontal (i.e. fiber is parallel to vertical axis), 2- vertical (i.e. fiber is parallel to horizontal axis) :param _delta_ext: refractive index decrement of external layer :param _delta_core: refractive index decrement of core :param _atten_len_ext: attenuation length [m] of external layer :param _atten_len_core: attenuation length [m] of core :param _diam_ext: diameter [m] of external layer :param _diam_core: diameter [m] of core :param _xc: horizontal coordinate of center [m] :param _yc: vertical coordinate of center [m] :return: transmission (SRWLOptT) type optical element which simulates Cylindrical Fiber. |
|
Setup Transmission type Optical Element similar to the one simulating CRL, but with arbitrary optical path in material over hor. |
|
Setup Transmission type Optical Element which simulates a mask array for at-wavelength metrology. |
|
Setup Transmission type Optical Element which simulates trapethoidal shape etched mask (requested by K. |
|
Setup Transmission type optical element with 1D (mirror or grating) surface Heght Profile data :param _height_prof_data: two- or one-column table containing, in case of two columns: longitudinal position in [m] (1st column) and the Height Profile in [m] (2nd column) data; in case of one column, it contains the Height Profile data :param _dim: orientation of the reflection (deflection) plane; can be 'x' or 'y' :param _ang: grazing angle (between input optical axis and mirror/grating plane) :param _ang_r: reflection angle (between output optical axis and mirror/grating plane) :param _amp_coef: height profile "amplification coefficient" :param _ar_arg_long: optional array of longitudinal position (along mirror/grating) in [m]; if _ar_arg_long is not None, any longitudinal position contained in _height_prof_data is ignored :param _nx: optional number of points in horizontal dimension of the output transmission optical element :param _ny: optional number of points in vertical dimension of the output transmission optical element :param _size_x: optional horizontal transverse size of the output transmission optical element (if <=0: _height_prof_data, _dim, _ar_arg_long, _ar_arg_tr data is used) :param _size_y: optional vertical transverse size of the output transmission optical element (if <=0: _height_prof_data, _dim, _ar_arg_long, _ar_arg_tr data is used) :param _xc: optional horizontal center position of the output transmission optical element :param _yc: optional vertical center position of the output transmission optical element :return: transmission (SRWLOptT) type optical element which simulates the effect of surface height error |
|
Setup Transmission type optical element with 1D (mirror or grating) surface Heght Profile data :param _height_prof_data: two- or one-column table containing, in case of two columns: longitudinal position in [m] (1st column) and the Height Profile in [m] (2nd column) data; in case of one column, it contains the Height Profile data :param _dim: orientation of the reflection (deflection) plane; can be 'x' or 'y' :param _ang: grazing angle (between input optical axis and mirror/grating plane) :param _ang_r: reflection angle (between output optical axis and mirror/grating plane) :param _amp_coef: height profile "amplification coefficient" :param _ar_arg_long: optional array of longitudinal position (along mirror/grating) in [m]; if _ar_arg_long is not None, any longitudinal position contained in _height_prof_data is ignored :param _nx: optional number of points in horizontal dimension of the output transmission optical element :param _ny: optional number of points in vertical dimension of the output transmission optical element :param _size_x: optional horizontal transverse size of the output transmission optical element (if <=0: _height_prof_data, _dim, _ar_arg_long, _ar_arg_tr data is used) :param _size_y: optional vertical transverse size of the output transmission optical element (if <=0: _height_prof_data, _dim, _ar_arg_long, _ar_arg_tr data is used) :param _xc: optional horizontal center position of the output transmission optical element :param _yc: optional vertical center position of the output transmission optical element :return: transmission (SRWLOptT) type optical element which simulates the effect of surface height error |
|
Setup Transmission type optical element with 2D (mirror or grating) surface Heght Profile data :param _height_prof_data: a matrix (2D array) containing the Height Profile data in [m]; if _ar_height_prof_x is None and _ar_height_prof_y is None: the first column in _height_prof_data is assumed to be the "longitudinal" position [m] and first row the "transverse" position [m], and _height_prof_data[0][0] is not used; otherwise the "longitudinal" and "transverse" positions on the surface are assumed to be given by _ar_height_prof_x, _ar_height_prof_y :param _dim: orientation of the reflection (deflection) plane; can be 'x' or 'y' :param _ang: grazing angle (between input optical axis and mirror/grating plane) :param _ang_r: reflection angle (between output optical axis and mirror/grating plane) :param _amp_coef: height profile "amplification coefficient" :param _ar_arg_long: optional array of longitudinal position (along mirror/grating) in [m] :param _ar_arg_tr: optional array of transverse position on mirror/grating surface in [m] :param _nx: optional number of points in horizontal dimension of the output transmission optical element :param _ny: optional number of points in vertical dimension of the output transmission optical element :param _size_x: optional horizontal transverse size of the output transmission optical element (if <=0: _height_prof_data, _dim, _ar_arg_long, _ar_arg_tr data is used) :param _size_y: optional vertical transverse size of the output transmission optical element (if <=0: _height_prof_data, _dim, _ar_arg_long, _ar_arg_tr data is used) :return: transmission (SRWLOptT) type optical element which simulates the effect of surface height error |
|
Setup Transmission type Optical Element simulating transition region cutting transverse plane into two half-planes with constant refraction / absorption properties :param _delta1: refractive index decrement of one part of the area :param _atten_len1: attenuation length of one part of the area :param _delta2: refractive index decrement of the other part of the area :param _atten_len2: attenuation length of the other part of the area :param _thick: thickness of the transmission element [m] :param _rx: horizontal coordiate range of the transmission element [m] :param _ry: vertical coordiate range of the transmission element [m] :param _w: width of transition region between two areas [m] :param _tr_typ: type of the transition: 1- linear, 2- . |
|
Under Development!!! Setup Contained of Transmission type Optical Elements and Drift Spaces simulating tilted thick Zone Plate :param _zp: Zone Plate object (of type SRWLOptZP) :param _ang_tilt: tilt angle of the ZP [rad] :param _ang_ax: angle [rad] from horizontal axis defining orientation of ZP rotation / tilt axis (i.e. if it is equal to pi/2 zp is assumed to be rotated about vertical axis in the horizontal plane) :param _n_slices: number of "slices" in longitudinal direction to be used to represent the tilted "thick" Zone Plate :param _e_start: initial photon energy [eV] :param _e_fin: final photon energy [eV] :param _nx: number of points vs horizontal position to represent the transmission element :param _ny: number of points vs vertical position to represent the transmission element :return: optical element container (of type SRWLOptC) with Transmission optical elements (of type SRWLOptT) separated by drift spaces (of type SRWLOptD). |
|
|
|
|
|
|
|
Photon Energy <-> Wavelength conversion :param _x: value to be converted :param _in_u: input unit :param _out_u: output unit :return: value in the output units |
Check if process is Master (in parallel processing sense) |
|
|
Generate coordinates of ponts randomly filling 3D volume limited by two arbitrary curves (defining base) and two surfaces :param _np: number of random points in rectangular parallelepiped to try :param _x_min: min. |
|
Auxiliary function to read-in data comumns from ASCII file (2D table) :param _file_path: full path (including file name) to the file :param _str_sep: column separation symbol(s) (string) :param _i_col_start: initial data column to read :param _i_col_end: final data column to read :param _n_line_skip: number of lines to skip in the beginning of the file :return: 2D list containing data columns read |
|
|
|
|
|
|
|
|
|
Reads-in Wavefront data file (with a number of wavefronts, calculated in the same mesh vs x nad y) :param _file_path: string specifying path do data file to be loaded :param _gen0s: switch defining whether zero-electric field array(s) need to be created if some polarization component(s) are missing in the file :return: list of wavefronts (objects of SRWLWfr type) |
|
|
|
|
|
|
|
|
The function to save .log and .json status files to monitor parallel MPI jobs progress. |
|
Initialize parameters for the SRW status files and generate the files. |
|
|
|
|
Save CMD data (with a number of fully-coherent wavefronts, calculated in the same mesh vs x nad y) to a file :param _arE: 2D array of complex electric field data of the coherent modes :param _awfr: wavefront () of mesh :param _file_path: string specifying path do data file to be loaded |
|
Auxiliary function to write tabulated data (columns, i.e 2D table) to ASCII file :param _file_path: full path (including file name) to the file to be (over-)written :param _cols: array of data columns to be saves to file :param _str_sep: column separation symbol(s) (string) :param _str_head: header (string) to write before data columns :param _i_col_start: initial data column to write :param _i_col_end: final data column to write |
|
Perform Coherent Mode Decomposition (CMD) of (4D) Cross-Spectral Density / Mutual Intensity data. |
|
|
|
Calculate Stokes Parameters of Emitted (and Propagated, if beamline is defined) Partially-Coherent SR. :param _e_beam: Finite-Emittance e-beam (SRWLPartBeam type) :param _mag: Magnetic Field container (magFldCnt type) or Coherent Gaussian beam (SRWLGsnBm type) or Point Source (SRWLPtSrc type) or list of Coherent Modes (of SRWLWfr type each) :param _mesh: mesh vs photon energy, horizontal and vertical positions (SRWLRadMesh type) on which initial SR should be calculated :param _sr_meth: SR Electric Field calculation method to be used: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler" :param _sr_rel_prec: relative precision for SR Electric Field calculation (usually 0.01 is OK, the smaller the more accurate) :param _n_part_tot: total number of "macro-electrons" to be used in the calculation :param _n_part_avg_proc: number of "macro-electrons" to be used in calculation at each "slave" before sending Stokes data to "master" (effective if the calculation is run via MPI) :param _n_save_per: periodicity of saving intermediate average Stokes data to file by master process :param _file_path: path to file for saving intermediate average Stokes data by master process :param _sr_samp_fact: oversampling factor for calculating of initial wavefront for subsequent propagation (effective if >0) :param _opt_bl: optical beamline (container) to propagate the radiation through (SRWLOptC type) :param _pres_ang: switch specifying presentation of the resulting Stokes parameters: coordinate (0) or angular (1) or both (2, to implement !!!) :param _char: radiation characteristic to calculate: 0- Total Intensity, i.e. Flux per Unit Surface Area (s0); 1- Four Stokes components of Flux per Unit Surface Area; 2- Mutual Intensity Cut (2D) vs X; 3- Mutual Intensity Cut (2D) vs Y; 4- Mutual Intensity and Degree of Coherence Cuts (2D) vs X & Y; 5- Degree of Coherence Cuts (2D) vs X & Y; 6- Mutual Intensity / Cross-Spectral Density (4D) vs X & Y; 61- Coherent Modes (array of 2D distributions of Electric Field vs X & Y) and Mutual Intensity / Cross-Spectral Density (4D) vs X & Y it is based on; 7- Coherent Modes (array of 2D distributions of Electric Field vs X & Y); 10- Flux 11- Four Stokes components of Flux (?) 20- Electric Field (sum of fields from all macro-electrons, assuming CSR) 40- Total Intensity, i.e. Flux per Unit Surface Area (s0), Mutual Intensity and Degree of Coherence Cuts vs X & Y; 41- Total Intensity, i.e. Flux per Unit Surface Area (s0) and Degree of Coherence Cuts vs X & Y; :param _x0: horizontal center position for mutual intensity calculation :param _y0: vertical center position for mutual intensity calculation :param _e_ph_integ: integration over photon energy is required (1) or not (0); if the integration is required, the limits are taken from _mesh :param _rand_meth: method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator 2- Halton sequences 3- LPtau sequences (to be implemented) :param _tryToUseMPI: switch specifying whether MPI should be attempted to be used :param _wr: initial wavefront radius [m] to assume at wavefront propagation (is taken into account if != 0) :param _wre: initial wavefront radius error [m] to assume at wavefront propagation (is taken into account if != 0) :param _det: detector object for post-processing of final intensity (instance of SRWLDet) :param _me_approx: approximation to be used at multi-electron integration: 0- none (i.e. do standard M-C integration over 5D phase space volume of e-beam), 1- integrate numerically only over e-beam energy spread and use convolution to treat transverse emittance :param _file_bkp: create or not backup files with resulting multi-electron radiation characteristics :param _rand_opt: randomize parameters of optical elements at each fully-coherent wavefront propagation (e.g. to simulate impact of vibrations) or not :param _file_form: format of output files ('ascii' / 'asc' and 'hdf5' supported) :param _n_mpi: number of independent "groups" of MPI processes (for 4D CSD calculation) :param _n_cm: number of coherent modes to calculate (is taken into account if _char==61 or _char==7) :param _ms: index of the first wavefront / coherent mode to start computation :param _del_aux_files: delete (or not) auxiliary files (applies to different types of calculations). |
|
Generate standard filenames for radiation characteristics from a given core name :param _fn_core: core filename :param _type: type of radiation characteristic: 0- Electric Field 1- Spectral Intensity, i.e. Spectral Flux per Unit Surface Area 2- Spectral Angular Intensity, i.e. Spectral Flux per Unit Solid Angle 3- Mutual Intensity (in real space, i.e. dependent on coordinates) 31- Mutual Intensity Cut vs X 32- Mutual Intensity Cut vs Y 4- Degree of Coherence 41- Degree of Coherence Cut vs X 42- Degree of Coherence Cut vs Y 5- Wigner Distribution / Brightness 51- Wigner Distribution / Brightness Cut vs X 52- Wigner Distribution / Brightness Cut vs Y 7- Coherent Modes :param _form: format of data file ('ascii' and 'hdf5' or 'h5' are supported). |
|
Check / change file extension, depending on requested file format and type of calculation :param _fp: filename (/path) :param _form: required file format, can be: 'ascii' or 'ASCII' or 'asc' or 'ASC' for ASCII format 'hdf5' or 'HDF5' or 'h5' or 'H5' for HDF5 format :param _char: radiation characteristic to be calculated (one of values supported by the srwl_wfr_emit_prop_multi_e function) :return: updated / checked filename |
|
Setup Coherent Wavefront from Intensity (assuming spherical or asigmatic wave): note this is an error-prone procedure :param _ar_int: input intensity array :param _mesh: mesh vs photon energy, horizontal and vertical positions (SRWLRadMesh type) on which initial SR should be calculated :param _part_beam: Finite-Emittance beam (SRWLPartBeam type) :param _Rx: horizontal wavefront radius [m] :param _Ry: vertical wavefront radius [m] :param _xc: horizontal wavefront center position [m] :param _yc: vertical wavefront center position [m] |
|
Propagates wavefront over free space in a number of steps and generates intensity distributions vs (z,x) and (z,y) and possibly (z,x,y) :param _wfr: input/output wavefront :param _dz: longitudinal step size for the drifts :param _nz: number of drift steps to be made :param _pp: list of propagation parameters to be used for each drift step :param _do3d: generate intensity vs (z,x,y) in addition to the cuts (z,x) and (z,y) :param _nx: number of points vs horizontal position (is taken into account if >0) :param _ny: number of points vs vertical position (is taken into account if >0) :param _rx: number of points vs horizontal position (is taken into account if >0) :param _ry: number of points vs vertical position(is taken into account if >0) :param _xc: horizontal position for vertical cut of intensity :param _yc: vertical position for horizontal cut of intensity :param _pol: switch specifying polarization component to be extracted: =0 -Linear Horizontal; =1 -Linear Vertical; =2 -Linear 45 degrees; =3 -Linear 135 degrees; =4 -Circular Right; =5 -Circular Left; =6 -Total :param _type: switch specifying "type" of a characteristic to be extracted: =0 -"Single-Electron" Intensity; =1 -"Multi-Electron" Intensity; =2 -"Single-Electron" Flux; =3 -"Multi-Electron" Flux; =4 -"Single-Electron" Radiation Phase; =5 -Re(E): Real part of Single-Electron Electric Field; =6 -Im(E): Imaginary part of Single-Electron Electric Field; =7 -"Single-Electron" Intensity, integrated over Time or Photon Energy (i.e. Fluence) :param _ord_interp: interpolation order for final intensity calc. :return resulting intensity distributions. |
Classes
|
Detector of Radiation |
|
(Coherent) Gaussian (Radiation) Beam |
|
Kick Matrix (for fast trajectory calculation) |
Magnetic Field (base class) |
|
|
Magnetic Field: Arbitrary 3D |
|
Magnetic Field: Container |
|
Magnetic Field: Undulator Harmonic |
|
Magnetic Field: Multipole Magnet |
|
Magnetic Field: Solenoid |
|
Magnetic Field: Undulator |
|
Optical Element (base class) |
|
Optical Element: Aperture / Obstacle |
|
Optical Element: Angle |
|
Optical Element: Container |
|
Optical Element: Ideal Crystal |
|
Optical Element: Drift Space |
|
Optical Element: Grating |
|
Optical Element: Thin Lens |
Optical Element: Mirror (focusing) |
|
|
Optical Element: Mirror: Elliptical NOTE: in the Local frame of the Mirror tangential direction is X, saggital Y, mirror normal is along Z |
|
Optical Element: Mirror: Paraboloid NOTE: in the Local frame of the Mirror tangential direction is X, saggital Y, mirror normal is along Z |
|
Optical Element: Mirror: Plane |
|
Optical Element: Mirror: Spherical |
|
Optical Element: Mirror: Toroid NOTE: in the Local frame of the Mirror tangential direction is X, saggital Y, mirror normal is along Z |
|
Optical Element: Shirt |
|
Optical Element: Transmission (generic) |
|
Optical Element: Waveguide |
|
Optical Element: Thin Lens |
|
Particle Beam |
|
Charged Particle |
|
Charged Particle Trajectory |
|
Point Source (emitting coherent spherical wave) |
|
Radiation Mesh (Sampling) |
|
Radiation Stokes Parameters |
|
Radiation Wavefront (Electric Field) |