A method for determining the most likely composition of a sample,
including obtaining data from a sample, wherein the data includes a
representation of a measured spectrum; determining the precision state of
the representation of the measured spectrum; providing a plurality of
library candidates and, for each library candidate, providing data
representing each library candidate, wherein the data includes a
representation of a library spectrum; determining a representation of the
similarity of the sample to each library candidate using (i) the
representation of the measured spectrum; (ii) the precision state of the
representation of the measured spectrum; and (iii) the representation of
the library spectrum for that library candidate; determining the most
likely composition of the sample based upon the determined
representations of similarity of the sample to each library candidate;
and displaying the most likely composition of the sample to a user.