# Adaptive Truncation Threshold Determination for Multimode Fiber Single-Pixel Imaging
## Appendix A Self-Contained Parameter Determination for ATTD  
ATTD requires two parameters, namely the variation bound (VAR) for \(|k-\mathbf{i}_{k}|\) and the tolerance factor (TOL). The determination method is provided using software-masked BD sequence \(\mathbf{y}_{\text{ave}}=\mathbf{A}\mathbf{x}_{\text{ave}}\), where \(\mathbf{x}_{\text{ave}}\) is an artificial target with a random profile and pixel average of 0.5. 1. As shown in Algorithm 1, VAR determination is based on the cumulative average of the index difference before and after sorting the projection amplitude, i.e., \(|k-\mathbf{i}_{k}|\), where \(k\) contains only those vectors with an SV larger than 1% of the maximum, i.e., the most significant singular vectors. Although VAR seems to be arbitrary, the choice of a suitable TOL can compensate for this. ```
1:procedureVAR determination(\(\mathbf{y}_{\text{ave}},\mathbf{U},\mathbf{S}\))
2:\(\mathbf{c}_{\text{ave}}\leftarrow\left|\mathbf{U}^{\text{T}}\mathbf{y}_{ \text{ave}}\right|\);
3:\(\mathbf{i}_{\text{ave}}\leftarrow\text{sort}(\mathbf{c}_{\text{ave}})\);
4:\(\mathbf{s}\leftarrow\text{diag}(\mathbf{S})\);
5:for\(k\gets 1\)to\(k\leftarrow\text{length}(\mathbf{i}_{\text{ave}})\)do
6:if\(\mathbf{s}_{k}\geq 0.01\text{max}(\mathbf{s})\)then\(\mathbf{var}_{k}\leftarrow|k-\mathbf{i}_{k}|\);
7:elsebreak;
8:endif
9:endfor
10: VAR \(\leftarrow\) mean\((\mathbf{var})\);
11:endprocedure
```  
**Algorithm A1** Self-contained VAR determination 2. As Algorithm A2 shows, several TOL values were tested in ATTD with normally distributed simulated noise (**e**) [44] and tuned via the Euclidean norm of software-masked BD sequence \(\mathbf{y}_{\text{ave}}\), the number of measurements (\(N_{\text{mea}}\)), and a given amplitude ratio (dB) [45]. A suitable TOL value can be chosen by comparing the ATTD output (\(k_{\text{d}}\)) and the clairvoyant benchmark (\(k_{\text{c}}\)), given a certain noise level. Determining \(k_{\text{c}}\) requires the target ground truth (**x**) and the quality assessment image's signal-to-noise ratio (isnr). \[\text{isnr}(\mathbf{x},\hat{\mathbf{x}}_{k})=20\log_{10}\left(\frac{\langle \mathbf{x}\rangle}{\sqrt{\langle(\mathbf{x}-\mathbf{x}_{k})^{2}\rangle}} \right),\] (A1) where \(\langle.\rangle\) averages over all pixels, and \(\mathbf{x}\) and \(\hat{\mathbf{x}}_{k}\) are normalized by the sum of all pixel values. The simulation revealed that that the \(k_{\text{d}}\) of 0.4 was closest to \(k_{\text{c}}\) under various noise levels ranging from \(-10\) to \(-100\) dB, and it was robust relative to multiple trials (see the error bar in Figure 6). Notably, a different TOL value may perform better for a different **A**. However, with no loss of generality, the provided parameter determination would work well for a simple round of simulation as long as the measurement matrix (**A**) were recorded. ```
1:procedureTOL-determination(\(\mathbf{y}_{\text{ave}},\mathbf{U},\mathbf{S},N_{\text{mea}}\))
2:fortol \(\leftarrow\) 0.2 totol \(\leftarrow\) 0.6 do
3:forratio \(\leftarrow\)\(-100\) toratio \(\leftarrow\)\(-10\)do
4:\(\mathbf{e}\)(ratio) \(\leftarrow\)\(||\mathbf{y}_{\text{ave}}||_{2}/N_{\text{mea}}^{1/2}\times 10^{(\text{ratio}/20)} \times\text{random}(N_{\text{mea}})\);
5:\(\mathbf{k}_{\text{d}}\)(tol,ratio) \(\leftarrow\) ATTD(\(\mathbf{y}_{\text{ave}}+\mathbf{e}\)(ratio), VAR, tol)
6:for\(k\)\(\leftarrow\)\(1\)to\(k\)\(\leftarrow\)\(N_{\text{mea}}\)do
7:\(\mathbf{isnr}_{k}=\) isnr(\(\hat{\mathbf{x}}_{k},\mathbf{x}_{\text{ave}}\));
8:endfor
9:\(\mathbf{k}_{\text{c}}\)(tol,ratio) \(\leftarrow\)\(\underset{k}{\arg\underset{k}{\max}}\)isnr; \(\triangleright\)Clairvoyant benchmark
10:endfor
11:endfor
12:TOL \(\leftarrow\)\(\underset{\text{tol}}{\arg\underset{\text{tol}}{\min}}\)\(|\mathbf{k}_{\text{d}}-\mathbf{k}_{\text{c}}|\);
13:endprocedure
```  
**Algorithm A2** Self-contained TOL determination  
Figure A1: Determined ATTD \(k_{\text{d}}\) vs. clairvoyant benchmark \(k_{\text{c}}\) under varying noise ratios using different tolerance factors (TOL = 0.2, 0.4, and 0.6).