Starting from a cloud of atoms in state \(|1\rangle \)  of uniform density, we pulse the Raman beams with a duration of a few tens of \({}\)  to coherently transfer a controlled fraction of atoms to state \(|2\rangle \) . In this protocol, the total density of the cloud remains uniform. We then image the density distribution of atoms in state \(|2\rangle \)  prior to any spin dynamics and apply an optimization protocol identical to the one developed for creating arbitrary density distributions. We show in figure REF  two examples of spin profiles realized in our system at the end of the optimization loop: a Gaussian profile (figure REF (a)) and the so-called Townes profile (figure REF (b)), which is a solitonic solution of the 2D attractive non-linear Schrödinger equation that decreases almost exponentially with \(r\)  at large \(r\)  [1]}. The measured profiles are very close to the target over typically two orders of magnitude in density.
<FIGURE>