
Comparison between Hadamard and canonical bases for in-situ wavefront correction
and the effect of ordering in compressive sensing
Dennis Scheidt and Pedro A. Quinto Su∗
Instituto de Ciencias Nucleares, Universidad Nacional Aut´onoma de M´exico,
Apartado Postal 70-543, 04510, Cd. Mx., M´exico
(Dated: October 24, 2022)
In this work we compare the Canonical and Hadamard bases for in-situ wavefront correction
of a focused Gaussian beam using a spatial light modulator (SLM). The beam is perturbed with
a transparent optical element (sparse) or a random scatterer (both prevent focusing at a single
spot). The phase corrections are implemented with different basis sizes (N= 64,256,1024,4096)
and the phase contribution of each basis element is measured with 3 step interferometry. The
field is reconstructed from the complete 3Nmeasurements and the correction is implemented by
projecting the conjugate phase at the SLM. Our experiments show that in general, the Hadamard
basis measurements yield better corrections because every element spans the relevant area of the
SLM, reducing the noise in the interferograms. In contrast, the canonical basis has the fundamental
limitation that the area of the elements is proportional to 1/N, and requires dimensions that are
compatible with the spatial period of the grating. In the case of the random scatterer, we were
only able to get reasonable corrections with the Hadamard basis and the intensity of the corrected
spot increased monotonically with N, which is consistent with fast random changes in phase over
small spatial scales. We also explore compressive sensing with the Hadamard basis and find that
the minimum compression ratio needed to achieve corrections with similar quality to those that
use the complete measurements depend on the basis ordering. The best results are reached in the
case of the Hadamard-Walsh and cake cutting orderings. Surprisingly, in the case of the random
scatterer we find that moderate compression ratios on the order of 10 −20% (N= 4096) allow to
recover focused spots, although as expected, the maximum intensities increase monotonically with
the number of measurements due to the non sparsity of the signal.
I. INTRODUCTION
Most optical instruments and applications can be very
sensitive to aberrations. However, programmable opti-
cal elements like deformable mirrors and 2 dimensional
arrays like spatial light modulators (SLM) and digital
micromirror arrays (DMD) have enabled corrections of
arbitrary errors that can result in better focusing and
enhancing light transmission through scattering materi-
als [1, 2].
A very simple solution to correct aberrations with a
spatial light modulator is the ‘in-situ’ method that can-
cels the errors at the point where the beam is used (i.e.
focused spot) demonstrated by ˇ
Ciˇzmar and coworkers [3].
That approach uses an orthogonal canonical basis repre-
sentation of the field at the surface of an SLM, where the
basis is implemented in a square domain with an area A
that is divided into a grid of Nnon-overlapping elements.
Each element is represented by a unit vector in Ndimen-
sional space ˆei=δij (i, j = 1, ..., N). The amplitude and
phase contribution of each square wavelet at the point of
interest is measured with interferometry. In that way, it
is possible to enhance the intensity of the focused beam
by assigning each mode a phase that maximizes the in-
terference, cancelling the aberrations and enhancing the
intensity. This method has also been implemented with
a DMD that has faster update rates [4] to generate very
∗Pedro.quinto@nucleares.unam.mx
accurate structured beams.
A fundamental limitation of the in-situ method with
the canonical basis is that increasing the spatial resolu-
tion of the measurement by increasing the size of the basis
Ndecreases the area of the individual elements to A/N ,
reducing the amount of light diffracted by each element
which can increase noise in the measurement. Further-
more, if the size becomes smaller than the grating period
that is used to diffract the light, the diffraction efficiency
decreases exacerbating the problem.
Other orthogonal bases (i.e. Hadamard) utilize over-
lapping modes that fill the relevant area Aof the SLM
where the basis is defined [5]. For example, the Nor-
thogonal vectors of the Hadamard basis do not have zero
entries but ±1 values; as a result the signal to noise ratio
increases and is similar for all elements.
Furthermore, the spatial overlap of the modes in the
case of the Hadamard basis allows the use of compres-
sive sensing (CS) [6], where the full signal can be recon-
structed measuring only a subset Mof vectors in the
basis (M < N). This can be done because most sig-
nals are sparse with only a few components contributing
significantly. An important consideration in the imple-
mentation of compressive sensing is the ordering of the
Hadamard basis [7–9], which can significantly decrease
the number of measurements needed to reconstruct a sig-
nal.
Several groups have already implemented compressive
sensing for imaging a complex field (phase and ampli-
tude) [5], but to our knowledge there are no studies com-
paring the original ’in-situ’ experiment with a Hadamard
arXiv:2210.11483v1 [eess.IV] 20 Oct 2022