From e3c28f066341becfc4b0b793a350808b4695defd Mon Sep 17 00:00:00 2001 From: bs-flowlab Date: Mon, 29 Aug 2022 11:22:50 +0200 Subject: [PATCH] generate reprofiled in Spectrum.__add__ if not present. Fixes spectra addition when the spectrum that is being added to has no "reprofiled" key in self._peak_dict --- pymzml/spec.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pymzml/spec.py b/pymzml/spec.py index 8c36cbc..fd1271d 100755 --- a/pymzml/spec.py +++ b/pymzml/spec.py @@ -482,6 +482,8 @@ def __add__(self, other_spec): if self._peak_dict["reprofiled"] is None: reprofiled = self._reprofile_Peaks() self.set_peaks(reprofiled, "reprofiled") + if other_spec._peak_dict["reprofiled"] is None: + other_spec.set_peaks(other_spec._reprofile_Peaks(), "reprofiled") for mz, i in other_spec.peaks("reprofiled"): self._peak_dict["reprofiled"][mz] += i return self