From 51c7739bfc87e6e90e462b401743c64f1e2de47f Mon Sep 17 00:00:00 2001 From: JulioV Date: Sun, 20 Dec 2020 16:29:40 -0500 Subject: [PATCH] Revert "Start support for phone_keyboard" This reverts commit dd95b4f941b22886f6760404777eebc19954e899. --- Snakefile | 9 ----- config.yaml | 9 ----- rules/features.smk | 26 -------------- src/features/phone_keyboard/rapids/main.py | 40 ---------------------- 4 files changed, 84 deletions(-) delete mode 100644 src/features/phone_keyboard/rapids/main.py diff --git a/Snakefile b/Snakefile index d9ab9c1b..04882a79 100644 --- a/Snakefile +++ b/Snakefile @@ -100,15 +100,6 @@ for provider in config["PHONE_LIGHT"]["PROVIDERS"].keys(): files_to_compute.extend(expand("data/processed/features/{pid}/all_sensor_features.csv", pid=config["PIDS"])) files_to_compute.append("data/processed/features/all_participants/all_sensor_features.csv") -for provider in config["PHONE_KEYBOARD"]["PROVIDERS"].keys(): - if config["PHONE_KEYBOARD"]["PROVIDERS"][provider]["COMPUTE"]: - files_to_compute.extend(expand("data/raw/{pid}/phone_keyboard_raw.csv", pid=config["PIDS"])) - files_to_compute.extend(expand("data/raw/{pid}/phone_keyboard_with_datetime.csv", pid=config["PIDS"])) - files_to_compute.extend(expand("data/interim/{pid}/phone_keyboard_features/phone_keyboard_{language}_{provider_key}.csv", pid=config["PIDS"], language=config["PHONE_KEYBOARD"]["PROVIDERS"][provider]["SRC_LANGUAGE"].lower(), provider_key=provider.lower())) - files_to_compute.extend(expand("data/processed/features/{pid}/phone_keyboard.csv", pid=config["PIDS"],)) - files_to_compute.extend(expand("data/processed/features/{pid}/all_sensor_features.csv", pid=config["PIDS"])) - files_to_compute.append("data/processed/features/all_participants/all_sensor_features.csv") - for provider in config["PHONE_ACCELEROMETER"]["PROVIDERS"].keys(): if config["PHONE_ACCELEROMETER"]["PROVIDERS"][provider]["COMPUTE"]: files_to_compute.extend(expand("data/raw/{pid}/phone_accelerometer_raw.csv", pid=config["PIDS"])) diff --git a/config.yaml b/config.yaml index e712e90b..b216b5d1 100644 --- a/config.yaml +++ b/config.yaml @@ -189,15 +189,6 @@ PHONE_DATA_YIELD: SRC_LANGUAGE: "r" SRC_FOLDER: "rapids" # inside src/features/phone_data_yield -PHONE_KEYBOARD: - TABLE: keyboard - PROVIDERS: - RAPIDS: - COMPUTE: False - FEATURES: [] - SRC_FOLDER: "rapids" # inside src/features/phone_keyboard - SRC_LANGUAGE: "python" - # See https://www.rapids.science/latest/features/phone-light/ PHONE_LIGHT: TABLE: light diff --git a/rules/features.smk b/rules/features.smk index bcfd72fe..c106912f 100644 --- a/rules/features.smk +++ b/rules/features.smk @@ -262,32 +262,6 @@ rule phone_light_r_features: script: "../src/features/entry.R" -rule phone_keyboard_python_features: - input: - sensor_data = "data/raw/{pid}/phone_keyboard_with_datetime.csv", - time_segments_labels = "data/interim/time_segments/{pid}_time_segments_labels.csv" - params: - provider = lambda wildcards: config["PHONE_KEYBOARD"]["PROVIDERS"][wildcards.provider_key.upper()], - provider_key = "{provider_key}", - sensor_key = "phone_keyboard" - output: - "data/interim/{pid}/phone_keyboard_features/phone_keyboard_python_{provider_key}.csv" - script: - "../src/features/entry.py" - -rule phone_keyboard_r_features: - input: - sensor_data = "data/raw/{pid}/phone_keyboard_with_datetime.csv", - time_segments_labels = "data/interim/time_segments/{pid}_time_segments_labels.csv" - params: - provider = lambda wildcards: config["PHONE_KEYBOARD"]["PROVIDERS"][wildcards.provider_key.upper()], - provider_key = "{provider_key}", - sensor_key = "phone_keyboard" - output: - "data/interim/{pid}/phone_keyboard_features/phone_keyboard_r_{provider_key}.csv" - script: - "../src/features/entry.R" - rule phone_locations_python_features: input: sensor_data = "data/interim/{pid}/phone_locations_processed_with_datetime.csv", diff --git a/src/features/phone_keyboard/rapids/main.py b/src/features/phone_keyboard/rapids/main.py deleted file mode 100644 index 52dd4339..00000000 --- a/src/features/phone_keyboard/rapids/main.py +++ /dev/null @@ -1,40 +0,0 @@ -import pandas as pd -import numpy as np - -def rapids_features(sensor_data_files, time_segment, provider, filter_data_by_segment, *args, **kwargs): - - # I copied this from light, modify it to make it work for keyboard - - light_data = pd.read_csv(sensor_data_files["sensor_data"]) - print(light_data) - raise ValueError("Test") - requested_features = provider["FEATURES"] - # name of the features this function can compute - base_features_names = ["count", "maxlux", "minlux", "avglux", "medianlux", "stdlux"] - # the subset of requested features this function can compute - features_to_compute = list(set(requested_features) & set(base_features_names)) - - light_features = pd.DataFrame(columns=["local_segment"] + features_to_compute) - if not light_data.empty: - light_data = filter_data_by_segment(light_data, time_segment) - - if not light_data.empty: - light_features = pd.DataFrame() - if "count" in features_to_compute: - light_features["count"] = light_data.groupby(["local_segment"]).count()["timestamp"] - - # get light ambient luminance related features - if "maxlux" in features_to_compute: - light_features["maxlux"] = light_data.groupby(["local_segment"])["double_light_lux"].max() - if "minlux" in features_to_compute: - light_features["minlux"] = light_data.groupby(["local_segment"])["double_light_lux"].min() - if "avglux" in features_to_compute: - light_features["avglux"] = light_data.groupby(["local_segment"])["double_light_lux"].mean() - if "medianlux" in features_to_compute: - light_features["medianlux"] = light_data.groupby(["local_segment"])["double_light_lux"].median() - if "stdlux" in features_to_compute: - light_features["stdlux"] = light_data.groupby(["local_segment"])["double_light_lux"].std() - - light_features = light_features.reset_index() - - return light_features \ No newline at end of file