示例#1
0
文件: timspy.py 项目: hcji/timspy
    def fit_tof2mz_model(self, mz_min=0, mz_max=3000, deg=2, prox_grid_points=1000):
        """Get a model that translates mass indices (time) into mass to charge ratios.

        Args:
            mz_min (float): minimal mass over charge.
            mz_max (float): maximal mass over charge.
            prox_grid_points (int): Approximate number of points for fitting.
    
        Return:
            Polyfit1D: a fitted 1D polynomial.
        """
        mzIdx_min, mzIdx_max = self.mzToIndex(1, [mz_min, mz_max]).astype(int)
        mzIdx_step = (mzIdx_max - mzIdx_min) // 1000
        mzIdx = np.arange(mzIdx_min, mzIdx_max, mzIdx_step)
        mz = self.indexToMz(1, mzIdx)
        self.tof2mz_model = polyfit(mzIdx, mz, deg=deg)
示例#2
0
文件: timspy.py 项目: hcji/timspy
 def fit_scan2im_model(self, deg=4):
     scans = np.arange(self.min_scan, self.max_scan+1)
     ims = self.scan2im(scans)
     self.scan2im_model = polyfit(scans, ims, deg=deg)
示例#3
0
文件: timspy.py 项目: hcji/timspy
 def fit_frame2rt_model(self, deg=5):
     """Fit a model that will change frame numbers to retention time values."""
     # fr = np.arange(self.min_frame, self.max_frame+1)
     fr = self.frames.index
     rt = self.frames.rt.values
     self.frame2rt_model = polyfit(fr, rt, deg=deg)