Skip to content

Commit

Permalink
Merge pull request #70 from guoci/patch-16
Browse files Browse the repository at this point in the history
optimize annotation code
  • Loading branch information
grosenberger authored Aug 2, 2021
2 parents 9ab353c + b29f4c4 commit 1667412
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions easypqp/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,10 +519,8 @@ def annotate_mass_spectrum(ionseries, max_delta_ppm, spectrum):

mzs0, intensities0 = spectrum.get_peaks()
ppms = np.abs((mzs0[:, np.newaxis] - ion_masses) / ion_masses * 1e6)
ppms_argmin = ppms.argmin(1)
ppms_min = np.take_along_axis(ppms, ppms_argmin[:, np.newaxis], axis=1)[:, 0]
idx_mask = ppms_min < min(max_delta_ppm, top_delta)
idx = ppms_argmin[idx_mask]
idx_mask = (ppms < min(max_delta_ppm, top_delta)).any(1)
idx = ppms[idx_mask].argmin(1)
return ions[idx], ion_masses[idx], intensities0[idx_mask]


Expand Down

0 comments on commit 1667412

Please sign in to comment.