示例#1
0
def features(Signal=None, SamplingRate=1000., Filter={}):
    """

    Retrieves relevant ECG signal features.

    Kwargs:
        Signal (array): input ECG signal.
        
        SamplingRate (float): Sampling frequency (Hz).
        
        Filter (dict): Filter parameters.    

    Kwrvals:
        R (array): ECG R-peak indexes (or instants in seconds if sampling rate is defined)
        
        mean (float): mean
        
        std (float): standard deviation
        
        var (float): variance
        
        skew (ndarry): skewness
        
        kurtosis (array): kurtosis
        
        ad (float): absolute deviation

    Configurable fields:{"name": "ecg.features", "config": {"SamplingRate": "1000."}, "inputs": ["Signal", "Filter"], "outputs": ["R", "mean", "std", "var", "skew", "kurtosis", "ad"]}

    See Also:
        filt
        models.hamilton
        tls.statsf
        
    Notes:

    Example:

    References:
        .. [1]    
    """
    # Check
    if Signal is None:
        raise TypeError, "An input signal is needed."
    if Filter:
        Filter.update({'Signal': Signal})
        if not Filter.has_key('SamplingRate'):
            Filter.update({'SamplingRate': SamplingRate})
        Signal = filt(**Filter)['Signal']
    # Init
    kwrvals = {}
    # Feature Extraction
    res = ecg(Signal=Signal, SamplingRate=SamplingRate)
    for k in res:
        kwrvals[k] = res[k]
    res = tls.statsf(Signal=Signal)
    for k in res:
        kwrvals[k] = res[k]
    # Out
    return kwrvals
示例#2
0
def features(Signal=None, SamplingRate=1000., Filter={}):
    """

    Retrieves relevant BVP signal features.

    Kwargs:
        Signal (array): input signal.
        
        SamplingRate (float): sampling frequency (Hz).
        
        Filter (dict):  filter parameters.

    Kwrvals:
        Signal (array): output filtered signal (see notes 1). 
        
        Amplitude (array): signal pulses amplitudes (in the units of the input signal).(TODO) 
            
        Onset (array): indexes (or instants in seconds, see notes 2.b) of the pulses onsets. 
            
        Peak (array): indexes (or instants in seconds, see notes 2.b) of the pulses peaks. (TODO)
        
        DicroticNotch (array): indexes (or instants in seconds, see notes 2.b) of the pulses dicrotic notchs. (TODO)
        
        IBI (array): Inter-Beat Intervals in msec (see notes 2.a).
        
        HR (array): Instantaneous Heart Rates in b.p.m. (see notes 2.a).
        
        mean (float): mean
        
        std (float): standard deviation
        
        var (float): variance
        
        skew (ndarry): skewness
        
        kurtosis (array): kurtosis
        
        ad (float): absolute deviation
        
    Configurable fields:{"name": "bvp.features", "config": {"SamplingRate": "1000."}, "inputs": ["Signal", "Filter"], "outputs": ["Signal", "Amplitude", "Onset", "Peak", "DicroticNotch", "IBI", "HR", "mean", "std", "var", "skew", "kurtosis", "ad"]}

    See Also:
            filt
            
            pulse
            
            tls.statsf

    Notes:
        1 - If a filter is given as a parameter, then the returned keyworded values dict has a 'Signal' key.
        
        2 - If the sampling rate is defined, then:
            a) the returned keyworded values dict has keys 'IBI' and 'HR'.
            b) keys 'onset', 'peak', and 'DicroticNotch' are converted to instants of occurrence in seconds.   

    Example:
        bvp = ...
        SamplingRate = ...
        res = pulse(Signal=bvp, SamplingRate=SamplingRate)    

    References:
        .. [1] 
        
    """
    # Check
    if Signal is None:
        raise TypeError, "An input signal is needed."
    if Filter:
        Filter.update({'Signal': Signal})
        if not Filter.has_key('SamplingRate'):
            Filter.update({'SamplingRate': SamplingRate})
        Signal = filt(**Filter)['Signal']
    # Init
    kwrvals = {}
    # Feature Extraction
    res = pulse(Signal=Signal, SamplingRate=SamplingRate)
    for k in res:
        kwrvals[k] = res[k]
    res = tls.statsf(Signal=Signal)
    for k in res:
        kwrvals[k] = res[k]
    # Out
    return kwrvals
示例#3
0
def features(Signal=None, SamplingRate=1000., Filter={}):
    """
    Retrieves relevant EDA signal features.

    Kwargs:
        Signal (array): input EDA signal
        
        SamplingRate (float): sampling frequency (Hz)
        
        Filter (dict): Filter parameters

    Kwrvals:
        Signal (array): output filtered signal (see notes 1)
        
        Amplitude (array): signal pulses amplitudes (in the units of the input signal)
        
        Onset (array): indexes (or instants in seconds, see notes 2.a) of the SCRs onsets
        
        Peak (array): indexes (or instants in seconds, see notes 2.a) of the SCRs peaks	
        
        Rise (array): SCRs rise times (in seconds)
        
        HalfRecovery (array): SCRs half-recovery times (in seconds)
        
        mean (float): mean
        
        std (float): standard deviation
        
        var (float): variance
        
        skew (ndarry): skewness
        
        kurtosis (array): kurtosis
        
        ad (float): absolute deviation	

    Configurable fields:{"name": "eda.features", "config": {"SamplingRate": "1000."}, "inputs": ["Signal", "Filter"], "outputs": ["Signal", "Amplitude", "Onset", "Peak", "Rise", "HalfRecovery", "mean", "std", "var", "skew", "kurtosis", "ad"]}

    See Also:
        filt
        models.basicSCR
        tls.statsf

    Notes:
        1 - If a filter is given as a parameter, then the returned keyworded values dict has a 'Signal' key.
        
        2 - If the sampling rate is defined, then:
            a) keys 'onset', and 'peak' are converted to instants of occurrence in seconds.

    Example:


    References:
        .. [1]	
        
    """
    # Check
    if Signal is None:
        raise TypeError, "An input signal is needed."
    if Filter:
        Filter.update({'Signal': Signal})
        if not Filter.has_key('SamplingRate'):
            Filter.update({'SamplingRate': SamplingRate})
        Signal = filt(**Filter)['Signal']
    # Init
    kwrvals = {}
    # Feature Extraction
    res = scr(Signal=Signal, SamplingRate=SamplingRate)
    for k in res:
        kwrvals[k] = res[k]
    res = tls.statsf(Signal=Signal)
    for k in res:
        kwrvals[k] = res[k]
    # Out
    return kwrvals