cerebralcortex.markers.brushing package

Submodules

cerebralcortex.markers.brushing.features module

compute_corr_mse_accel_gyro(self, exclude_col_names: list = [], accel_column_names: list = ['accelerometer_x', 'accelerometer_y', 'accelerometer_z'], gyro_column_names: list = ['gyroscope_y', 'gyroscope_x', 'gyroscope_z'], windowDuration: int = None, slideDuration: int = None, groupByColumnName: List[str] = [], startTime=None)[source]

Compute correlation and mean standard error of accel and gyro sensors

Parameters:
  • list (gyro_column_names) – name of the columns on which features should not be computed
  • list – name of accel data column
  • list – name of gyro data column
  • 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_fourier_features(self, exclude_col_names: list = [], feature_names=['fft_centroid', 'fft_spread', 'spectral_entropy', 'spectral_entropy_old', 'fft_flux', 'spectral_falloff'], windowDuration: int = None, slideDuration: int = None, groupByColumnName: List[str] = [], startTime=None)[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

cerebralcortex.markers.brushing.main module

generate_candidates(CC, user_id, accel_stream_name, gyro_stream_name, output_stream_name)[source]
generate_features(CC, user_id, candidate_stream_name, output_stream_name)[source]
predict_brushing(CC, user_id, features_stream_name)[source]

cerebralcortex.markers.brushing.util module

classify_brushing(X: pandas.core.frame.DataFrame, model_file_name: str)[source]
filter_candidates(ds)[source]
get_candidates(ds, uper_limit: float = 0.1, threshold: float = 0.5)[source]

Get brushing candidates. Data is windowed into potential brushing candidate :param ds: :type ds: DataStream :param uper_limit: threashold for accel. This is used to know how high the hand is :type uper_limit: float :param threshold: :type threshold: float

Returns:

get_max_features(ds)[source]

This method will compute what are the max values for accel and gyro statistical/FFT features :param ds: :type ds: DataStream

Returns:DataStream
get_orientation_data(ds, wrist, ori=1, is_new_device=False, accelerometer_x='accelerometer_x', accelerometer_y='accelerometer_y', accelerometer_z='accelerometer_z', gyroscope_x='gyroscope_x', gyroscope_y='gyroscope_y', gyroscope_z='gyroscope_z')[source]

Get the orientation of hand using accel and gyro data. :param ds: DataStream object :param wrist: name of the wrist smart watch was worn :param ori: :param is_new_device: this param is for motionsense smart watch version :param accelerometer_x: :type accelerometer_x: float :param accelerometer_y: :type accelerometer_y: float :param accelerometer_z: :type accelerometer_z: float :param gyroscope_x: :type gyroscope_x: float :param gyroscope_y: :type gyroscope_y: float :param gyroscope_z: :type gyroscope_z: float

Returns:DataStream object
reorder_columns(ds)[source]

Module contents