# Adaptive Truncation Threshold Determination for Multimode Fiber Single-Pixel Imaging
## 2 Method
### Proposed Method: Adaptive Truncation Threshold Determination (ATTD)  
The ATTD method begins with the assumption that the absolute value decomposition (\(|\mathbf{U}^{\mathsf{T}}\mathbf{y}|\)) generally follows a descending order, consistent with the SV distribution. However, the presence of noise disrupts this order, causing \(|\mathbf{U}^{\mathsf{T}}(\mathbf{y}+\mathbf{e})|\) to become randomly distributed beyond a certain index. Therefore, the point at which the order is disrupted between the decomposition indices and the SV indices serves as a reference for distinguishing between signals and noise.  
As the ATTD pseudo-code (Algorithm 1) shows, by inputting the noisy BD signal (\(\mathbf{y}+\mathbf{e}\)), the left singular matrix (\(\mathbf{U}\)) via the SVD of the recorded measurement matrix (\(\mathbf{A}\)), and the self-contained VAR and TOL parameters, the threshold (\(k_{\text{d}}\)) is determined. Note that VAR and TOL can be calibrated independently via several numerical simulations using only the measurement matrix (\(\mathbf{A}\)), as described in Appendix A (Algorithms A1 and A2, respectively). Each step is described as follows:  
1. Projection: Calculate the absolute value of decomposition coefficients (\(\mathbf{c}=|\mathbf{U}^{\mathsf{T}}(\mathbf{y}+\mathbf{e})|\)).
2. Sorting: Sort sequence \(\mathbf{c}\) in descending order to obtain \(\mathbf{c}_{\text{sorted}}\) and the corresponding index (\(\mathbf{i}\)).
3. Binary transformation: Apply a naive test function to binary \(|k-\mathbf{i}_{k}|\) as follows: \[\mathbf{b}_{k}=\begin{cases}0,&\text{if }|k-\mathbf{i}_{k}|>\text{VAR}\\ 1,&\text{otherwise}\end{cases}\] (2)  
Figure 1: Measurement procedure of MMF-SPI.  
4. Accumulated average: Compute the accumulated average of the first \(k\) values of \(\mathbf{b}\) as follows: \[\mathbf{ave}_{k}=\frac{1}{k}\sum_{j=1}^{k}\mathbf{b}_{j},1\leq k\leq N_{\text{ mea}},\] (3) where the \(\mathbf{ave}_{k}\) sequence generally decreases with \(k\).
5. Determination: Determine the truncation threshold \(k_{\text{d}}\) via the maximum index when the accumulated average (\(\mathbf{ave}\)) is larger than a certain proportion of its maximum, i.e., \(\text{TOL}\cdot\max(\mathbf{ave})\). \[k_{\text{d}}=\max\{k\mid\mathbf{ave}_{k}\geq\text{TOL}\cdot\max(\mathbf{ave} ),1\leq k\leq N_{\text{mea}}\}.\] (4)  
```
1:function\(\text{ATTD}(\mathbf{y}+\mathbf{e},\mathbf{U},\text{VAR},\text{TOL})\)
2:\(\mathbf{c}\leftarrow\left\lvert\mathbf{U}^{\intercal}(\mathbf{y}+\mathbf{e}) \right\rvert;\triangleright\) (1) Project step.
3:\(\mathbf{i}\leftarrow\text{sort}(\mathbf{c});\)\(\triangleright\) (2) Sort \(\mathbf{c}\) in descending order and obtain corresponding indexes.
4:for\(k\gets 1\) to \(k\leftarrow\) length(\(\mathbf{i}\)) do
5: compute \(\mathbf{b}_{k}\) via Equation (2); \(\triangleright\) (3) Naive test function to sift \(|k-\mathbf{i}_{k}|\).
6: compute \(\mathbf{ave}_{k}\)via Equation (3); \(\triangleright\) (4) Accumulated average.
7:endfor
8: compute \(k_{\text{d}}\) via Equation (4); \(\triangleright\) (5) Determination.
9:return\(k_{\text{d}}\)
10:endfunction
```  
**Algorithm 1**\(k_{\text{d}}=\)ATTD\((\mathbf{y}+\mathbf{e},\mathbf{U},\text{VAR},\text{TOL})\)