Exemplo n.º 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()
Exemplo n.º 2
0
# real_peak_list is PyMassSpec' best guess at the true peak list

################## Run Simulator ######################
# Simulator takes a peak list, time_list and mass_list
# and returns an IntensityMatrix object.
# The mass_list and time_list are the same for the real
# data and the simulated data.

time_list = real_im.get_time_list()
mass_list = real_im.get_mass_list()

sim_im = gcms_sim(time_list, mass_list, real_peak_list)
# sim_im is an IntensityMatrix object

# select one ic to add noise to from this simulated intensity matrix

ic = sim_im.get_ic_at_mass(73)

ic_add_noise = copy.deepcopy(ic)

# Now add noise to the simulated intensity matrix object
scale = 1000
add_gaussc_noise_ic(ic_add_noise, scale)

display = Display()
display.plot_ic(ic, label="Without Noise")
display.plot_ic(ic_add_noise, label="With Noise Added")
display.do_plotting('Simulated IC for m/z = 73, with and without noise')
display.show_chart()