result = peak_closest(db, a) returns index of peak closest to a a can be either the number of a wavenumber or the wavenumber itself, because it is easy to distinguish one from the other result is an index of an element in db, such as db.names(result), db.centres(result) of db.indexes(result)