latools/D_obj.py
def filter_gradient_threshold(self, analyte, win, threshold, recalc=True):
        """
        Apply gradient threshold filter.

        Generates threshold filters for the given analytes above and below
        the specified threshold.

        Two filters are created with prefixes '_above' and '_below'.
            '_above' keeps all the data above the threshold.
            '_below' keeps all the data below the threshold.

        i.e. to select data below the threshold value, you should turn the
        '_above' filter off.

        Parameters
        ----------
        analyte : str
            Description of `analyte`.
        threshold : float
            Description of `threshold`.
        win : int
            Window used to calculate gradients (n points)
        recalc : bool
            Whether or not to re-calculate the gradients.

        Returns
        -------
        None
        """
        params = locals()
        del(params['self'])

        # calculate absolute gradient
        if recalc or not self.grads_calced:
            self.grads = calc_grads(self.Time, self.focus,
                                    [analyte], win)
            self.grads_calced = True

        below, above = filters.threshold(abs(self.grads[analyte]), threshold)

        setn = self.filt.maxset + 1

        self.filt.add(analyte + '_gthresh_below',
                        below,
                        'Keep gradient below {:.3e} '.format(threshold) + analyte,
                        params, setn=setn)
        self.filt.add(analyte + '_gthresh_above',
                        above,
                        'Keep gradient above {:.3e} '.format(threshold) + analyte,
                        params, setn=setn)
def filter_gradient_threshold(self, analyte, win, threshold, recalc=True):
        params = locals()
        del(params['self'])

        # calculate absolute gradient
        if recalc or not self.grads_calced:
            self.grads = calc_grads(self.Time, self.focus,
                                    [analyte], win)
            self.grads_calced = True

        below, above = filters.threshold(abs(self.grads[analyte]), threshold)

        setn = self.filt.maxset + 1

        self.filt.add(analyte + '_gthresh_below',
                        below,
                        'Keep gradient below {:.3e} '.format(threshold) + analyte,
                        params, setn=setn)
        self.filt.add(analyte + '_gthresh_above',
                        above,
                        'Keep gradient above {:.3e} '.format(threshold) + analyte,
                        params, setn=setn)
def filter_gradient_threshold ( self , analyte , win , threshold , recalc = True ) : params = locals ( ) del ( params [ 'self' ] ) # calculate absolute gradient if recalc or not self . grads_calced : self . grads = calc_grads ( self . Time , self . focus , [ analyte ] , win ) self . grads_calced = True below , above = filters . threshold ( abs ( self . grads [ analyte ] ) , threshold ) setn = self . filt . maxset + 1 self . filt . add ( analyte + '_gthresh_below' , below , 'Keep gradient below {:.3e} ' . format ( threshold ) + analyte , params , setn = setn ) self . filt . add ( analyte + '_gthresh_above' , above , 'Keep gradient above {:.3e} ' . format ( threshold ) + analyte , params , setn = setn )
Apply gradient threshold filter.

        Generates threshold filters for the given analytes above and below
        the specified threshold.

        Two filters are created with prefixes '_above' and '_below'.
            '_above' keeps all the data above the threshold.
            '_below' keeps all the data below the threshold.

        i.e. to select data below the threshold value, you should turn the
        '_above' filter off.

        Parameters
        ----------
        analyte : str
            Description of `analyte`.
        threshold : float
            Description of `threshold`.
        win : int
            Window used to calculate gradients (n points)
        recalc : bool
            Whether or not to re-calculate the gradients.

        Returns
        -------
        None
Apply gradient threshold filter .