## 3 Single-Particle Imaging with X-ray Lasers
### Detector and Data Analysis
Other open sources, such as condor [191], provided by Uppsala University can simulate speckle patterns, reconstructed images and evaluated resolution that based on photon energy, focusing beam spot size, sample type and detector, etc. These will help researchers design and optimize their experiments. The quantity of raw data of XFEL experiments makes it fall under the big data category. Raw data files contain electron and photon beams parameters on a shoit by shot basis, instrument settings and motor positions, diagnostics and DAQ information. How to extract useful information from the raw data efficiently is challenging. To provide a user-friendly solution, LCLS, European-XFEL and SACLA created their own DAQ systems [192]. At the LCLS, data analysis department developed psana module that a python-script interfaces could be used online (real-time) offline and parallelized over many machines [193]. This data analysis strategy makes SPI data analysis easier by using building blocks. Online data monitoring is also an important part of SPI experiments. To give an instant feedback from the SPI data collection, a Python-based software named _Hummgbird_ (Uppsala University, Uppsala, Sweden) [194] was developed. This gives the needed fast feedback for the particle injector and instruments alignment or optimization. Offline analysis of such big data sets is challenging. The LCLS data analysis department developed sposcake [195], a GUI program that makes SPI data analysis simple. The input of experiment name, run number and detector ID will make diffraction data visible. Different masks, different algorithms for hit finding and multiple types of pixel readout (gain corrected ADU, common mode corrected ADU, pedestal corrected ADU, raw ADU and photon counts) make diffraction patterns preliminary analysis (e.g., ADUs to photons, background subtraction, hit finding) powerful and effective. Apart from the shot-to-shot intensity variation, non-linear detector response, stray scattering from optics and injectors, sample heterogeneity and conformations mentioned above, multiple particle hits are also a challenge factor for offline data analysis. Significant progress has been made in classification algorithms by using diffusion maps [196]. Experimental data contains only intensities with no phase information. Diffusion map algorithms provide mathematical links to a cloud of points via the Laplace-Beltrami operator. Each point on a diffusion map represents a diffraction pattern as shown on Figure 9[197]. Single hit, multiple-particle hit, water diffraction, background and defects from the detector are captured in such mapping. Diffusion map approaches will fail in the limit of strong background and low SNR for small particles (e.g., MS2). For that situation, the classification can be conducted by hand. This is time-consuming and the precision will be non-reproducible for different operators. To solve this problem, automatic and supervised machine learning methods are being developed. The convolutional neural network is based on VGG16 net. For training, simulated data and experiments data are both used. Further study is still needed but this represents a promising future approach. After classification, orientation determination and phase retrieval are needed. The commonly used methods are generative topographic mapping (GTM) [198], expectation maximization compression (EMC) [199; 200], correlation maximization [201], manifold [202; 203] and angular correlation methods [204]. The current method of choice for orientation determination is EMC. The EMC algorithm is implemented in _Dragonfly_[205], which is a powerful python-script program. Figure 10 shows a 3D diffraction volume after orientation determination and assembly [206]. The associated 3D real-space image is reconstructed by error-reduction (ER) method. Many other phase retrieval algorithms could be used, such as hybrid-input-output (HIO), Guided-hybrid-input-output (GHIO), relaxed averaged alternating reflections (RAAR) and difference map (DM).