Skip to content

Commit

Permalink
don't fail on "empty" spectra
Browse files Browse the repository at this point in the history
  • Loading branch information
leoschwarz committed Jun 18, 2024
1 parent 6d47748 commit f2ce95c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/depiction/tools/pick_peaks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import argparse

from loguru import logger

from depiction.parallel_ops import ParallelConfig, WriteSpectraParallel
from depiction.spectrum.peak_filtering import FilterByIntensity
from depiction.spectrum.peak_picking import BasicInterpolatedPeakPicker
Expand Down Expand Up @@ -31,7 +33,10 @@ def _operation(
for spectrum_index in spectra_ids:
mz_arr, int_arr, coords = reader.get_spectrum_with_coords(spectrum_index)
peak_mz, peak_int = peak_picker.pick_peaks(mz_arr, int_arr)
writer.add_spectrum(peak_mz, peak_int, coords)
if len(peak_mz) > 0:
writer.add_spectrum(peak_mz, peak_int, coords)
else:
logger.warning(f"Dropped spectrum {spectrum_index} as no peaks were found")


def debug_diagnose_threshold_correspondence(
Expand Down

0 comments on commit f2ce95c

Please sign in to comment.