emzed.utils.align_spectra module¶
- emzed.utils.align_spectra.compute_spectra_alignments(spectra, mz_tolerance)[source]¶
takes a list of spectra and groups peaks given mz_tolerance. it returns a list of lists. every inner list specifies the alignment of one input spectrum to its follower in the list. One assignment is a list of tuples, where the first entry is a peak index from the first list, the second entry is the index of a peak from the second spectrum.
For example:
if you run this method with a list or tuple of three spectra (s0, s1, s2) the return values will be [align_0_to_1, align_1_to_2]
an alignment is a list [(i0, j0), (i1, j1), …]
so that s0.peaks[i0, :] is assigned to s1.peaks[j0, :] and so on.