features/signal_features.py
def jerk_metric(signal_df, sampling_rate, channels):
    '''
    Calculate jerk of sensor signals.

    :param signal_df: Pandas DataFrame housing desired sensor signals
    :param sampling_rate: sampling rate of sensor signals
    :param channels: channels of sensor signal to compute jerk
    :return: Pandas DataFrame of calculated jerk for each sensor channel
    '''
    jerk_ratio_df = pd.DataFrame()

    dt = 1. / sampling_rate
    duration = len(signal_df) * dt

    for channel in channels:
        amplitude = max(abs(signal_df[channel]))

        jerk = signal_df[channel].diff(1) / dt
        jerk_squared = jerk ** 2
        jerk_squared_sum = jerk_squared.sum(axis=0)
        scale = 360 * amplitude ** 2 / duration

        mean_squared_jerk = jerk_squared_sum * dt / (duration * 2)

        jerk_ratio_df[channel + '_jerk_ratio'] = [mean_squared_jerk / scale]

    return jerk_ratio_df

    Calculate jerk of sensor signals.

    :param signal_df: Pandas DataFrame housing desired sensor signals
    :param sampling_rate: sampling rate of sensor signals
    :param channels: channels of sensor signal to compute jerk
    :return: Pandas DataFrame of calculated jerk for each sensor channel
    
Calculate jerk of sensor signals.
Calculate jerk of sensor signals .
def jerk_metric(signal_df, sampling_rate, channels):
    jerk_ratio_df = pd.DataFrame()
    dt = 1. / sampling_rate
    duration = len(signal_df) * dt
    for channel in channels:
        amplitude = max(abs(signal_df[channel]))
        jerk = signal_df[channel].diff(1) / dt
        jerk_squared = jerk ** 2
        jerk_squared_sum = jerk_squared.sum(axis=0)
        scale = 360 * amplitude ** 2 / duration
        mean_squared_jerk = jerk_squared_sum * dt / (duration * 2)
        jerk_ratio_df[channel + '_jerk_ratio'] = [mean_squared_jerk / scale]
    return jerk_ratio_df
def jerk_metric ( signal_df , sampling_rate , channels ) : jerk_ratio_df = pd . DataFrame ( ) dt = 1. / sampling_rate duration = len ( signal_df ) * dt for channel in channels : amplitude = max ( abs ( signal_df [ channel ] ) ) jerk = signal_df [ channel ] . diff ( 1 ) / dt jerk_squared = jerk ** 2 jerk_squared_sum = jerk_squared . sum ( axis = 0 ) scale = 360 * amplitude ** 2 / duration mean_squared_jerk = jerk_squared_sum * dt / ( duration * 2 ) jerk_ratio_df [ channel + '_jerk_ratio' ] = [ mean_squared_jerk / scale ] return jerk_ratio_df
Calculate jerk of sensor signals.
Calculate jerk of sensor signals .
'''
    Calculate jerk of sensor signals.

    :param signal_df: Pandas DataFrame housing desired sensor signals
    :param sampling_rate: sampling rate of sensor signals
    :param channels: channels of sensor signal to compute jerk
    :return: Pandas DataFrame of calculated jerk for each sensor channel
    '''
Pandas DataFrame of calculated jerk for each sensor channel
Pandas DataFrame of calculated jerk for each sensor channel
signal_df
Pandas DataFrame housing desired sensor signals
Pandas DataFrame housing desired sensor signals
sampling_rate
sampling rate of sensor signals
sampling rate of sensor signals
channels
channels of sensor signal to compute jerk
channels of sensor signal to compute jerk