1. A method for determining the most likely composition of a sample, comprising: obtaining data from a sample, wherein the data comprises a representation of a measured spectrum; determining a precision state of the representation of the measured spectrum; providing a plurality of library candidates and, for each library candidate, providing data representing the same, wherein the data comprises 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; and determining the most likely composition of the sample based upon the determined representations of similarity of the sample to each library candidate