From 9a22b3516cf9297c9a9e992fe7049ee54f9bbafd Mon Sep 17 00:00:00 2001 From: Kzra Date: Mon, 6 Mar 2023 16:23:10 +0000 Subject: [PATCH 1/2] Fix min and max mz filtering in cut_mz_domain_noise --- corems/mass_spectrum/calc/NoiseCalc.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/corems/mass_spectrum/calc/NoiseCalc.py b/corems/mass_spectrum/calc/NoiseCalc.py index 6c3ad6ef4..efbcb6c0e 100644 --- a/corems/mass_spectrum/calc/NoiseCalc.py +++ b/corems/mass_spectrum/calc/NoiseCalc.py @@ -120,20 +120,20 @@ def cut_mz_domain_noise(self): if max_mz_noise > max_mz_whole_ms: max_mz_noise = max_mz_whole_ms - - #print(min_mz_noise, max_mz_noise) - low_mz_index = (where(self.mz_exp_profile >= min_mz_noise)[0][0]) - #print(self.mz_exp_profile[low_mz_index]) - # low_mz_index = (argmax(self.mz_exp_profile <= min_mz_noise)) - - high_mz_index = (where(self.mz_exp_profile <= max_mz_noise)[-1][-1]) + #the following indexing relies on mz_exp_profile being ordered high mz to low mz + low_mz_index = (where(self.mz_exp_profile >= min_mz_noise)[0][-1]) + #print(self.mz_exp_profile[low_mz_index]) + #low_mz_index = (argmax(self.mz_exp_profile <= min_mz_noise)) + + high_mz_index = (where(self.mz_exp_profile <= max_mz_noise)[0][0]) + #print(self.mz_exp_profile[high_mz_index]) #high_mz_index = (argmax(self.mz_exp_profile <= max_mz_noise)) if high_mz_index > low_mz_index: # pyplot.plot(self.mz_exp_profile[low_mz_index:high_mz_index], self.abundance_profile[low_mz_index:high_mz_index]) # pyplot.show() - return self.mz_exp_profile[high_mz_index:low_mz_index], self.abundance_profile[low_mz_index:high_mz_index] + return self.mz_exp_profile[low_mz_index:high_mz_index], self.abundance_profile[low_mz_index:high_mz_index] else: # pyplot.plot(self.mz_exp_profile[high_mz_index:low_mz_index], self.abundance_profile[high_mz_index:low_mz_index]) # pyplot.show() From 016483192b06ebe8a29ad2b1d14ac2e0a19a2c92 Mon Sep 17 00:00:00 2001 From: Kzra Date: Tue, 7 Mar 2023 09:45:37 +0000 Subject: [PATCH 2/2] updated indexing --- corems/mass_spectrum/calc/NoiseCalc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/corems/mass_spectrum/calc/NoiseCalc.py b/corems/mass_spectrum/calc/NoiseCalc.py index efbcb6c0e..129617dc0 100644 --- a/corems/mass_spectrum/calc/NoiseCalc.py +++ b/corems/mass_spectrum/calc/NoiseCalc.py @@ -122,7 +122,7 @@ def cut_mz_domain_noise(self): max_mz_noise = max_mz_whole_ms #the following indexing relies on mz_exp_profile being ordered high mz to low mz - low_mz_index = (where(self.mz_exp_profile >= min_mz_noise)[0][-1]) + low_mz_index = (where(self.mz_exp_profile >= min_mz_noise)[-1][-1]) #print(self.mz_exp_profile[low_mz_index]) #low_mz_index = (argmax(self.mz_exp_profile <= min_mz_noise))