  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 $3N$ measurements
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.
