n_scan, n_mz = im.get_size() for ii in range(n_mz): ic = im.get_ic_at_index(ii) ic_smooth = savitzky_golay(ic) ic_base = tophat(ic_smooth, struct="1.5m") im.set_ic_at_index(ii, ic_base) # Load the experiment exper = load_expr(expr_file) # Load the peak list peak_list = exper.get_peak_list() # Pass Ion Chromatograms into a list of ICs n_mz = len(im.get_mass_list()) ic = [] for m in range(n_mz): ic.append(im.get_ic_at_index(m)) # Create a new display object, this time plot four ICs # and the TIC, as well as the peak list display = Display() display.plot_ics(ic) display.plot_peaks(peak_list, 'Peaks') display.do_plotting('ICs, and PyMS Detected Peaks')
area = peak_sum_area(real_im, peak) peak.set_area(area) # real_peak_list is PyMS' 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 # Now add noise to the simulated intensity matrix object scale = 1000 add_gaussc_noise(sim_im, scale) ### Now display the ics from the simulated data ics = [] for i in range(n_mz): ics.append(sim_im.get_ic_at_index(i)) display = Display() display.plot_ics(ics) display.do_plotting( 'ICs of Simulated Data with gaussian noise (constant scale)')
peak.set_area(area) # real_peak_list is PyMS' 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_ics([ic, ic_add_noise], ['Without noise', 'With noise added']) display.do_plotting('Simulated IC for m/z = 73, with and without noise')
area = peak_sum_area(real_im, peak) peak.set_area(area) # real_peak_list is PyMS' 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_ics([ic, ic_add_noise], ['Without noise', 'With noise added']) display.do_plotting('Simulated IC for m/z = 73, with and without noise')
# # IonChromatogram # # TIC from raw data tic = data.get_tic() # save TIC to a file # Get Ion Chromatograms for 4 separate m/z channels ic = im.get_ic_at_mass(191) ic1 = im.get_ic_at_mass(73) ic2 = im.get_ic_at_mass(57) ic3 = im.get_ic_at_mass(55) # create a list of ICs for passing to plot_ics() ics = [ic, ic1, ic2, ic3] # load list of peaks # NB NB NB NB You must first run proc_save_peaks.py from # this directory to generate the peak list peak_list = load_peaks("output/peaks.bin") # Create a new display object, this time plot four ICs # and the TIC, as well as the peak list display = Display() display.plot_tic(tic, 'TIC') display.plot_ics(ics, ['191', '73', '57', '55']) display.plot_peaks(peak_list, 'Peaks') display.do_plotting('TIC, ICs, and PyMS Detected Peaks')
# IonChromatogram # # TIC from raw data tic = data.get_tic() # save TIC to a file # Get Ion Chromatograms for 4 separate m/z channels ic = im.get_ic_at_mass(191) ic1 = im.get_ic_at_mass(73) ic2 = im.get_ic_at_mass(57) ic3 = im.get_ic_at_mass(55) # create a list of ICs for passing to plot_ics() ics = [ic, ic1, ic2, ic3] # load list of peaks # NB NB NB NB You must first run proc_save_peaks.py from # this directory to generate the peak list peak_list = load_peaks("output/peaks.bin") # Create a new display object, this time plot four ICs # and the TIC, as well as the peak list display = Display() display.plot_tic(tic, 'TIC') display.plot_ics(ics, ['191','73','57','55']) display.plot_peaks(peak_list, 'Peaks') display.do_plotting('TIC, ICs, and PyMS Detected Peaks')