We consider the problem of recovering a compactly-supported function from a
finite collection of pointwise samples of its Fourier transform taking
nonuniformly. First, we show that under suitable conditions on the sampling
frequencies - specifically, their density and bandwidth - it is possible to
recover any such function f in a stable and accurate manner in any given
finite-dimensional subspace; in particular, one which is well suited for
approximating f. In practice, this is carried out using so-called nonuniform
generalized sampling (NUGS). Second, we consider approximation spaces in one
dimension consisting of compactly supported wavelets. We prove that a linear
scaling of the dimension of the space with the sampling bandwidth is both
necessary and sufficient for stable and accurate recovery. Thus wavelets are up
to constant factors optimal spaces for reconstruction