def process_spectrum(self, factor=1000.0, ref_mass=0.0, cyclo_freq=0.0, mag_freq=0.0): # t = time.time() fs = FrequencySpectrum(self.signal, self.step) # t1 = time.time() - t self.spectrum = fs.spectrum * factor self.freq = fs.freq # in Hz ms = MassSpectrum(self.freq, ref_mass, cyclo_freq, mag_freq) self.mass = ms.mass
print("len signal=", len(data.signal)) print("len truncated=", len(data.truncated)) signal = data.truncated # Real FFT on complete signal step = data.step print("step=", step) fs = FrequencySpectrum(signal, step) y = fs.spectrum * 1000.0 # ??? according to Anthony # x = fs.freq / 1000.0 # in kHz # Calculate mass x = fs.freq ms = MassSpectrum(x, y) # Auto calib ref_mass = 300.0939 accuracy = 0.1 # ref_mass = 18.0 ms.basic_recalibrate(ref_mass, accuracy) x = ms.mass delta = 10.0 startx = ref_mass - delta / 2 endx = ref_mass + delta / 2 accuracy = 1.0 p = Peaks() mph, mpd, mask = p.prepare_detect(ref_mass, accuracy, x, y, startx, endx) print("type mask", type(mask))
# data.truncate(data.start*2, round(len(data.signal)/2)) # excit = 1.2 ms / 0.5 micros ==> signal starts after point 2400 signal = data.signal print("len signal =", len(signal)) # Real FFT on complete signal step = data.step print("step=", step) fs = FrequencySpectrum(signal, step) y = fs.spectrum * 1000.0 # ??? according to Anthony # x = fs.freq / 1000.0 # in kHz # Calculate mass x = fs.freq ms = MassSpectrum(x, y) # Auto calib ref_mass = 600.187 ref_mass = 300.0939 accuracy = 0.1 # ref_mass = 18.0 ms.auto_calib(ref_mass, accuracy) xx = np.array(ms.mass) # search values to detect peaks around a know mass # mask1 = [(xx >= 26.0) & (xx < 27.0)] # mask1 = [(xx >= 299.0) & (xx < 300.0)] # mask1 = [(xx >= 599.0) & (xx < 600.0)] # print("lenx=", len(xx[mask1])) # # mask = [(xx > 22.0) & (xx < 30.0)]
# step = 0.5 524288 filename = "D:\\PIRENEA\\DATA\\2018\\data_2018_07_20\\P1_2018_07_20_025.A00" raw = RawDataset(filename) signal = raw.signal step = raw.step # Real FFT on complete signal fs = FrequencySpectrum(signal, step) y = fs.spectrum * 1000.0 # ??? according to Anthony # Calculate mass x = fs.freq ms = MassSpectrum(x, ref_mass=300.0939, cyclo_freq=255.692e3, mag_freq=0.001e3) xx = np.array(ms.mass) # Auto calib ref_mass = 300.0939 accuracy = 0.1 x = ms.mass # Arbitrary limits for peak detection set around ref_mass delta = 10.0 startx = ref_mass - delta / 2 endx = ref_mass + delta / 2 accuracy = 1.0 p = Peaks()