Recovery of spectral information from an imperfect detector using the expectation maximization algorithm