## 2 Simulation Methods and Evaluation Parameters  
### Simulation Methods and Aberration Description  
Generally, a conventional AO system employs a wavefront sensor to measure aberrations, an adaptive correction element to compensate aberrations and a control system that processes the sensor signals in order to drive the correction element [15]. Combining the microscope and AO system, the schematic diagram of the illumination path and direct wavefront detection path of AO-TPBM and AO-TPGM are shown in Figure 1, regardless of the scanning system. For simplicity, the correction element (generally spatial light modulator, SLM) is drawn as a transmission device rather than a reflective device in reality. In AO-TPGM, in most cases, the fs-NIR-laser beam propagates through a series of 4f lenses and then converges by the illumination objective (IO) to form a Gaussian focus in the sample. While in AO-TPBM, the illumination beam is modulated by the axicon phase pattern on SLM to form a Bessel beam firstly. Then, IO and other lenses constitute 4f systems together and deliver the modulated Bessel beam into the sample. The two-photon excitation fluorescent guide star (GS) generated at the sample is collected by IO and directed to a wavefront sensor (WFS). Therefore, these two kinds of systems are very different in the conjugation relationship among SLM, WFS, IO and the sample. In AO-TPGM, SLM and WFS are both conjugated with the rear pupil of IO. In AO-TPBM, WFS is conjugated with the rear focal plane of IO, while SLM is conjugated with the sample. During AO correction, SLM is controlled with the wavefront measured by WFS. For the sake of convenience, generally the wavefront aberration is decomposed into Zernike modes. In our simulation systems, the same method is used to simulate the aberrations caused by samples. The aberrations conjugated with WFS can be expressed as [16]:  
\[\mathrm{W(x,y)}=\sum_{j}\mathrm{a_{j}Z_{j}(x,y)} \tag{1}\]  
where \(\mathrm{a_{j}}\) is the coefficient that describes the amplitude of Zernike mode \(Z_{j}\) (r, \(\theta\)). With \(j=(n(n+2)+m)/2\), the Zernike modes are defined as:  
\[Z_{n}^{m}(r,\theta)=\left\{ \begin{matrix}\mathrm{m}<0:&\sqrt{2(n+1)}\mathrm{R _{n}^{-m}(r)\sin(-m\theta)}\\ \mathrm{m}=0:&\sqrt{n+1}\mathrm{R_{n}^{0}(r)}\\ \mathrm{m}>0:&\sqrt{2(n+1)}\mathrm{R_{n}^{m}(r)}\cos(m\theta)\end{matrix} \right. \tag{2}\]  
\[\mathrm{R_{n}^{m}(r)}=\sum_{s=0}^{(n-m)/2}\frac{(-1)^{s}(n\,-\,s)!}{s!((n+m)/2 -s)!((n\,-\,m)/2-s)!}r^{n-2s} \tag{3}\]  
The indices n and m represent the radial and azimuthal order, respectively. They are restricted to the conditions that n \(\geq\) 1 m \(\mid\) and n \(-\) 1 m \(\mid\) is even. The relationship between polar and rectangular coordinates is as follows:  
\[\mathrm{x}=\mathrm{rcos}\theta,\,\,\mathrm{y}=\mathrm{rsin}\theta,\,\,\mathrm{ and}\,\,0\leq\mathrm{r}=\sqrt{\mathrm{x}^{2}+\mathrm{y}^{2}}\leq 1 \tag{4}\]  
Figure 1: The schematic diagram of the illumination path and direct wavefront detection path of (**a**) AO-TPCM and (**b**) AO-TBPM without scanning system. The intensity profile of the illumination beam at WFS-conjugated plane is given. For TPGB, the illumination beam at the pupil of IO can be defined:  
\[\mathrm{E_{GO}(x_{0},y_{0})=A_{GO}\exp(-\frac{x_{0}{{}^{2}}+y_{0}{{}^{2}}}{w_{GO}^ {2}})} \tag{5}\]  
where \(w_{GO}\) is the waist radius of Gaussian beam and \(A_{GO}\) is the amplitude.