# Complex Wavefront Shaping through a Multi-Core Fiber
## 4 On-the-Fly Closed-Loop Control of Rotating Profile
To specify the process, the retrieved source phase \(\phi_{s}(x,y)\) is sampled by the core distribution map \(M(x,y)\) and constitutes the modulation hologram on the SLM \(H_{slm}(x,y)\) with the DOPC phase \(\phi_{DOPC}(x,y)\) and the blazed grating \(\phi_{grating}(x,y)\)  
\[H_{slm}=e^{j(\phi_{t}\cdot M+\phi_{DOPC}+\phi_{grating})}, \tag{10}\]  
which is the experimental input light field at the proximal MCF facet (Figure 6 IV,V). The distal far-field is captured and transported to a PC for real-time processing through a camera interface (uEye Interfaces, IDS) (Figure 6 VI). Each spot is segmented from the background and the mean intensity \(I_{1}\) and \(I_{2}\) of each spot is characterized as the feedback in the closed-loop control. The target intensity for the next iteration is on-the-fly manipulated  
Figure 6: Principle of the on-the-fly closed-loop control with Core-GS algorithm. To achieve two intensity-balanced spots at distal side of the MCF, the calculated phase image at the source plane and the distortion compensating phase image constitutes the modulation hologram which is displayed on the SLM in real-time. The modulated light transmits through the MCF and the dual-spot intensity profile is captured by the distal CMOS camera, and the intensity difference between the two spots is on-the-fly evaluated and determines the targeted amplitude image for the next iteration. accordingly (Figure 6 VI), defining the manipulated mean intensity of each spot in the updated target intensity is \({I_{1}}^{\prime}\) and \({I_{2}}^{\prime}\) respectively  
\[{I_{1}}^{\prime}=\frac{2\alpha{I_{1}}}{{I_{1}}+{I_{2}}}I;\quad{I_{2}}^{\prime}= \frac{2\alpha{I_{2}}}{{I_{1}}+{I_{2}}}I\ \ (\alpha<1), \tag{11}\]  
where \(\alpha\) is a scale factor to prevent oscillation of the intensity difference. Nevertheless, the overall intensity which is the mean intensity of both spots at different orientations still fluctuates. Assuming a mean intensity of both spots of \({I_{0}}\) is desired, while the measured mean intensity is \({I_{m}}\). An external spot with a lower intensity of \({I_{3}}\)  
\[{I_{3}}=\alpha^{\prime}({I_{m}}-{I_{0}}),\ \ (\alpha^{\prime}<1), \tag{12}\]  
is generated at the target intensity image out of the region of interest to further compensate for the overall intensity variation. The on-the-fly manipulated iteration converges when both an optimum internal and overall intensity difference are reached. Continuous and homogeneous rotation of the dual-spot from 0\({}^{\circ}\) to 90\({}^{\circ}\) in 1\({}^{\circ}\)-steps is achieved with the on-the-fly closed-loop control with the Core-GS algorithm. To prove the flexible application of the MCF as a waveguide, a MCF was bent for 90\({}^{\circ}\) in the setup. The image sequence of the distal output dual-spot light field and the corresponding phase modulation is demonstrated in Figure 7.  
The internal and overall intensity of the dual-spot light field at different orientations is characterized in Figure 8c,d. Obviously, the intensity distribution of the two spots is well balanced with the proposed on-the-fly closed-loop control, a mean difference of 1.4% was achieved (Figure 8d). The overall intensity fluctuation over the rotation is compensated as well, but due to the systematic temporal phase fluctuation, the intensity fluctuation is still visible over the beam rotation (Figure 8c). Nevertheless, the standard deviation of the overall intensity decreased from 5.5% to 3.2%, demonstrating a robust rotation of the light field with homogeneous intensity distribution. The uniformity of both spots is also an important criterion for the cell-rotation by optical manipulation, which affects the direction of the optical force [13, 38, 39]. Both spots are fitted to a Gaussian distribution respectively for each orientation, and the corresponding full-width half-maximum (FWHM) in the rotation axis is measured to characterize the uniformity of the dual-spot over rotation (Figure 8e).