diff --git a/pymzml/spec.py b/pymzml/spec.py index a1ddb61c..be4ac8c0 100755 --- a/pymzml/spec.py +++ b/pymzml/spec.py @@ -502,7 +502,11 @@ def __add__(self, other_spec): if self._peak_dict["reprofiled"] is None: reprofiled = self._reprofile_Peaks() self.set_peaks(reprofiled, "reprofiled") - for mz, i in other_spec.peaks("reprofiled"): + if other_spec._peak_dict['reprofiled'] is None: + reprofiled = other_spec._reprofile_Peaks() + other_spec.set_peaks(reprofiled, "reprofiled") + # access peak dict directly to avoid casting to array + for mz, i in other_spec._peak_dict['reprofiled'].items(): self._peak_dict["reprofiled"][mz] += i return self