# Data Acquisition System Based on the Bluesky Suite in the Shanghai Synchrotron Radiation Facility
## 2 Materials and Methods
### Control and Data Acquisition Software  
The control and data acquisition software of BL07U is developed based on the above architecture. Because of the design concepts of Bluesky suite and EPICS, using the above architecture as a base allows for building a versatile data acquisition system. The data acquisition system in BL07U consists of six types of working modules, which are the time scan module, the normal energy scan module, the segmented energy scan module, the monochromator and Elliptically Polarizing Undulator (EPU) 58 linkage module, the monochromator and EPU90 linkage module, and a plotting module. The data acquisition system has the capability of running different irradiation experiments simultaneously. Figure 3 shows the software flow of all scan modules. Figure 4 shows the GUI software and a live visualization result. For the time scan module, users set the energy value and monitor the X-ray photon flux in real time. For the normal scan module, users set the starting and ending energy points and the dwell time, and run the function scripts by clicking the START button. For the segmented scan module, users can use different scan precision in different energy ranges. For the monochromator and EPU linkage module, users set the energy parameters,  
Figure 2: The BL07U control and data acquisition architecture. and the function scripts automatically calculate the corresponding gap value. By combining energy and gap, the quality of absorption spectrum measurement can be improved. The linkage module consists of linkage with EPU58 and EPU90. The linkage with EPU58 is suitable for the measuring of elements with large energy absorption edge, while the image with EPU90 is suitable for the measuring of elements with small energy absorption edge. For the plot module, users can use the saved data to reproduce spectra in one experiment or compare spectra in multiple experiments. Figure 5 shows the plot module interface. With the plot module, users can select XAS results in different experiments, and click the Plot button. The Python program can automatically read and compare data, so as to quickly and intuitively determine whether the samples have XMCD or XMLD signals. Figure 3: The software flow of four energy scan modules. For all scan modules, experiments can be run unattended, automatically suspending and resuming if needed. The data (live) are exported in.cvs format and saved on the experimental computer. During all the experiments, the data are available for online visualization and processing. The development of BL07U software focuses on the use of the SIS3820 and the monochromator. EPICS offers two modules for SIS3820 control: _mca_[33] and _std_[34]. Drivers of the _mca_ and _std_ modules are both written to support the use of the SIS3820 as a multichannel scaler. Both modules offer 32 records corresponding to 32 channels of SIS3820. There are additional records to control the start-and-stop acquisition of the device, and control the dwell time and channel-advance source. The channel-advance source is used to tell the hardware whether to advance the current channel according to its internal clock, or  
Figure 4: The Graphical User Interface based on CSS and live visualization. Figure 5: The plot module interface. in response to an external channel-advance signal. The main difference between the two modules is the data storage method during the experiment. The _std_ module provides a variable for each channel that is used to update the real-time data. Meanwhile, the _mca_ module provides an array for each channel that is updated to store real-time data. After comprehensive consideration of live visualization and the ability given by _mca_ and _std_, we decided whether to use _std_ or _mca_ module at control layer. Table 3 shows the configurations for these five scan modules. The time scan module adopted the _mca_ module at control layer and adopted the array-friendly CSS to realize live visualization.