added function for normalizing spectrum