From dbb59c4aef5c8826aa2ed79ad58f471fb0d85123 Mon Sep 17 00:00:00 2001 From: junos Date: Fri, 23 Jul 2021 18:28:02 +0200 Subject: [PATCH] Explore low levels of luminance. --- exploration/expl_light.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/exploration/expl_light.py b/exploration/expl_light.py index 5dc000c..b24ae26 100644 --- a/exploration/expl_light.py +++ b/exploration/expl_light.py @@ -6,7 +6,7 @@ # extension: .py # format_name: percent # format_version: '1.3' -# jupytext_version: 1.11.2 +# jupytext_version: 1.11.4 # kernelspec: # display_name: straw2analysis # language: python @@ -14,10 +14,13 @@ # --- # %% +# %matplotlib inline +import datetime import os import sys import seaborn as sns +from pytz import timezone from tabulate import tabulate nb_dir = os.path.split(os.getcwd())[0] @@ -26,9 +29,14 @@ if nb_dir not in sys.path: import participants.query_db +TZ_LJ = timezone("Europe/Ljubljana") + # %% from features.light import * +# %% [markdown] +# # Basic characteristics + # %% df_light_nokia = get_light_data(["nokia_0000003"]) print(df_light_nokia) @@ -40,6 +48,17 @@ df_light_inactive = get_light_data(participants_inactive_usernames) # %% df_light_inactive.accuracy.value_counts() +# %% [markdown] +# From [SensorManager](https://developer.android.com/reference/android/hardware/SensorManager.html#SENSOR_STATUS_ACCURACY_HIGH): +# +# ```java +# public static final int SENSOR_STATUS_ACCURACY_HIGH +# ``` +# +# This sensor is reporting data with maximum accuracy +# +# Constant Value: 3 (0x00000003) + # %% df_light_inactive.double_light_lux.describe() @@ -71,3 +90,15 @@ 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) # %% +df_light_very_low = df_light_low[df_light_low["double_light_lux"] < 0.5] +df_light_very_low.double_light_lux.value_counts() + +# %% +df_light_nokia["datetime_lj"] = df_light_nokia["timestamp"].apply( + lambda x: datetime.datetime.fromtimestamp(x / 1000.0, tz=TZ_LJ) +) +df_light_nokia.loc[df_light_nokia["double_light_lux"] == 0, ["datetime_lj"]] + +# %% [markdown] +# Zeroes are present during the day. It does happens when the sensor is physically blocked. +