# Piston Error Measurement for Segmented Telescopes with an Artificial Neural Network
## 3 Piston Error Detection Method Using BP Artificial Neural Network  
### Brief Introduction of the BP Artificial Neural Network  
Equation (16) directly gives the theoretical relationship between the piston error and the peak heights of the MTF sidelobes. However, due to the high nonlinearity and complexity of Equation (16), it is difficult to calculate the piston error in a realistic segmented telescope when the MTF is obtained. Thus, we turned to machine learning and neural networks [27] to establish the mapping relationship between the MTF's surrounding peak heights and the piston error rather than fitting Equation (16) with precise mathematical expressions.  
Artificial neural networks [28; 29; 30], which belong to machine learning, are input-output information processors composed of parallel layers of elements or neurons, loosely modeled on biological neurons, which possess local memory and are capable of elementary arithmetic. They can be used to learn and store a great deal of nonlinear mapping relations from the input-output model. The artificial neural network, composed of many neurons, has a parallel distribution structure. Each neuron has a single output and can be connected to other neurons; there are multiple output connection methods, and each connection method corresponds to a connection weight coefficient. The artificial neural network can be regarded as a directed graph formed by connecting weighted directed chains with processing elements as nodes. For the \(k\)th neuron, if the signal from another neuron is \(x_{i}\), their interaction weight is \(w_{ik}\) and the internal threshold of the processing unit is \(\theta_{k}\), then the input of the \(k\)th neuron is \(\sum\limits_{i=1}^{m}x_{i}w_{ik}\), where \(m\) is the number of the input neurons connected to the \(k\)th neuron. Thus, the output of the \(k\)th neuron \(y_{k}\) is:  
\[y_{k}=f\left(\sum\limits_{i=1}^{m}x_{i}w_{ik}-\theta_{k}\right), \tag{18}\]  
where \(f()\) is called the activation (or transfer) function. The purposes of the activation function are introducing nonlinearity to neural networks and bounding the value of the  
Figure 3: Surrounding peak heights of MTF varying with the piston error (**a**) calculated by Equation (16) and (**b**) obtained by the MATLAB program.  
neuron so that the neural network is not paralyzed by divergent neurons. A common example of activation function is the sigmoid (or logistic) function, which is shown as:  
\[\phi(z)=\frac{1}{1+\exp(-z)}. \tag{19}\]  
When the neural network structure is designed and has inputs and outputs, the network needs to be trained so it can learn the appropriate mapping relationships between the inputs and the outputs. The BP algorithm is one of the most widely used algorithms for training neural networks, and utilizes a gradient descent method to minimize the square of the error between the network output value and the target value to adjust the weights of each neuron. The BP algorithm can be divided into two steps: forward propagation and back propagation. The forward propagation process is propagating the input signals from the input layer, via the hidden layer, to the output layer to get the final output results. The back-propagation process is propagating the error signal, which is the difference between the real output and the expected output of the network, from the output end to the input layer in a layer-by-layer manner to adjust the weights and thresholds. Through one forward propagation and one back propagation, we can update the parameters of the network once. The network training process is to constantly reciprocate the forward and back propagation and continuously update the network parameters, and finally make the network precisely map the real relationships between the inputs and outputs. A sketch graph of a BP artificial neural network with two hidden layers is shown in Figure 4.