#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jun 28 11:09:33 2019 @author: kantundpeterpan Substract two spectra after scaling one of them with respect to the other. Spectra are first "aligned" by binning with fixed bins with binsize set to the min(min_mz(ms1), min_mz(ms2)) """ import sys import argparse import gc import pymzml import numpy as np import matplotlib.pyplot as plt import pandas as pd from MSanalyzer_class import * from PyQt5 import QtWidgets def get_min_delta_mz(ms, tmin, tmax): if args.fast: ind = (ms.mzml_parser.data.scan_time >= tmin) & (ms.mzml_parser.data.scan_time < tmax) mzs = ms.mzml_parser.data.mz_array[ind].values ints = ms.mzml_parser.data.int_array[ind].values array_s = np.array([np.hstack([mz, val]) for mz, val in zip(mzs, ints)]) else: run = pymzml.run.Reader(ms.mzml_parser.file) scans = (s for s in run if s.scan_time[0]/60>tmin and s.scan_time[0]/600,:] new_cutoff = new_cutoff[np.nonzero(new_cutoff[:,1])] np.savetxt('new_cutoff.csv', new_cutoff, delimiter=',') plt.show() app.exit()