cerebralcortex.algorithms.signal_processing package

Submodules

cerebralcortex.algorithms.signal_processing.features module

complementary_filter(ds, freq: int = 16, accelerometer_x: str = 'accelerometer_x', accelerometer_y: str = 'accelerometer_y', accelerometer_z: str = 'accelerometer_z', gyroscope_x: str = 'gyroscope_x', gyroscope_y: str = 'gyroscope_y', gyroscope_z: str = 'gyroscope_z')[source]

Compute complementary filter on gyro and accel data.

Parameters:
  • ds (DataStream) – Non-Windowed/grouped dataframe
  • freq (int) – frequency of accel/gryo. Assumption is that frequency is equal for both gyro and accel.
  • accelerometer_x (str) – name of the column
  • accelerometer_y (str) – name of the column
  • accelerometer_z (str) – name of the column
  • gyroscope_x (str) – name of the column
  • gyroscope_y (str) – name of the column
  • gyroscope_z (str) – name of the column
compute_FFT_features(ds, exclude_col_names: list = [], feature_names=['fft_centroid', 'fft_spread', 'spectral_entropy', 'fft_flux', 'spectral_falloff'])[source]

Transforms data from time domain to frequency domain.

Parameters:
  • list (feature_names) – name of the columns on which features should not be computed
  • list – names of the features. Supported features are fft_centroid, fft_spread, spectral_entropy, spectral_entropy_old, fft_flux, spectral_falloff
  • windowDuration (int) – duration of a window in seconds
  • slideDuration (int) – slide duration of a window
  • List[str] (groupByColumnName) – groupby column names, for example, groupby user, col1, col2
  • startTime (datetime) – The startTime is the offset with respect to 1970-01-01 00:00:00 UTC with which to start window intervals. For example, in order to have hourly tumbling windows that start 15 minutes past the hour, e.g. 12:15-13:15, 13:15-14:15… provide startTime as 15 minutes. First time of data will be used as startTime if none is provided
Returns:

DataStream object with all the existing data columns and FFT features

compute_zero_cross_rate(ds, exclude_col_names: list = [], feature_names=['zero_cross_rate'])[source]

Compute statistical features.

Parameters:
  • ds (DataStream) – Windowed/grouped dataframe
  • list (feature_names) – name of the columns on which features should not be computed
  • list – names of the features. Supported features are [‘mean’, ‘median’, ‘stddev’, ‘variance’, ‘max’, ‘min’, ‘skew’, ‘kurt’, ‘sqr’, ‘zero_cross_rate’
  • windowDuration (int) – duration of a window in seconds
  • slideDuration (int) – slide duration of a window
  • List[str] (groupByColumnName) – groupby column names, for example, groupby user, col1, col2
  • startTime (datetime) – The startTime is the offset with respect to 1970-01-01 00:00:00 UTC with which to start window intervals. For example, in order to have hourly tumbling windows that start 15 minutes past the hour, e.g. 12:15-13:15, 13:15-14:15… provide startTime as 15 minutes. First time of data will be used as startTime if none is provided
Returns:

DataStream object

Module contents