An encoder spectrograph is used to analyze radiation from one or more samples in various configurations. The radiation is analyzed by spatially modulating the radiation after it has been dispersed by wavelength or imaged along a line. Dual encoder spectrographs may be used to encode radiation using a single modulator. A spectra sorting algorithm is used to determine calibration training spectra for a spectrometer in a spectrometer calibration training mode.