1. A method of spectrum data analysis, the method comprising the steps of: directing an electron beam toward an unknown material; collecting x-rays emitted from the unknown material as a result of the electron beam impact; determining from the energies of less than 100,000 collected x-rays a spectrum of the unknown material; providing a set of element data templates, each corresponding to an x-ray spectra of a chemical element; calculate least squares weights for the element data templates in approximating the spectrum; removing one or more of the templates having negative weights in approximating the spectrum; and re-calculating an approximation of the spectrum with said one or more templates removed.