Welcome to simS2E’s documentation!!!¶
[ Documentation is under construction ]
Contents:
Getting started¶

Setting up Sphinx for documenting start-to-end simulation¶
You need clone the start-to-end repository from GitHub:
git clone https://github.com/chuckie82/start-to-end.git
The index.rst is the master ReST for your project.
You may already have sphinx sphinx installed – you can check by doing:
python -c 'import sphinx'
If that fails grab the latest version of and install it with:
> sudo easy_install -U Sphinx
Let’s see if we can build our html:
make html
If you now point your browser to _build/html/index.html, you should see the site.
To update the document on the web, just push your changes:
git add *.rst
git commit -m "Update all documents"
git push -u origin master

Installing your start-to-end package¶
More instructions to come...

FEL source simulation¶
Introduction¶
Documentation for FEL source simulation can be found on this page.
Data access¶
Data in archive can be exported using web browser. Initial FEL source can be downloaded from here:
with authentication (xfel/desy account)
If you use this dataset, please acknowledge [SALDIN99].
[SALDIN99] |
|
Output data description¶
The output data is expected in hdf5 format, and the glossary can be found below. FEL source module is responsible for writing out in the format specified below.
FELsource_out_<7 digit ID>.h5 (Output HDF glossary)¶
Field name | Description | Data type | Units |
---|---|---|---|
data/ | |||
data/arrEhor | Complex EM field written in 4D array, horizontal polarization | Float | |
data/arrEver | Complex EM field written in 4D array, vertical polarization | Float | |
params/ | Parameters for wavefront propagation | ||
params/Mesh/nSlices | Numbers of points vs photon energy/time for the pulse | Int | |
params/Mesh/nx | Numbers of points, horizontal | Int | |
params/Mesh/ny | Numbers of points, vertical | Int | |
params/Mesh/sliceMax | Max value of time [s] or energy [ev] for pulse (fragment) | Float | s or ev |
params/Mesh/sliceMin | Min value of time [s] or energy [ev] for pulse (fragment) | Float | s or ev |
params/Mesh/xMax | Maximum of horizontal range | Float | m |
params/Mesh/xMin | Minimum of horizontal range | Float | m |
params/Mesh/yMax | Maximum of vertical range | Float | m |
params/Mesh/yMin | Minimum of vertical range | Float | m |
params/Mesh/zCoord | Longitudinal position, for FEL output data - length of active undulator | m | |
params/Rx | Instantaneous horizontal wavefront radius | Float | m |
params/Ry | Instantaneous vertical wavefront radius | Float | m |
params/dRx | Error of wavefront horizontal radius | Float | m |
params/dRy | Error of wavefront vertical radius | Float | m |
params/nval | complex electric field nval==2 | Int | |
params/photonEnergy | Average photon energy | Float | ev |
params/wDomain | Wavefront in time or frequency (photon energy) domain | String | |
params/wEFieldUnit | Electric field units, {sqrt(W/mm^2) (time domain), arbitrary} | String | |
params/wFloatType | Electric field numerical type | String | |
params/wSpace | R-space or Q-space wavefront presentation | String | |
params/xCentre | Horizontal transverse coordinates of wavefront instant ‘source center’ | Float | m |
params/yCentre | Vertical transverse coordinates of wavefront instant ‘source center’ | Float | m |
history/parent/info/ | Information about input data | ||
history/parent/info/ contact | Contact Information | String | |
history/parent/info/ data_description | Description of FEL data | String | |
history/parent/info/ method_description | Method description | String | |
history/parent/info/ package_version | Package version | String | |
misc/ | Complimentary information | ||
history/parent/misc/ FAST2XY.DAT | FELsource_params_FAST2XY.txt used for post-processing FAST output | String | |
history/parent/misc/ angular_distribution | radial distribution of far field divergence | Float | |
history/parent/misc/ spot_size | near field transverse FEL beam size (FWHM) | Float | |
history/parent/misc/ gain_curve | gain curve, dependence of FEL pulse energy (column 2) from number of working point (column 0) and active undulator length z[cm] (column 1) | Float | |
history/parent/misc/nzc | number of working point defines active undulator length | Int | |
history/parent/misc/ temporal_struct | FEL pulse temporal structure, instantaneous power P(tau) | Float | |
version | hdf5 format version | Float | 0.1 |
Diagnostic (diagnostic_felsrc.py)¶
Fig.1. Pulse irradiance XY map (number of photons per pixel), the title contains size of the pixel;
Fig.2. Pulse time structure, the title contains the pulse energy value.

Propagation, including optics¶
Input data description¶
The input data is expected in hdf5 format, and the glossary can be found in the link below.
prop_out_<7 digit ID>.h5 (Output HDF glossary)¶
Field name | Description | Data type | Units |
---|---|---|---|
data/ | |||
data/arrEhor | Complex EM field written in 4D array, horizontal polarization | Float | |
data/arrEver | Complex EM field written in 4D array, vertical polarization | Float | |
params/ | Parameters for wavefront propagation | ||
params/Mesh/nSlices | Numbers of points vs photon energy/time for the pulse | Int | |
params/Mesh/nx | Numbers of points, horizontal | Int | |
params/Mesh/ny | Numbers of points, vertical | Int | |
params/Mesh/qxMax | Maximum of horizontal frequency (If params/wSpace is Q-space) | 1/m | |
params/Mesh/qxMin | Minimum of horizontal frequency (If params/wSpace is Q-space) | 1/m | |
params/Mesh/qyMax | Maximum of vertical frequency (If params/wSpace is Q-space) | 1/m | |
params/Mesh/qyMin | Minimum of vertical frequency (If params/wSpace is Q-space) | 1/m | |
params/Mesh/sliceMax | Max value of time [s] or energy [ev] for pulse (fragment) | Float | s or ev |
params/Mesh/sliceMin | Min value of time [s] or energy [ev] for pulse (fragment) | Float | s or ev |
params/Mesh/xMax | Maximum of horizontal range (If params/wSpace is R-space) | Float | m |
params/xMin | Minimum of horizontal range (If params/wSpace is R-space) | Float | m |
params/yMax | Maximum of vertical range (If params/wSpace is R-space) | Float | m |
params/yMin | Minimum of vertical range (If params/wSpace is R-space) | Float | m |
params/zCoord | Longitudinal position, for FEL output data - length of active undulator | Float | m |
params/beamline/printout | (add description) | ||
params/Rx | Instantaneous horizontal wavefront radius | Float | m |
params/Ry | Instantaneous vertical wavefront radius | Float | m |
params/dRx | Error of wavefront horizontal radius | Float | m |
params/dRy | Error of wavefront horizontal radius | Float | m |
params/nval | complex electric field nval==2 | Int | |
params/photonEnergy | Average photon energy | Float | ev |
params/wDomain | Wavefront in time or frequency (photon energy) domain | String | |
params/wEFieldUnit | Electric field units, sqrt(Phot/s/0.1%BW/mm^2), sqrt(W/mm^2) for time domain, sqrt(J/eV/mm^2) for frequency domain arbitrary | String | |
params/wFloatType | Electric field numerical type | String | |
params/wSpace | R-space or Q-space wavefront presentation | String | |
params/xCentre | Horizontal transverse coordinates of wavefront instant ‘source center’ | Float | m |
params/yCentre | Vertical transverse coordinates of wavefront instant ‘source center’ | Float | m |
info/ | |||
info/package_version | Package version | ||
info/contact | Contact details of author | ||
info/data_description | Short description of what the data is | ||
info/method_description | Short description of what method was used to generate the data | ||
history | Information about input data | ||
misc/ | Complimentary information | ||
misc/xFWHM | FWHM belong x-axis | Float | m |
misc/yFWHM | FWHM belong y-axis | Float | m |
version | hdf5 format version | Float | 0.1 |
Diagnostic (diagnostic.py)¶
Fig.1. Pulse irradiance XY map (number of photons per pixel), the title contains size of the pixel;
Fig.2. Plot of pulse time structure before and after propagating, the title contains the propagated pulse energy value.
About WPG¶
WPG, WaveProperGator is an interactive simulation framework for coherent X-ray wavefront propagation. WPG provides intuitive interface to the SRW library. The application examples oriented on European XFEL design parameters.

Photon Matter Interaction¶
Input/Output data description¶
The input/output data is expected in hdf5 format, and the glossary can be found below. Photon matter interaction module is responsible for reading in and writing out in the format specified below.
pmi_out_<7 digit ID>.h5 (Output HDF glossary)¶
Field name | Description | Data type | Units |
---|---|---|---|
data/ | |||
data/snp_<7 digit index>/ff | Atomic form factor in 2D array (number of unique ions x length of atomFormFactorQ) | Float | |
data/snp_<7 digit index>/halfQ | Reciprocal space spanned by the atomic form factor in 1D array (number of samples of reciprocal q) | Float | 1/Å |
data/snp_<7 digit index>/Nph | Numbers of photons in the beam | Int | ph |
data/snp_<7 digit index>/r | Atomic position in real space in 2D array (number of ions x 3D coordinates {x,y,z}) | Float | |
data/snp_<7 digit index>/T | List of unique ID numbers given to each atomFormFactor in 1D array (number of unique ions) | Int | |
data/snp_<7 digit index>/Z | List of atomType present at atomPosition in 1D array (number of ions x number of frames) | Int | |
data/snp_<7 digit index>/xyz | List of indices of ff for each atom in Z | Int | |
data/snp_<7 digit index>/Sq_halfQ | Reciprocal space spanned by the Compton scattering in 1D array (number of samples of reciprocal q) | Float | 1/Å |
data/snp_<7 digit index>/Sq_bound | Compton scattering by bound electrons in 1D array (length of Sq_Q) | Float | |
data/snp_<7 digit index>/Sq_free | Compton scattering by free electrons in 1D array (length of Sq_Q) | Float | |
history | Information about input data | ||
history/parent/detail | Details of the parent inclusing /data, /info, /misc, /params | ||
history/parent/parent | Iteratively list parent modules | ||
info/ | |||
info/package_version | Package version | ||
info/contact | Contact details of author | ||
info/data_description | Short description of what the data is | ||
info/method_description | Short description of what method was used to generate the data | ||
misc/ | Miscellaneous information | ||
params/ | Parameters used to run the module | ||
version | hdf5 format version | Float | 0.1 |
Python script for HDF¶

Coherent Diffraction¶
Input/Output data description¶
The input/output data is expected in hdf5 format, and the glossary can be found below. Coherent diffraction module is responsible for reading in and writing out in the format specified below.
diffr_params_SingFEL (Input Parameter glossary)¶
Field name | Description | DataType |
---|---|---|
–input_dir | Input directory where pmi_out files are stored | String |
–output_dir | Output directory where diffr_out files will be stored | String |
–config_file | Full path and filename of this file | String |
-b | Experimental beam file | String |
-g | Experimental geometry file | String |
–uniformRotation | Rotations are selected uniformly in given rotation space | Int |
–calculateCompton | Calculate Compton scattering in diffraction pattern | Int |
–sliceInterval | Interval to calculates diffraction | Int |
–numSlices | Number of time slices to use for calculating diffraction | Int |
–pmiStartID | Start ID of PMI trajectory | Int |
–pmiEndID | End ID of PMI trajectory | Int |
–dpID | Diffraction pattern index for current pmiID | Int |
–numDP | Number of diffraction patterns to generate per pmiID | Int |
–USE_GPU | Options to use GPU (1) or not (0) | Int |
version | SingFEL version | 0.1 |
diffr_out_<7 digit ID>.h5 (Output HDF glossary)¶
Field name | Description | Data type | Units |
---|---|---|---|
data/ | |||
data/data | Diffraction pattern in 2D matrix | | Float | |
data/diffr | Diffracted intensity before Poisson noise (Optional) | Float | |
data/angle | Additional rotation applied to the rotated pmi_out position. Initial rotation angle can be found in pmi_out/data/angle. Active right handed rotations applied in quaternion. | Float | |
history/ | Information about input data | ||
history/parent/detail | Details of the parent including /data, /info, /misc, /params /data should be soft-linked with a relative path | ||
history/parent/parent | Iteratively list parent modules | ||
info/ | Information | ||
info/package_version | Package name and version | String | |
info/contact | Contact details of author | String | |
info/data_description | Short description of what the data is | String | |
info/method_description | Short description of what method was used to generate the data | String | |
misc/ | Miscellaneous information | ||
params/ | Parameters used for coherent diffraction | ||
params/geom/detectorDist | Detector distance from point of interaction | Float | m |
params/geom/pixelWidth | Pixel width | Float | m |
params/geom/pixelHeight | Pixel height | Float | m |
params/geom/mask | Mask of a diffraction pattern to indicate | Int | |
pixel ON (1) or OFF (0) in 2D array | |||
params/beam/photonEnergy | Photon energy | Float | eV |
params/beam/photons | Number of photons in the beam | Int | ph |
params/beam/focusArea | Beam focus area | Float | |
params/info | Input for Coherent diffraction program | String | |
version | hdf5 format version | Float | 0.1 |
Diagnostic¶
Python script displays /data/data and /data/diffr at completion of the module execution.
Scaling behaviour of SingFEL¶
Calculation time using single processor vs number of atoms is non-linear, perhaps quadratic.
Detector number of pixels: 131x131
Benzoic acid: 15 atoms Chignolin: 2484 atoms 2YBE: 3240 atoms 2NIP: 4735 atoms 4AS4: 4963 atoms


Orientation Determination¶
Input/Output data description¶
Test
The input/output data is expected in hdf5 format, and the glossary can be found below. Orientation determination module is responsible for reading in and writing out in the format specified below.
orient_out_<7 digit ID>.h5 (Output HDF glossary)¶
Field name | Description | Data type | Units |
---|---|---|---|
data/ | |||
data/data | Diffraction volume in 3D array (dimX x dimY x dimZ) | Float | |
data/angle | Most likely orientation | Float | |
data/center | center of diffraction volume x,y,z | Int | pixels |
params/ | Parameters used for coherent diffraction | ||
params/info | Input for orientation determination program and version | String | |
history/ | Information about input data | ||
info/ | Information | ||
misc/ | Miscellaneous information | ||
version | hdf5 format version | Float | 0.1 |

Phasing¶
Input/Output data description¶
The input/output data is expected in hdf5 format, and the glossary can be found below. Phasing module is responsible for reading in and writing out in the format specified below.
phase_out_<7 digit ID>.h5 (Output HDF glossary)¶
Field name | Description | Data type | Units |
---|---|---|---|
data/ | |||
data/electronDensity | Recovered electron density volume in 3D array (dimX x dimY x dimZ) | Float | |
params/ | |||
params/info | Input for phasing program and version | String | |
history/ | Information about input data | ||
info/ | Information | ||
misc/ | Miscellaneous information | ||
version | hdf5 format version | Float | 0.1 |
