stress_at_work_analysis/exploration/expl_light.py

74 lines
1.5 KiB
Python

# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.2
# kernelspec:
# display_name: straw2analysis
# language: python
# name: straw2analysis
# ---
# %%
import os
import sys
import seaborn as sns
from tabulate import tabulate
nb_dir = os.path.split(os.getcwd())[0]
if nb_dir not in sys.path:
sys.path.append(nb_dir)
import participants.query_db
# %%
from features.light import *
# %%
df_light_nokia = get_light_data(["nokia_0000003"])
print(df_light_nokia)
# %%
participants_inactive_usernames = participants.query_db.get_usernames()
df_light_inactive = get_light_data(participants_inactive_usernames)
# %%
df_light_inactive.accuracy.value_counts()
# %%
df_light_inactive.double_light_lux.describe()
# %%
df_light_plot = df_light_inactive.copy()
df_light_plot["double_light_lux"] = df_light_plot["double_light_lux"] + 1
sns.displot(
data=df_light_plot,
x="double_light_lux",
binwidth=0.1,
log_scale=(True, False),
height=8,
)
# %% [markdown]
# The official SensorManager Light constants are:
# * Cloudy sky: 100.0
# * Full moon: 0.25
# * No moon: 0.001
# * Overcast: 10000.0
# * Shade: 20000.0
# * Sunlight: 110000.0
# * Sunlight maximum: 120000.0
# * Sunrise: 400.0
#
# %%
df_light_low = df_light_inactive[df_light_inactive["double_light_lux"] <= 10]
sns.displot(data=df_light_low, x="double_light_lux", binwidth=0.5, height=8)
# %%