# Piston Error Measurement for Segmented Telescopes Based on a Hybrid Artificial Neural Network
## 3 Simulation
### Simulation on Two Sub-Mirrors Segmented Telescope System
The number of neurons in the hidden layer of the BP network was set as 10, the node transfer function of the hidden layer was logsig function, the node transfer function of the output layer was purelin function, and the learning training function was traindx, which is a variable learning rate momentum algorithm. The training results of the network are shown in Figure 11. Figure 11a shows the loss function changing with the number of iterations and Figure 11b provides the error distribution between the expected value and the actual network output value in the form of a histogram. According to the training results, the RMSE between the expected value and the actual output of the network in the training set, the verification set, and the test set are 2.235 \(\times\) 10\({}^{-5}\)\(\upmu\)m, 2.734 \(\times\) 10\({}^{-5}\)\(\upmu\)m, and 1.873 \(\times\) 10\({}^{-5}\)\(\upmu\)m, respectively. It was proved that the BP neural network proposed here can be used to calculate the absolute value of piston error with high precision. Figure 10: The piston error signs prediction accuracy for the four Resnet models. Figure 9: The loss function curves of the four Resnet models: (**a**) Training data set; (**b**) validation data sets. After the hybrid network is well trained, the actual network performance can be tested. Here, another 500 new focal plane images were generated from the simulation optical system for testing. In order to approximate the actual imaging environment, Gaussian distribution noise with a mean of 0 and a variance of 0.05 was introduced into the simulated _PSF_ images. Furthermore, since tip-tilt errors cannot be completely corrected, the tip-tilt errors were also added to each sub-mirror during the generation of the focal plane degradation image, where the total RMSE value of the added tip-tilt errors was 0.01 \(\lambda\). Since we only considered the co-phase errors like Keck where all sub-mirrors were assumed to have the same shape and be perfect without high-order aberrations except pistons and tip-tilts, higher order aberrations of each sub-mirror were not considered here. Figure 12 shows 30 groups of the experiment results randomly selected from the whole 500 groups. The piston error detection accuracy was given by the difference between the measured piston error and the set piston error. According to the error analysis, the RMSE of the difference values of the 30 experimental results is 1.26 nm where the RMSE is defined as \(RMSE=\sqrt{\frac{1}{N}\sum\limits_{n=1}^{N}Difference_{n}^{2}}\); \(N\) is the number of experiment groups. Figure 13 shows the piston error detection results of all the 500 groups of simulation experiments, among which the difference in the detection results within 494 groups is 10 nm, and the RMSE of the 494 groups is 1.76 nm. The left 6 groups of difference values of the piston error detection results are very large, far greater than the mean difference values of the 494 groups of piston error detection results. This is because the signs of piston errors were predicted wrongly by the Resnet network, and the measurement error was basically twice of the set piston error. Figure 13a shows the piston error measurement results of all the 500 groups of simulation experiments, Figure 13b shows the measurement errors of these 494 groups in the form of a scatter plot, and Figure 13c takes the absolute  
Figure 11: Training results of the BP neural network for the two sub-mirrors segmented system: (a) loss function; (b) error histogram. Figure 12: Piston error measurement results by the proposed hybrid network. value of measurement error as the horizontal coordinate to give the statistical results of the 500 groups of piston error detection experiments. It can be seen that the detection range of this method is very wide, ranging from \(-10\)\(\upmu\)m to \(10\)\(\upmu\)m, reaching the whole coherence length of the input broadband light. The measurement accuracy is very high, and the probability of measurement error less than or equal to \(10\) nm is as high as 98.8%.