Modeling the gain and amplified spontaneous emission spectra of erbium-doped fiber amplifiers