latools/D_obj.py
def despike(self, expdecay_despiker=True, exponent=None,
                noise_despiker=True, win=3, nlim=12., maxiter=3):
        """
        Applies expdecay_despiker and noise_despiker to data.

        Parameters
        ----------
        expdecay_despiker : bool
            Whether or not to apply the exponential decay filter.
        exponent : None or float
            The exponent for the exponential decay filter. If None,
            it is determined automatically using `find_expocoef`.
        noise_despiker : bool
            Whether or not to apply the standard deviation spike filter.
        win : int
            The rolling window over which the spike filter calculates
            the trace statistics.
        nlim : float
            The number of standard deviations above the rolling mean
            that data are excluded.
        maxiter : int
            The max number of times that the fitler is applied.

        Returns
        -------
        None

        """
        if not hasattr(self, 'despiked'):
            self.data['despiked'] = Bunch()

        out = {}
        for a, v in self.focus.items():
            if 'time' not in a.lower():
                sig = v.copy()  # copy data
                if expdecay_despiker:
                    if exponent is not None:
                        sig = proc.expdecay_despike(sig, exponent, self.tstep, maxiter)
                    else:
                        warnings.warn('exponent is None - either provide exponent, or run at `analyse`\nlevel to automatically calculate it.')
                
                if noise_despiker:
                    sig = proc.noise_despike(sig, int(win), nlim, maxiter)
                out[a] = sig

        self.data['despiked'].update(out)
        # recalculate total counts
        self.data['total_counts'] = sum(self.data['despiked'].values())
        self.setfocus('despiked')
        return
def despike(self, expdecay_despiker=True, exponent=None,
                noise_despiker=True, win=3, nlim=12., maxiter=3):
        if not hasattr(self, 'despiked'):
            self.data['despiked'] = Bunch()

        out = {}
        for a, v in self.focus.items():
            if 'time' not in a.lower():
                sig = v.copy()  # copy data
                if expdecay_despiker:
                    if exponent is not None:
                        sig = proc.expdecay_despike(sig, exponent, self.tstep, maxiter)
                    else:
                        warnings.warn('exponent is None - either provide exponent, or run at `analyse`\nlevel to automatically calculate it.')
                
                if noise_despiker:
                    sig = proc.noise_despike(sig, int(win), nlim, maxiter)
                out[a] = sig

        self.data['despiked'].update(out)
        # recalculate total counts
        self.data['total_counts'] = sum(self.data['despiked'].values())
        self.setfocus('despiked')
        return
def despike ( self , expdecay_despiker = True , exponent = None , noise_despiker = True , win = 3 , nlim = 12. , maxiter = 3 ) : if not hasattr ( self , 'despiked' ) : self . data [ 'despiked' ] = Bunch ( ) out = { } for a , v in self . focus . items ( ) : if 'time' not in a . lower ( ) : sig = v . copy ( ) # copy data if expdecay_despiker : if exponent is not None : sig = proc . expdecay_despike ( sig , exponent , self . tstep , maxiter ) else : warnings . warn ( 'exponent is None - either provide exponent, or run at `analyse`\nlevel to automatically calculate it.' ) if noise_despiker : sig = proc . noise_despike ( sig , int ( win ) , nlim , maxiter ) out [ a ] = sig self . data [ 'despiked' ] . update ( out ) # recalculate total counts self . data [ 'total_counts' ] = sum ( self . data [ 'despiked' ] . values ( ) ) self . setfocus ( 'despiked' ) return
Applies expdecay_despiker and noise_despiker to data.

        Parameters
        ----------
        expdecay_despiker : bool
            Whether or not to apply the exponential decay filter.
        exponent : None or float
            The exponent for the exponential decay filter. If None,
            it is determined automatically using `find_expocoef`.
        noise_despiker : bool
            Whether or not to apply the standard deviation spike filter.
        win : int
            The rolling window over which the spike filter calculates
            the trace statistics.
        nlim : float
            The number of standard deviations above the rolling mean
            that data are excluded.
        maxiter : int
            The max number of times that the fitler is applied.

        Returns
        -------
        None
Applies expdecay_despiker and noise_despiker to data .