Start exploring light data.
parent
7de4beca6e
commit
67e2d233b0
|
@ -0,0 +1,73 @@
|
||||||
|
# ---
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
# %%
|
|
@ -2,7 +2,7 @@ from collections.abc import Collection
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
from config.models import Participant, LightSensor
|
from config.models import LightSensor, Participant
|
||||||
from setup import db_engine, session
|
from setup import db_engine, session
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue