Added Light Bugfix, testing and testcase docs
parent
9e1af86c0b
commit
6d37402ee4
|
@ -72,3 +72,10 @@ WIFI
|
||||||
- An option of 5 access point devices is randomly distributed throughout the data records.
|
- An option of 5 access point devices is randomly distributed throughout the data records.
|
||||||
- There is one raw WIFI data file each, for testing both iOS and Android data formats.
|
- There is one raw WIFI data file each, for testing both iOS and Android data formats.
|
||||||
- There is also an additional empty data file for both android and iOS for testing empty data files.
|
- There is also an additional empty data file for both android and iOS for testing empty data files.
|
||||||
|
|
||||||
|
Light
|
||||||
|
"""""""
|
||||||
|
|
||||||
|
- The raw light data file contains data for 1 day.
|
||||||
|
- The raw light data contains 3 or 4 rows of data for each ``epoch`` except ``night``. The single row of data for ``night`` is for testing features for single values inputs. (Example testing the standard deviation of one input value)
|
||||||
|
- Since light is only available for Android there is only one file that constains data for Android. All other files (i.e. for iPhone) are empty data files.
|
|
@ -1,4 +1,5 @@
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
def base_light_features(light_data, day_segment, requested_features):
|
def base_light_features(light_data, day_segment, requested_features):
|
||||||
# name of the features this function can compute
|
# name of the features this function can compute
|
||||||
|
@ -26,7 +27,7 @@ def base_light_features(light_data, day_segment, requested_features):
|
||||||
if "medianlux" in features_to_compute:
|
if "medianlux" in features_to_compute:
|
||||||
light_features["light_" + day_segment + "_medianlux"] = light_data.groupby(["local_date"])["double_light_lux"].median()
|
light_features["light_" + day_segment + "_medianlux"] = light_data.groupby(["local_date"])["double_light_lux"].median()
|
||||||
if "stdlux" in features_to_compute:
|
if "stdlux" in features_to_compute:
|
||||||
light_features["light_" + day_segment + "_stdlux"] = light_data.groupby(["local_date"])["double_light_lux"].std()
|
light_features["light_" + day_segment + "_stdlux"] = light_data.groupby(["local_date"])["double_light_lux"].std().fillna('NA')
|
||||||
|
|
||||||
light_features = light_features.reset_index()
|
light_features = light_features.reset_index()
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,11 @@ if config["WIFI"]["COMPUTE"]:
|
||||||
files_to_compute.extend(expand("data/raw/{pid}/{sensor}_with_datetime.csv", pid=config["PIDS"], sensor=config["WIFI"]["DB_TABLE"]))
|
files_to_compute.extend(expand("data/raw/{pid}/{sensor}_with_datetime.csv", pid=config["PIDS"], sensor=config["WIFI"]["DB_TABLE"]))
|
||||||
files_to_compute.extend(expand("data/processed/{pid}/wifi_{day_segment}.csv", pid = config["PIDS"], day_segment = config["WIFI"]["DAY_SEGMENTS"]))
|
files_to_compute.extend(expand("data/processed/{pid}/wifi_{day_segment}.csv", pid = config["PIDS"], day_segment = config["WIFI"]["DAY_SEGMENTS"]))
|
||||||
|
|
||||||
|
if config["LIGHT"]["COMPUTE"]:
|
||||||
|
files_to_compute.extend(expand("data/raw/{pid}/{sensor}_raw.csv", pid=config["PIDS"], sensor=config["LIGHT"]["DB_TABLE"]))
|
||||||
|
files_to_compute.extend(expand("data/raw/{pid}/{sensor}_with_datetime.csv", pid=config["PIDS"], sensor=config["LIGHT"]["DB_TABLE"]))
|
||||||
|
files_to_compute.extend(expand("data/processed/{pid}/light_{day_segment}.csv", pid = config["PIDS"], day_segment = config["LIGHT"]["DAY_SEGMENTS"]))
|
||||||
|
|
||||||
rule all:
|
rule all:
|
||||||
input:
|
input:
|
||||||
files_to_compute
|
files_to_compute
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
local_date,light_afternoon_count,light_afternoon_maxlux,light_afternoon_minlux,light_afternoon_avglux,light_afternoon_medianlux,light_afternoon_stdlux
|
||||||
|
2020-07-04,4,97656.0,10351.0,55761.5,57519.5,44778.68551368311
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
local_date,light_daily_count,light_daily_maxlux,light_daily_minlux,light_daily_avglux,light_daily_medianlux,light_daily_stdlux
|
||||||
|
2020-07-04,12,114615.0,0.065,40207.89508333333,19836.0,44686.69422566498
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
local_date,light_evening_count,light_evening_maxlux,light_evening_minlux,light_evening_avglux,light_evening_medianlux,light_evening_stdlux
|
||||||
|
2020-07-04,3,15258.0,84.156,5603.718666666667,1469.0,8389.476102441995
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
local_date,light_morning_count,light_morning_maxlux,light_morning_minlux,light_morning_avglux,light_morning_medianlux,light_morning_stdlux
|
||||||
|
2020-07-04,4,114615.0,472.52,60659.38,63775.0,51510.58234386665
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
local_date,light_night_count,light_night_maxlux,light_night_minlux,light_night_avglux,light_night_medianlux,light_night_stdlux
|
||||||
|
2020-07-04,1,0.065,0.065,0.065,0.065,NA
|
|
|
@ -0,0 +1 @@
|
||||||
|
local_date,light_afternoon_maxlux,light_afternoon_medianlux,light_afternoon_avglux,light_afternoon_stdlux,light_afternoon_minlux,light_afternoon_count
|
|
|
@ -0,0 +1 @@
|
||||||
|
local_date,light_daily_maxlux,light_daily_count,light_daily_minlux,light_daily_stdlux,light_daily_avglux,light_daily_medianlux
|
|
|
@ -0,0 +1 @@
|
||||||
|
local_date,light_evening_count,light_evening_avglux,light_evening_medianlux,light_evening_minlux,light_evening_maxlux,light_evening_stdlux
|
|
|
@ -0,0 +1 @@
|
||||||
|
local_date,light_morning_count,light_morning_stdlux,light_morning_minlux,light_morning_maxlux,light_morning_medianlux,light_morning_avglux
|
|
|
@ -0,0 +1 @@
|
||||||
|
local_date,light_night_stdlux,light_night_maxlux,light_night_avglux,light_night_count,light_night_medianlux,light_night_minlux
|
|
|
@ -0,0 +1 @@
|
||||||
|
local_date,light_afternoon_maxlux,light_afternoon_medianlux,light_afternoon_minlux,light_afternoon_stdlux,light_afternoon_count,light_afternoon_avglux
|
|
|
@ -0,0 +1 @@
|
||||||
|
local_date,light_daily_maxlux,light_daily_avglux,light_daily_count,light_daily_minlux,light_daily_medianlux,light_daily_stdlux
|
|
|
@ -0,0 +1 @@
|
||||||
|
local_date,light_evening_stdlux,light_evening_medianlux,light_evening_maxlux,light_evening_count,light_evening_minlux,light_evening_avglux
|
|
|
@ -0,0 +1 @@
|
||||||
|
local_date,light_morning_stdlux,light_morning_medianlux,light_morning_maxlux,light_morning_minlux,light_morning_count,light_morning_avglux
|
|
|
@ -0,0 +1 @@
|
||||||
|
local_date,light_night_maxlux,light_night_medianlux,light_night_minlux,light_night_stdlux,light_night_count,light_night_avglux
|
|
|
@ -0,0 +1 @@
|
||||||
|
local_date,light_afternoon_avglux,light_afternoon_count,light_afternoon_maxlux,light_afternoon_medianlux,light_afternoon_minlux,light_afternoon_stdlux
|
|
|
@ -0,0 +1 @@
|
||||||
|
local_date,light_daily_avglux,light_daily_stdlux,light_daily_medianlux,light_daily_minlux,light_daily_maxlux,light_daily_count
|
|
|
@ -0,0 +1 @@
|
||||||
|
local_date,light_evening_avglux,light_evening_minlux,light_evening_maxlux,light_evening_medianlux,light_evening_stdlux,light_evening_count
|
|
|
@ -0,0 +1 @@
|
||||||
|
local_date,light_morning_minlux,light_morning_avglux,light_morning_stdlux,light_morning_medianlux,light_morning_count,light_morning_maxlux
|
|
|
@ -0,0 +1 @@
|
||||||
|
local_date,light_night_count,light_night_stdlux,light_night_minlux,light_night_medianlux,light_night_maxlux,light_night_avglux
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
timestamp,device_id,double_light_lux,accuracy,label
|
||||||
|
1593856800461,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,472.52,3,
|
||||||
|
1593863999053,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,37252,3,
|
||||||
|
1593871199794,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,90298,3,
|
||||||
|
1593878399891,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,114615,3,
|
||||||
|
1593878400002,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,97656,3,
|
||||||
|
1593885599119,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,90625,3,
|
||||||
|
1593892799453,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,24414,3,
|
||||||
|
1593899999082,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,10351,3,
|
||||||
|
1593900000724,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,15258,3,
|
||||||
|
1593907199287,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,1469,3,
|
||||||
|
1593921599301,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,84.156,3,
|
||||||
|
1593849599654,wYESbVwI-4GfR-G5I6-7iKL-tOmCKs02MBun,0.065,3,
|
|
|
@ -0,0 +1 @@
|
||||||
|
timestamp,device_id,double_light_lux,accuracy,label
|
|
|
@ -0,0 +1 @@
|
||||||
|
timestamp,device_id,double_light_lux,accuracy,label
|
|
|
@ -0,0 +1 @@
|
||||||
|
timestamp,device_id,double_light_lux,accuracy,label
|
|
|
@ -2,4 +2,4 @@ directory: ./
|
||||||
configfile: ./tests/settings/testing_config.yaml
|
configfile: ./tests/settings/testing_config.yaml
|
||||||
snakefile: ./tests/Snakefile
|
snakefile: ./tests/Snakefile
|
||||||
cores: 1
|
cores: 1
|
||||||
forcerun: [messages_features, call_features, screen_features, battery_features, bluetooth_features, wifi_features]
|
forcerun: [messages_features, call_features, screen_features, battery_features, bluetooth_features, wifi_features, light_features]
|
||||||
|
|
|
@ -2,13 +2,12 @@
|
||||||
# You must create a file for each participant named pXXX containing their device_id. This can be done manually or automatically
|
# You must create a file for each participant named pXXX containing their device_id. This can be done manually or automatically
|
||||||
PIDS: [test01, test02, test03, test04]
|
PIDS: [test01, test02, test03, test04]
|
||||||
|
|
||||||
|
|
||||||
# Global var with common day segments
|
# Global var with common day segments
|
||||||
DAY_SEGMENTS: &day_segments
|
DAY_SEGMENTS: &day_segments
|
||||||
[daily, morning, afternoon, evening, night]
|
[daily, morning, afternoon, evening, night]
|
||||||
|
|
||||||
PHONE_VALID_SENSED_BINS:
|
PHONE_VALID_SENSED_BINS:
|
||||||
TABLES: [messages, calls, screen, battery, bluetooth, wifi]
|
TABLES: [messages, calls, screen, battery, bluetooth, wifi, light]
|
||||||
|
|
||||||
# Communication SMS features config, TYPES and FEATURES keys need to match
|
# Communication SMS features config, TYPES and FEATURES keys need to match
|
||||||
MESSAGES:
|
MESSAGES:
|
||||||
|
@ -56,3 +55,9 @@ WIFI:
|
||||||
DB_TABLE: wifi
|
DB_TABLE: wifi
|
||||||
DAY_SEGMENTS: *day_segments
|
DAY_SEGMENTS: *day_segments
|
||||||
FEATURES: ["countscans", "uniquedevices", "countscansmostuniquedevice"]
|
FEATURES: ["countscans", "uniquedevices", "countscansmostuniquedevice"]
|
||||||
|
|
||||||
|
LIGHT:
|
||||||
|
COMPUTE: True
|
||||||
|
DB_TABLE: light
|
||||||
|
DAY_SEGMENTS: *day_segments
|
||||||
|
FEATURES: ["count", "maxlux", "minlux", "avglux", "medianlux", "stdlux"]
|
||||||
|
|
Loading…
Reference in New Issue