Welcome to pysingfel’s documentation!

This is a python implementation of singfel.

Get Start

Theory

Scattering at Tree Level

Interaction between X-ray photons and electrons can be described with classical electrodynamics with a very high degree of precision. Traditionally, it’s described classically too. But it turns out that with (QFT) quantum field theory, the formulas involved can be derived within several lines. So I decided to derive the fomulas with QED (quantum electrodynamics).

One of the most important quantities in QFT is the cross section, or the differential cross section which is defined in the following way:

d\sigma = \frac{\text{Number of particles detected per second}}{\text{Intensty of incident particles} } d\Omega

The integration of d\sigma is the total cross section of the particle.

According to QFT, the differential cross section can be generally expressed as

d\sigma = |<\phi_{in}| \phi_{out}>|^2

where \phi_{in} and \phi_{out} respectively represent the incident and scattered wavefunction of the incident particle flow. This formula is of course not an invention of quantum field theory. In regular quantum mechanics, the same formula holds perfectly. The reason that I resort to quantum field theory is to explain the polarization correction. I should point out that there is also clear classical explain of the origin of the polarization correction. I’ll include them in newer editions.

The price of nicer explanation of the polarization correction is a more abstract definition of the quantum states. Without loss of generality, one can assume that the incident beam is of the same wavelength. Since the emission position and the detector position are very far from the interaction position, it can be safely assumed that the incident and detected states are free states generated by the free particle generators on free vacuum. This in turn defines the normalization of the quantum state.

\text{Particle number per pulse} = \int_{\Delta t} \int_{R^3}|<\phi_{in}| \phi_{in}>|

Photons are bosons and have no charge. Thus no particle number conservation law will constrain its particle number. Nevertheless, in free space, the above definition is valid.

Because we only consider

Modules

Example

Purpose of this package

psana is a relatively comprehensive package used in LCLS to fetch and analyze experiment data. It would be great if one can do simulation in a way compatible with psana. This package is create with this intention: to do single particle experiment simulation in the same style as we analyze the data.

This package is written with python 2 and is only tested in python 2 environment. Currently there is no plan to create a python 3 version. Even though I have not tested this package in python 3, I’m pretty sure it’s not going to work.

Another thing worth mentioning is that: Zhaoyou Wang has also implemented a pysingfel which has already been incoperated into simex platform for which this package is created. So a little history is required to clarify this situation.

A little history

There are mainly three people involved in this project, pysingfel, Chun Hong Yoon, Zhaoyou Wang and me. Chun Hong Yoon is the author of the C++ version, singfel. Before I took over this project, Zhaoyou Wang, as a rotating graduate student, translated singfel into python which is the original pysingfel. pysingfel is mostly compatible with singfel since it’s a translation. It works perfectly well (There are errors. But the error is exactly what singfel would have produced.). My version is not since new requirement appears: to be compatible with psana style. So when you try to use this version, you need to pay attention to this documentation.