Spectral library generation and raw data processing