A spatial filter for an optical system, such as an optical spectrometer, collects and spatially filters light using a fiber bundle having a plurality of fibers disposed therein. At an input end of the fiber bundle, the fibers are typically packed tightly together to optimize the collection efficiency. At an output end, the fibers are spread out from the fiber bundle and arranged within a two-dimensional output area according to a two-dimensional pattern corresponding to a coded aperture function. As a result, the two-dimensional pattern of the output end spatially filters the light collected by the input end. Corresponding methods are also described.