Spatial compression of a particle state in a parabolic potential by spin measurements