Accurate holographic light potentials using pixel crosstalk modelling

Arbitrary light potentials have proven to be a valuable and versatile tool in many quantum information and quantum simulation experiments with ultracold atoms. Using a phase-modulating spatial light modulator (SLM), we generate arbitrary light potentials holographically with measured efficiencies between 15 and 40% and an accuracy of \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$<2\%$$\end{document}<2% root-mean-squared error. Key to the high accuracy is the modelling of pixel crosstalk of the SLM on a sub-pixel scale which is relevant especially for large light potentials. We employ conjugate gradient minimisation to calculate the SLM phase pattern for a given target light potential after measuring the intensity and wavefront at the SLM. Further, we use camera feedback to reduce experimental errors, we remove optical vortices and investigate the difference between the angular spectrum method and the Fourier transform to simulate the propagation of light. Using a combination of all these techniques, we achieved more accurate and efficient light potentials compared to previous studies, and generated a series of potentials relevant for cold atom experiments.


INTRODUCTION
The ability to shape light into arbitrary potentials has created many new opportunities in cold atom experiments.Applications include atomtronics [1,2], tailored potentials for quantum simulation experiments with optical lattices [3][4][5][6] and quantum information platforms using Rydberg arrays [7][8][9].These applications require smooth light potentials that minimize inhomogeneities and the resulting dephasing effects, and for experiments involving larger atom numbers or where laser power is limited, a high efficiency is desirable.Arbitrary light potentials are commonly generated using a digital micromirror device (DMD) which is an amplitude-modulating spatial light modulator (SLM) or using a phase-modulating liquid crystal on silicon (LCOS) SLM.Tailored light potentials for cold atom experiments were realised using a DMD in direct imaging [10,11], where the efficiency of the light potential is directly proportional to the number of mirrors in the 'on' position and is limited by the diffraction efficiency of the device (typically 30%−88%) [10,12,13].Alternatively, the DMD can be used in a holographic setup with efficiencies of 1% − 2% [14].As opposed to direct imaging, any aberrations in the optical system can be corrected in situ which enables to generate diffractionlimited light potentials [14].Using a phase-modulating LCOS SLM in a holographic setup, calculated efficiencies of 18% − 64% were achieved [15][16][17][18], largely independent of the size of the light potential.After multiplying these calculated efficiencies by the diffraction efficiency of the LCOS SLM (20% − 90%, depending on the diffraction angle [19]) they are still an order of magnitude higher compared to the DMD efficiencies.As holographically generated light potentials are very sensitive to aberrations in the optical system, it is challenging to produce light potentials of low error.Potentials with a root-mean-squared (RMS) error of <5% have been used to investigate Bose-Einstein condensates in ring traps [20,21], while in recent experiments with Rydberg arrays, light potentials with an RMS error of 0.7% were used [7].Despite the complexity associated with a holographic setup, the prospect of achieving higher efficiencies and lower error has driven the development of sophisticated hologram calculation techniques.
The task of finding the SLM phase to achieve a desired light potential is known as phase retrieval problem.Various algorithms such as the mixed-region amplitude-freedom (MRAF) algorithm [17], the offset-MRAF algorithm [15] and a conjugate gradient (CG) approach [16] were developed to solve this purely computational problem and produce simulated light potentials of < 1% RMS error.However, creating light potentials with this degree of accuracy is difficult experimentally as imperfections in the optical setup cause a mismatch between the simulated and the measured light potentials.These effects include a distorted wavefront at the SLM, the curved surface of the SLM itself, crosstalk between neighbouring SLM pixels, aberrations caused by the Fourier lens and other alignment imperfections.To compensate for these errors, camera feedback algorithms were used to create more accurate light potentials [7,17,[21][22][23].Using stochastic gradient descent, the phase retrieval problem was solved by directly taking the camera image into account when calculating the cost function and its gradient [24].Further, it was shown that the Fourier transform used to propagate the light field from the SLM to the camera can be replaced by a more sophisticated method to simulate the propagation of light and can result in more accurate experimental light potentials [15].
In this work, we create light potentials by combining several computational and experimental techniques to achieve an RMS error of < 2% for various patterns while maintaining measured efficiencies between 15% − 40%.We solve the phase retrieval problem by using CG minimisation [16,18] and investigate the difference between two methods to simulate the propagation of the light; the angular spectrum method (ASM) [25] and the commonly used fast Fourier transform (FFT).We further improve the quality of our light potentials by modelling crosstalk of neighbouring SLM pixels.In previous work, spot patterns have been generated using a pixel crosstalk model [19], however, to the best of our knowledge, this effect has not been taken into account to generate smooth arbitrary light potentials.The combination of all of these techniques allows us to produce potentials of < 1.5% RMS error and efficiencies of more than 40%, opening the way to new applications that require this degree of accuracy and efficiency.
Our experimental setup consists of the SLM (Hamamatsu X13138-07, pixel pitch 12.5 µm, 1272 × 1024 pixels), an achromatic doublet lens and a camera in the Fourier plane.A full description of the setup is shown in the SI.The electric field in the SLM plane, E SLM (x, y), is related to the electric field in the image plane, E IMG (x, y), via the Fourier transform (details see Fig. 1 and Methods).To generate the desired light potential with an intensity pattern I IMG (x, y) = |E IMG (x, y)| 2 , the phase pattern displayed by the SLM, ϕ(x, y), must be found, given the constant field at the SLM A SLM (x, y) exp [iϕ C (x, y)].The Gerchberg-Saxton (GS) algorithm [26] is an iterative Fourier transform algorithm (IFTA) and can find ϕ(x, y) to produce spot patterns of 98% uniformity [27].However, for arbitrary and smooth light potentials, required e.g., for quantum simulation experiments with ultracold atoms, the GS algorithm does not converge well.Modified versions of the original GS algorithm such as the mixed-region amplitude-freedom (MRAF) algorithm [17] and the offset-MRAF (OMRAF) algorithm [15], have produced smooth simulated light potentials approaching 1% root-mean-square (RMS) error, and predicted efficiencies around 24% [15], depending on the target pattern (see equation 1 and 2).More recently, gradient-based optimisation algorithms such as the CG method were used to generate simulated light potentials < 0.1% RMS error and efficiencies > 60% [16], outperforming the above-mentioned IFTAs [15,17].Note that these are RMS errors and efficiencies of simulated light potentials which differ from the experimentally obtained values (see Table I).

Characterisation of light potentials
To characterise the quality of our light potentials, we define the predicted and measured RMS error, ε P and ε M , respectively, The predicted RMS error, ε P , measures the difference between the simulated light potential, Îkl , and the target potential, Tkl , where k and l are the indices in the computational image plane.The error is evaluated in a measure region, M , which is defined as the region in the image plane where the target intensity is larger than 50% of the maximum target intensity [22].The number of pixels in M is indicated by N M .Tkl = T kl / k,l∈M T kl and Îkl = I kl / k,l∈M I kl are the normalised target light potential and the normalised simulated light potential, respectively.
The measured RMS error, ε M , characterises the light potential captured by the camera.The camera image, I uv , with row and column indices, u and v, is mapped to the computational image plane using an affine transform, U .We define ε M in the transformed measure region, M U , containing N U pixels, using the normalised, transformed target light potential, Tuv .The predicted efficiency, η P , of the light potential is given by the ratio of the power in the signal region, S, (indicated by the red rectangle in Fig. 1a), to the total power in the image plane [17].We define the experimental efficiency of the light potential, η M , as the ratio of optical power, P S , in the transformed signal region, S U , to the measured power of the beam before the expansion telescope, P in , (see Methods) Conjugate gradient minimisation and camera feedback We use CG minimisation [16] due to its rapid convergence and due to its flexibility to define a cost function which can be chosen to meet the requirements for a specific application, e.g., the optimisation of intensity, phase and efficiency in a specific region of interest.The minimisation improves the simulated light potential, I kl , iteratively by modifying the SLM phase, ϕ ij , based on a cost function C and its gradient ∂C/∂ϕ ij (blue loop in Fig. 1b).We use the mean-squared error between the normalised simulated intensity pattern in the image plane, Ĩkl = I kl / k,l∈S I kl , and the normalised target intensity pattern, Tkl = T kl / k,l∈S T kl , in the signal region, S, as cost function for the optimisation [16], The sum is evaluated over k and l in the signal region, S, where s is the steepness of the cost function to aid convergence (see Methods for further details).
To generate light potentials of low RMS error experimentally, it is essential to measure the beam profile, A SLM (x, y), and constant phase, ϕ C (x, y), at the SLM plane.We use an interferometric method [14] which displays a sequence of patterns on subsections on the SLM (see SI). Finding a suitable initial SLM phase guess is essential for the convergence of the CG minimisation.We choose an initial phase guess for a given light potential and remove optical vortices from a light potential if necessary (see Methods).To reduce the error in the experimental light potential further, we employ a camera feedback algorithm [22] (red loop in Fig. 1b, details see Methods).The entire protocol is shown schematically in Fig. 1b.After m max CG iterations, a camera image is taken to update the target image and restart the CG loop.The feedback algorithm typically converges within n = 15 iterations (see Fig. 1c).

Pixel crosstalk modelling
By modelling a single SLM pixel with a single computational pixel, we assume that the phase across the SLM pixel is uniform.However, due to the nature of the liquid crystal material inside the SLM, neighbouring pixels affect each other at their boundary region.This effect is known as pixel crosstalk or fringing field effect [28][29][30][31][32][33].We study the effect of pixel crosstalk on our light potentials by up-scaling the SLM phase such that one SLM pixel is represented by 3 × 3 computational pixels and convolving it with a kernel, K, [33] of order q and width σ.As an example, we calculated the SLM phase for a spot array target potential using the CG minimisation, and observed fringes in the camera image (Fig. 2b) which do not appear in the simulated light potential (Fig. 2a).After up-scaling and convolving the same SLM phase pattern, we propagate the field from the SLM plane to the image plane using the Fourier transform.Modelling the pixel crosstalk has no influence on the spatial resolution of the light potential in the image plane.The resulting simulated light potential (Fig. 2c) features fringes similar to those in the camera image, however, with reduced contrast.
In the CG minimisation, we account for pixel crosstalk by upscaling the displayed phase, ϕ (x, y), and restricting its values to a range between 0 and 2π to ensure that the cost C (ϕ) remains a continuous, differentiable function.We convolve the up-scaled phase with the kernel, K, before propagating the light field to the image plane.The parameters σ = 1.24 px −1 and q = 1.80 were found by a 2D scan to minimise ε M after 150 CG iterations without camera feedback for a disc-shaped target potential.Using the camera feedback algorithm with the pixel crosstalk model further reduces the RMS error.The final RMS error and the effect of modelling the pixel crosstalk depend on the size of a specific target light potential (see Fig. 3).Upscaling the SLM pixels by a factor of 3 is computationally expensive, however, we accelerate our calculations using a GPU.This reduces the runtime of our algortihm to ∼ 10 minutes which is 6 times longer than without pixel crosstalk modelling (for 15 feedback iterations with 100 CG iterations each).
To study how the pixel crosstalk model affects our light potentials, we produced disc-shaped light potentials of different diameters, D, between 0.64 mm and 3.3 mm, with and without accounting for pixel crosstalk (see Fig. 3).The target light potential was convolved with a Gaussian kernel of 2 pixels width to ensure that the edge of the disc is not sharper than the diffraction limit.For the initial phase guess, the quadratic phase curvature was adjusted proportional to the disc diameter (see Methods).This ensures that the predicted efficiency of the differently sized light potentials remain similar (η P = 74% − 87%).Without accounting for pixel crosstalk, we achieved best light potentials (ε M = 1.1%) for small discs of D = 0.85 mm, and less smooth potentials (ε M = 3.6%) for larger discs of D = 3.2 mm with measured efficiencies η M = 33% − 40%.We found that ε M is inversely proportional to the measured intensity, I , in the flat part of the disk (Fig. 3d).To obtain I , we measure the average intensity in the flat part of the disc using the camera (see Methods).Smaller discs are of higher intensity since the same amount of optical power is focussed onto a smaller area.
We found that the pixel crosstalk causes a ghost image [19,34] which can interfere with the light potential and cause fringes.By accounting for pixel crosstalk in our model, any interference with the light potential caused by the ghost image is attenuated which lowered the final experimental RMS error by a factor of ∼ 0.4 (D = 2.8 mm).We found that accounting for pixel crosstalk has little effect on smaller light potentials, where the overlap between the ghost image and the light potential is smaller (see Fig. 3d).When taking the pixel crosstalk model into account, the RMS error, ε M , remains smaller as the ghost image caused by pixel crosstalk is attenuated (Fig. 3d), and the measured efficiency decreases from η M = 41% (D = 0.85 mm) to η M = 20% (D = 3.2 mm).We found that the predicted efficiency, η P , is proportional to the measured efficiency, η M .The efficiency predicted by the pixel crosstalk model is lower and closer to the measured efficiency as multiple diffraction orders are simulated.We did not see an improvement in ε M when increasing the resolution of an SLM pixel even further to 5 × 5 or 7 × 7 computational pixels.and n = 14 (hollow circles in the inset).

Angular spectrum method
The Fourier transform used to compute the propagation of light from the SLM plane to the image plane requires the far-field and the paraxial approximations (including a parabolic lens) as well as the assumption that lens and camera are perfectly in focus.In practice, we use a doublet lens and and there is an experimental position uncertainty of the lens and the camera along the optical axis.Inspired by the improvement in RMS error reported in a recent study [15], we implement Helmholtz propagation using the angular spectrum method (ASM) to model the diffraction of light without assuming a far field or small angles [25] (see SI for details on the ASM).In our method, this replaces the Fourier transform, F, in the CG minimisation (shown in blue in Fig. 1b) with the ASM.
We investigate the effect of using the ASM together with the pixel crosstalk model in our feedback process (Fig. 4).The ASM is more accurate than the FFT before any camera feedback is used (n = 0 in Fig. 4), however, both methods converge to similar values after 15 iterations (see inset in Fig. 4).When including the pixel crosstalk model, the initial error before camera feedback (n = 0) is higher, but the algorithm converges to lower ε M after 15 iterations for both the ASM and the FFT method.In all methods, the experimental error, ε M , slowly rises towards the end of the CG minimisation (seen most clearly in Fig. 4 between n = 1 and n = 2).This is due to a mismatch between the simulation and the experiment, leading to a discrepancy between ε P and ε M (see Fig. 1c).The lowest value of ε M is found after less than 100 CG iterations (see hollow circles in the inset of Fig. 4).We did not find a significant improvement by using the ASM instead of the FFT after camera feedback.In optical setups involving a high-NA microscope objective where the paraxial approximation does not hold, we expect the ASM to perform better than in our test setup.

Comparing light potentials
To characterise our method, we produced various light potentials for cold atom experiments.We created a ring with a Gaussian profile relevant for atomtronic experiments [20] (Fig. 5a), a Gaussian potential with an offset as used to cancel the harmonic confinement in optical lattices [5] (Fig. 5b) and a Gaussian spot array with a non-zero FIG.5: Camera images and their normalised profiles (along the white dashed lines) after 15 feedback iterations using the FFT with the crosstalk model.(a) Ring with a Gaussian profile on a non-zero background.(b) Gaussian potential with offset.(c) Gaussian spot array on a non-zero background.(d) An 'atomtronic' logical OR gate [17].
background for tweezer arrays [7] (Fig. 5c).We also generated a potential resembling an 'atomtronic' OR gate as used by previous studies [15,17,34] (Fig. 5d).For the Gaussian potential and the spot array, we achieved the best experimental results by using an initial phase guess according to equation 8 (see Methods).For the ring-shaped potential (Fig. 5a) and the OR gate (Fig. 5d), an initial phase guess resulting in vortex-free potentials could not be found in the same way.For these patterns, remaining optical vortices were removed [35] (see Methods).
We find that the vortex removal process introduces high-frequency components in the displayed SLM phase ϕ(x, y) which increases the effect of pixel crosstalk and deteriorates the experimental light potential.Using our technique, vortex-free simulated light potentials can be generated even from an entirely random initial guess.However, starting with such a random initial phase guess results in less accurate experimental light potentials.For all patterns, we used 15 feedback iterations with 100 CG iterations each, accounting for pixel crosstalk during the optimisation.The experimental RMS error of all four patterns varies between ε M = 1.4% − 1.6%, with measured efficiencies between η M = 15% − 31% (see Table I).The remaining imperfections are most visible in the profiles of light potentials with flat regions.The peak signal-to-noise ratios (PSNR) [36] measured in the transformed signal region, S U , of the light potentials in Fig. 5a-d are 45.7 dB, 40.7 dB, 43.8 dB, and 39.9 dB, respectively.

DISCUSSION
Compared to previous studies (Table I), we can generate experimental light potentials of low RMS error and higher efficiencies.Using the CG method, a small line-shaped potential ( 105 µm length) of 0.7% RMS error has been generated [7] by optimising the intensity and phase in the image plane as well as the efficiency (ε P = 38%).Using such a phase constraint, it becomes increasingly difficult to generate light potentials which are accurate and efficient for larger patterns.A larger line-shaped potential (∼ 400 µm length) has been generated in a different study [18,23] by constraining the phase, however, with a much lower efficiency of 8.3%.If the phase of the target light potential is constrained, more accurate light potentials are typically less efficient and vice versa [7,18].By removing the phase constraint, accurate and efficient light potentials have been generated computationally using the CG method [16], however, the unrestrained phase makes it difficult to realise these experimentally [23].In this work, we minimised experimental errors by characterising our optical system and by using camera feedback.This allows us to generate accurate and efficient light potentials experimentally, without constraining the phase in the image plane.Previous studies have characterised their optical system and used camera feedback without constraining the phase [15,22], however, using an IFTA (MRAF or OMRAF) instead of the CG algorithm, resulting in less accurate and less efficient experimental light potentials than presented here.In our work, accounting for pixel crosstalk further reduced the RMS error, especially for large light potentials, while lowering the efficiency by ∼ 20% (see bottom of Table I).
We did not see an improvement in the RMS error when using the ASM instead of the FFT, however, other experimental uncertainties such as a displacement of the Fourier lens in the xy-plane or a tilt of the Fourier lens could be modelled with the ASM to improve the accuracy of the light potentials before any camera feedback.Cold atom experiments require microscopic potentials to be projected using a high-NA objective, which will be the subject of further work.The FFT might not be sufficient to model this high-NA objective due to the large diffraction angles and the ASM could lead to more accurate potentials in this scenario, even without restricting the phase.TABLE I: Simulated and experimental errors and efficiencies of previous studies compared to this work.In the last four rows, we compare different methods using the disc-shaped target light potential (convergence shown in Fig. 4).

Phase retrieval problem
The electric field in the SLM plane at z = 0, E(x, y, 0) ≡ E SLM (x, y), is calculated using the amplitude of the incident laser beam, A SLM (x, y), and the phase at the SLM (see Fig. 1) The phase at the SLM is the sum of the pattern displayed by the SLM, ϕ(x, y), and a constant phase, ϕ C (x, y), which varies spatially across the SLM but does not change with the displayed phase pattern.This constant phase is caused by distortions of the incoming wavefront and imperfections of the SLM surface.In the image plane at z = 2f , the electric field, E(x, y, 2f ) ≡ E IMG (x, y), is characterised by the amplitude, A IMG (x, y), and the phase, φ(x, y), of the light potential Under the paraxial approximation and the far-field approximation, the electric field in the image plane is related to the electric field in the SLM plane via the Fourier transform [25], F, with spatial frequencies in the image plane, κ x = x/λf and κ y = y/λf .

Implementation of conjugate gradient minimisation and camera feedback
We use a nonlinear CG solver [37], implemented on a GPU using PyTorch which has automatic differentiation capabilities.This allows us to compute the gradient of the cost function, ∂C/∂ϕ, without the need for an analytic expression.Using s = 10 12 (see equation 3), the minimisation typically reaches ε P = 1% within 100 iterations, depending on the shape of the desired potential and provided that an initial phase guess which does not lead to optical vortices was used.As the SLM phase pattern is optimised by simulating the diffraction of light, the target intensity pattern, Tkl , is convolved with the point spread function of our optical system to remove sub-diffraction limited features which hinder convergence.If desired, a term could be added to the cost function to optimise for a higher power inside the signal region [7].Currently, we do not require control over the phase, φ kl , in the image plane, however, it is possible to simultaneously control the intensity and the phase in the image plane at the expense of efficiency [7,23].
The camera feedback algorithm [22] further improves the CG hologram calculation.Initially, an SLM phase pattern, ϕ (0) ij , is calculated for a given target light potential, T (0) kl , by running the CG minimisation for m max iterations.We then display this pattern on the SLM and take a camera image, I uv , of the light potential.We map the initial target light potential from the coordinate system of the computational image plane, T (0) kl , to the coordinate system of the camera image, T (0) uv , using an affine transformation.To calculate the affine transformation, we generate a checkerboard-shaped light potential using the CG algorithm and detect the corner points of the checkerboard in the camera image [24,38].Then, the camera image, I uv , and the transformed initial target light potential, T (0) uv , are normalised [22] and subtracted from each other.This difference D uv = T (0) uv − Îuv is then transformed back to the coordinates of the computational image plane and added to the previous target light potential kl + D kl for the next feedback iteration.We then re-run the CG minimisation using the updated target light potential and the previous optimised phase pattern, ϕ , as an initial guess.Before the new target potential is calculated, the difference D uv is blurred with a Gaussian kernel to ensure that there are no features in the new target that are smaller than the diffraction limit (e.g.camera noise) as the CG minimisation cannot produce light potentials containing sub-diffraction-limited features.after 100 CG iterations and 10 feedback iterations, using different values for the quadratic curvature, R, in the initial phase guess.(f) Predicted RMS error, ε P , before vortex removal (blue circles) and after (orange triangles).

Initial phase guess
We use a combination of a linear phase and a quadratic phase as an initial phase guess, ϕ G , which is common practice in IFTAs and gradient-based phase retrieval algorithms [16,17], The linear terms m x x and m y y diffract the light away from the optical axis and are typically determined by the shape of the target light potential, T kl .The quadratic term with curvature, R, and aspect ratio, γ, are used to control the size of the illuminated area.Smaller values of R produce more efficient light potentials as more light is focused into the signal region S. The initial phase guess must be chosen such that optical vortices cannot form in the signal region S of the image plane [16,17].An optical vortex is a phase winding around a singularity at which the phase is not defined [35].The field amplitude at this point is zero, causing 'holes' in the light potential (Fig. 6a).The CG minimisation cannot remove these vortices because a global phase shift is required to annihilate them [39].By varying R, an initial guess that prevents the formation of optical vortices can be found for 'simple' target potentials.We choose a uniform disc on a dark background as a target potential and detect the number of vortices in the resulting light potential for each value of R (Fig. 6e).The vortices in the light potential cause a higher predicted RMS error, ε P (black circles in Fig. 6e and blue circles in Fig. 6f).Certain values of R do not result in optical vortices, and the lowest RMS error was found for R = 3.6 mrad/px 2 .This procedure works well for simple patterns such as a disc-shaped flattop, however, for more intricate light potentials, it becomes difficult to find a suitable initial guess by scanning the value of R. Further, we found that using the measured intensity profile of the incident laser beam, |A SLM (x, y)| 2 , instead of a perfect Gaussian can introduce vortices even for simple patterns.To improve our scheme, we detect optical vortices in the light potential and remove them [35,39].Initially, the usual CG minimisation is performed until stagnation is reached.We then detect the position of the vortices by identifying the zero crossings of the real and imaginary part of the electric field in the image plane, E IMG (x, y).To find the charge of the vortices, a line integral around the 3 × 3 neighbours of these points is evaluated.The sign of the line integral indicates if the vortex is of positive or negative charge.The phase around these vortices, φ V (x, y), is calculated using the relation [39] where N is the total number of vortices, q n the charge of the vortex and x n and y n its position.The phase, φ V (x, y), (Fig. 6c) is then subtracted from the phase of the light potential, φ(x, y), (Fig. 6b) which annihilates the vortices (Fig. 6d).The electric field consisting of the corrected phase, φ(x, y) − φ V (x, y), and the amplitude of the light potential, A IMG (x, y), is propagated back to the SLM plane using the inverse Fourier transform.The phase of the resulting electric field is used as a new initial phase guess, ϕ G (x, y), By re-running the CG minimisation using ϕ G (x, y), a vortex-free light potential can be produced, provided that all vortices in the light potential were detected.In case there are remaining vortices in the light potential, this process can be repeated until all vortices are detected and annihilated.

Efficiency measurement
To obtain the power in the signal region, P S , we measure the optical power that corresponds to a certain pixel value and exposure time of the camera image.We display a circular mask on the SLM containing a linear phase gradient and place an iris in the image plane to block the zeroth-order light.Only the power of the first-order spot caused by the SLM phase pattern is measured using a power meter.We then take a camera image of this spot with a certain exposure time and relate the pixel sum of the camera image to the measured power.Using this calibration, the optical power, P S , is calculated from the pixel sum of the camera image inside the transformed signal region, u,v∈S U I uv , and the exposure time.The predicted efficiency, η P , is always higher than the measured efficiency, η M , as it does not take the diffraction efficiency of the SLM into account.When displaying a flat phase on the SLM, the measured power of the zeroth-order spot is 69% of the incident power, P in .
EXPERIMENTAL SETUP Light at wavelength λ = 852 nm from a single-mode fibre is collimated by a triplet lens (Melles Griot 06 GLC 001) with a specified wavefront distortion of < λ 4 and is expanded by a telescope (Thorlabs GBE10-B) to a diameter of 9.4 mm at the SLM.The light is polarised along the horizontal plane by a polarising beam splitter (see Fig. S1).The beam is reflected by the SLM (Hamamatsu X13138-07, 12.5 µm pixel pitch, 1272 × 1024 pixels) at an angle of ∼ 10 • and is focussed onto the camera (Matrix Vision mvBlueFOX3-1012dG, 3.75 µm pixel pitch,1280 × 960 pixels) by the Fourier lens (Thorlabs ACT508-250-B).

WAVEFRONT MEASUREMENT
To generate experimental light potentials that match the simulated ones, it is essential to precisely know the wavefront of the light reflected by the SLM and the intensity profile of the incident laser beam.We measure the constant phase, ϕ C , across the SLM using a scheme introduced in a previous study by Zupancic et al. [14].To measure the intensity profile across the SLM, we sample the local intensity by displaying a square pattern on an area of 32 × 32 pixels containing a linear phase gradient (see Fig. S2a), while on the remaining area of the SLM, a flat phase is displayed.This phase gradient generates a diffraction spot away from the optical axis, and the light incident onto the remaining area of the SLM collects on the optical axis.We vary the position of the square pattern, d x and d y , across the entire area of the SLM and measure the intensity of each diffraction spot, |A SLM (d x , d y ) | 2 , on the camera, and as a result, the intensity profile of the laser beam across the SLM is reconstructed (Fig. S2b) [36].The position of the square is varied on an equally spaced grid using 64 × 64 measurements.The diffraction angle of the linear phase gradient is α x = α y = 0.5 • both in x-and y-direction.Initially, the square is displayed at the centre of the SLM and a Gaussian is fitted to the resulting diffraction spot on the camera, in a square region of interest of 300 camera pixels.The intensity of each spot is calculated as the sum of all pixel values in the region of interest.
To measure the constant phase, the position of a square sample phase pattern is varied across the entire area of the SLM, similar to our scheme used to measure the intensity.In addition, a reference square pattern is displayed at the centre of the SLM (see Fig. S3a).The beams originating from the two phase patterns interfere at the camera, causing sine-shaped fringes.The spatial phase, φ M , of this interference pattern is detected by fitting a 2D sine pattern to the camera image [14] where γ x = arctan (d x /f ) and γ y = arctan (d y /f ).Here, d x and d y are the position of the sample pattern with respect to the reference pattern and f is the focal length of the Fourier lens.A and B are the amplitudes of the diffracted beams caused by the reference and the sample square pattern, respectively.Assuming perfect positioning of the lens at z = f and the camera at z = 2f and assuming a thin and parabolic lens, the measured phase, φ M , corresponds to the phase difference between the reference aperture and the sampling aperture ϕ C = φ M .The parameters A, B and φ M are fitted while γ x and γ y are calculated.Due to the Gaussian shape of the beam incident onto the SLM, the intensity of the light at the SLM drops off significantly towards the edges.This causes the intensity of the sampling beam B to become very small compared to A as the sampling aperture moves away from the centre of the SLM, resulting in a low contrast 2AB of the interference pattern and a poor fit.To counteract this, the size of the sampling patch is increased as it moves away from the centre of the SLM to keep the power contained in the sampling aperture equal to the power contained in the reference aperture.This increases the contrast of the interference pattern on the camera and improves the measurement of the phase at darker regions of the SLM.We use 124 × 124 measurements, equally spaced across the SLM with a reference phase pattern of 16 × 16 SLM pixels, resulting in the measured constant phase

ANGULAR SPECTRUM METHOD
We implement the ASM to simulate the propagation of light in our CG minimisation.First, the electric field at the SLM plane, E SLM (x, y), is propagated to the lens plane and multiplied by the aperture, A L (x, y), and phase, φ L (x, y), of the lens using the relation [25] Here, κ x and κ y are the spatial frequencies, E (x, y, z L ) is the electric field in the lens plane just after the lens and z L is the distance between the SLM plane and the lens plane.A L (x, y) = circ(r) is the circular aperture of the lens with radius r and φ L (x, y) is the phase delay caused by the lens.The transfer function, H κ x , κ y , ∆z , is given by [25] H κ x , κ y , ∆z = with propagation distance, ∆z.The resulting electric field, E(x, y, z L ), is then propagated to the image plane using [25] E(x, y, z I ) = F −1 F {E(x, y, z L )} H κ x , κ y , z I − z L , (S4) where E(x, y, z I ) is the resulting electric field in the image plane and ∆z = z I − z L is the distance between the lens plane and the image plane (see Fig. 1a).
In our numerical implementation, we pad the array representing the SLM field with zeros to match the size of the SLM plane with the aperture of the lens used in our experiment.This increases the computational complexity as the matrix size increases from 2048 × 2048 to 3864 × 3864.When using the FFT, the matrix representing the SLM plane of 1024 × 1024 pixels is zero-padded to 2048 × 2048 pixels, resulting in a pixel spacing p IMG = λf 2N p SLM = 8.32 µm in the image plane, with the number of SLM pixels, N , in each dimension and SLM pixel pitch, p SLM .With the ASM, the pixel size in the SLM plane equals the pixel size in the image plane.To achieve a similar spatial resolution in the output plane using the ASM, each SLM pixel of 12.5 µm size is sub-resolved computationally into 2 × 2 pixels which increases the number of pixels to 7728 × 7728.We use a GPU (Nvidia RTX A5000 24 GB) to accelerate our calculations.

ASM wavefront correction
Our method to measure the constant phase, ϕ C , requires the lens to be parabolic and assumes perfect placement of the lens and the camera.Using equation S1, the measured phase, φ M (x, y), includes the phase difference caused by the distorted wavefront at the SLM and the phase differences caused by a non-parabolic lens and a displacement of the camera along the optical axis.As the ASM is capable of modelling the doublet lens and a displaced camera, it is important to separate these phase differences and the wavefront at the SLM, φ C (x, y), from each other.
To implement the ASM, we calculate a corrective phase, φ ASM (x, y), which only models the phase caused by the displaced, non-parabolic lens and the displaced camera, assuming a flat wavefront at the SLM.To do so, we calculate the path length of every sample beam between the lens and a fixed point in the image plane as well as the phase delay each sample beam collects when passing through the lens, φ L x s (x) , y s (y) .with the position of the sample beam on the lens x s (x) = x + z L tan(α x ) and y s (y) = y + z L tan (α y ), where α x and α y are the diffraction angles of the linear phase gradient in x-and y-direction, respectively.The phase is sampled at a point in the image plane with co-ordinates x c = f tan(α x ) and y c = f tan(α y ).We then subtract the corrective phase pattern, φ ASM (x, y), from the measured constant phase to obtain the wavefront at the SLM, φ C (x, y) = φ M (x, y) − φ ASM (x, y).

FIG. 1 :
FIG. 1: Generation of light potentials using CG minimisation and camera feedback.(a) Holographic setup with the displayed SLM phase, ϕ ij , in the SLM plane, forming a light potential, I kl , in the Fourier plane of the lens.(b) Flow diagram visualising the process of generating a light potential.The pixel crosstalk on the SLM is modelled just before the SLM field, E SLM , is propagated to the image plane.(c) Convergence of the first 6 iterations of the feedback process.Due to imperfections, the experimental RMS error, ε M , (solid line) converges at a higher level than the predicted RMS error, ε P (dashed line).After each feedback iteration, n, the experimental RMS error, ε M , decreases due to the adjusted target light potential.

FIG. 2 :
FIG. 2: Simulated and experimental images illustrating the effect of pixel crosstalk.(a) Simulated light potential for a spot array target light potential.(b) Camera image of the experimental light potential showing fringes and an intensity gradient, with less intense spots in the top left of the image.(c) Simulated light potential after up-scaling and convolving the SLM phase pattern with kernel K.The fringes and the intensity gradient seen in the camera image (b) are reproduced in the simulation, however, with reduced contrast.

FIG. 3 :
FIG. 3: Effect of pattern size and pixel crosstalk on the RMS error.(a)-(c) Disc-shaped potentials (diameters D = 0.6 mm, D = 1.5 mm and D = 2.8 mm), generated using camera feedback without the pixel crosstalk model, and normalised by the average intensity in the flat part of the disc.(d) RMS error of disc-shaped light potentials of different diameters with and without the pixel crosstalk model.(e) Horizontal profiles of the light potentials, averaged over 10 rows within the white rectangles in (a)-(c).

FIG. 4 :
FIG. 4: Convergence of the feedback procedure using the FFT and the ASM, with and without pixel crosstalk modelling.The main figure shows ε M as it converges for n = 15 camera iterations with m = 100 CG iterations in between.The values ε M used in the camera feedback process are shown as filled circles.To investigate the behaviour of ε M during the CG minimisation, we saved intermediate phase patterns and analysed the resulting light potentials (lines in main figure).For n > 1, the experimental error, ε M , is smallest for m < 100.The inset shows the convergence during the final 8 camera feedback iterations.The lowest experimental error was found between n = 11 and n = 14 (hollow circles in the inset).

FIG. 6 :
FIG. 6: Detection and removal of optical vortices in the disc-shaped light potential.(a) Intensity of the light potential, showing the central 100 × 100 pixels; (b) phase, φ, of the same potential, (c) phase, φ v of the vortices only, (d) phase, φ − φ v , of the corrected field with vortices removed.(e) Number of vortices detected in the light potential after 100 CG iterations and 10 feedback iterations, using different values for the quadratic curvature, R, in the initial phase guess.(f) Predicted RMS error, ε P , before vortex removal (blue circles) and after (orange triangles).
FIG. S1: Schematic of the experimental setup.
FIG. S2: (a) Scheme illustrating the measurement of the laser intensity profile by displaying a series of apertures containing a linear gradient on the SLM [36] (Fig. adapted from Zupancic et al. [14]).(b) Resulting laser intensity profile.