latools/D_obj.py
def calibrate(self, calib_ps, analytes=None):
        """
        Apply calibration to data.

        The `calib_dict` must be calculated at the `analyse` level,
        and passed to this calibrate function.

        Parameters
        ----------
        calib_dict : dict
            A dict of calibration values to apply to each analyte.

        Returns
        -------
        None
        """
        # can have calibration function stored in self and pass *coefs?
        if analytes is None:
            analytes = self.analytes

        if 'calibrated' not in self.data.keys():
            self.data['calibrated'] = Bunch()

        for a in analytes:
            m = calib_ps[a]['m'].new(self.uTime)

            if 'c' in calib_ps[a]:
                c = calib_ps[a]['c'].new(self.uTime)
            else:
                c = 0

            self.data['calibrated'][a] = self.data['ratios'][a] * m + c

        if self.internal_standard not in analytes:
            self.data['calibrated'][self.internal_standard] = \
                np.empty(len(self.data['ratios'][self.internal_standard]))

        self.setfocus('calibrated')
        return
def calibrate(self, calib_ps, analytes=None):
        # can have calibration function stored in self and pass *coefs?
        if analytes is None:
            analytes = self.analytes

        if 'calibrated' not in self.data.keys():
            self.data['calibrated'] = Bunch()

        for a in analytes:
            m = calib_ps[a]['m'].new(self.uTime)

            if 'c' in calib_ps[a]:
                c = calib_ps[a]['c'].new(self.uTime)
            else:
                c = 0

            self.data['calibrated'][a] = self.data['ratios'][a] * m + c

        if self.internal_standard not in analytes:
            self.data['calibrated'][self.internal_standard] = \
                np.empty(len(self.data['ratios'][self.internal_standard]))

        self.setfocus('calibrated')
        return
def calibrate ( self , calib_ps , analytes = None ) : # can have calibration function stored in self and pass *coefs? if analytes is None : analytes = self . analytes if 'calibrated' not in self . data . keys ( ) : self . data [ 'calibrated' ] = Bunch ( ) for a in analytes : m = calib_ps [ a ] [ 'm' ] . new ( self . uTime ) if 'c' in calib_ps [ a ] : c = calib_ps [ a ] [ 'c' ] . new ( self . uTime ) else : c = 0 self . data [ 'calibrated' ] [ a ] = self . data [ 'ratios' ] [ a ] * m + c if self . internal_standard not in analytes : self . data [ 'calibrated' ] [ self . internal_standard ] = np . empty ( len ( self . data [ 'ratios' ] [ self . internal_standard ] ) ) self . setfocus ( 'calibrated' ) return
Apply calibration to data.

        The `calib_dict` must be calculated at the `analyse` level,
        and passed to this calibrate function.

        Parameters
        ----------
        calib_dict : dict
            A dict of calibration values to apply to each analyte.

        Returns
        -------
        None
Apply calibration to data .