Example #1
0
    area = peak_sum_area(im, peak)
    peak.area = area

    # print some details
    UID = peak.UID
    # height as sum of the intensities of the apexing ions
    height = sum(peak.get_mass_spectrum().mass_spec.tolist())
    print(UID + f", {rt:.2f}, {height:.2f}, {peak.area:.2f}")

# TIC from raw data
tic = data.get_tic()
# baseline correction for TIC
tic_bc = tophat(tic, struct="1.5m")

# Get Ion Chromatograms for all m/z channels
n_mz = len(im.get_mass_list())
ic_list = []

for m in range(n_mz):
    ic_list.append(im.get_ic_at_index(m))

# Create a new display object, this time plot the ICs 
# and the TIC, as well as the peak list
display = Display()
display.plot_tic(tic_bc, 'TIC BC')
for ic in ic_list:
    display.plot_ic(ic)
display.plot_peaks(new_peak_list, 'Peaks')
display.do_plotting('TIC, and PyMassSpec Detected Peaks')
display.show_chart()
Example #2
0
    sim_im.set_ic_at_index(ii, ic_bc)

### Now detect peaks in the noisy simulated IntensityMatrix

pre_peak_list = BillerBiemann(sim_im, points=3, scans=2)
print("Number of peaks found in simulated data", len(pre_peak_list))

### Filter this peak list as for real_im
r = 1
# minimum number of ions, n
n = 3
# greater than or equal to threshold, t
t = 10000
# trim by relative intensity
spl = rel_threshold(pre_peak_list, r)
# trim by threshold
sim_peak_list = num_ions_threshold(spl, n, t)
print("Number of filtered peaks in simulated data", len(sim_peak_list))

### Now display the ics and the filtered peak list from the simulated data
ics = []
for i in range(n_mz):
    ics.append(sim_im.get_ic_at_index(i))

display = Display()
for ic in ics:
    display.plot_ic(ic)
display.plot_peaks(sim_peak_list, 'Peaks')
display.do_plotting('ICs, and PyMassSpec Detected Peaks of Simulated Data')
display.show_chart()