minor jawbone fixes
This commit is contained in:
parent
46bdcc0b6b
commit
8ebb93e242
2 changed files with 19 additions and 14 deletions
|
@ -209,7 +209,7 @@ def sleeps_by_date() -> Dict[date, SleepEntry]:
|
||||||
# sleeps = sleeps[:sleeps_count]
|
# sleeps = sleeps[:sleeps_count]
|
||||||
# dt = {k: v for k, v in dt.items() if v is not None}
|
# dt = {k: v for k, v in dt.items() if v is not None}
|
||||||
|
|
||||||
# TODO ??
|
# TODO not really sure it belongs here...
|
||||||
# import melatonin
|
# import melatonin
|
||||||
# dt = melatonin.get_data()
|
# dt = melatonin.get_data()
|
||||||
|
|
||||||
|
|
31
main.py
31
main.py
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3.6
|
#!/usr/bin/env python3
|
||||||
# TODO
|
# TODO
|
||||||
from kython import *
|
from kython import *
|
||||||
from kython.plotting import *
|
# from kython.plotting import *
|
||||||
from csv import DictReader
|
from csv import DictReader
|
||||||
from itertools import islice
|
from itertools import islice
|
||||||
|
|
||||||
|
@ -87,10 +87,12 @@ def iter_useful(data_file: str):
|
||||||
|
|
||||||
# TODO <<< hmm. these files do contain deep and light sleep??
|
# TODO <<< hmm. these files do contain deep and light sleep??
|
||||||
# also steps stats??
|
# also steps stats??
|
||||||
|
p = Path('/L/backups/jawbone/old_csv')
|
||||||
|
# TODO with_my?
|
||||||
files = [
|
files = [
|
||||||
"/L/Dropbox/backups/jawbone/2015.csv",
|
p / "2015.csv",
|
||||||
"/L/Dropbox/backups/jawbone/2016.csv",
|
p / "2016.csv",
|
||||||
"/L/Dropbox/backups/jawbone/2017.csv",
|
p / "2017.csv",
|
||||||
]
|
]
|
||||||
|
|
||||||
useful = concat(*(list(iter_useful(f)) for f in files))
|
useful = concat(*(list(iter_useful(f)) for f in files))
|
||||||
|
@ -104,10 +106,12 @@ useful = concat(*(list(iter_useful(f)) for f in files))
|
||||||
dates = [parse_date(u.date, yearfirst=True, dayfirst=False) for u in useful]
|
dates = [parse_date(u.date, yearfirst=True, dayfirst=False) for u in useful]
|
||||||
# TODO filter outliers?
|
# TODO filter outliers?
|
||||||
|
|
||||||
|
# TODO don't need this anymore? it's gonna be in dashboards package
|
||||||
|
from kython.plotting import plot_timestamped
|
||||||
for attr, lims, mavg, fig in [
|
for attr, lims, mavg, fig in [
|
||||||
# ('light', (0, 400), 5, None),
|
('light', (0, 400), 5, None),
|
||||||
# ('deep', (0, 600), 5, None),
|
('deep', (0, 600), 5, None),
|
||||||
# ('total', (200, 600), 5, None),
|
('total', (200, 600), 5, None),
|
||||||
('awake_time', (0, 1200), None, 1),
|
('awake_time', (0, 1200), None, 1),
|
||||||
('asleep_time', (-100, 1000), None, 1),
|
('asleep_time', (-100, 1000), None, 1),
|
||||||
# ('awakenings', (0, 5)),
|
# ('awakenings', (0, 5)),
|
||||||
|
@ -116,8 +120,8 @@ for attr, lims, mavg, fig in [
|
||||||
dates_wke = [d for d in dates if d.weekday() >= 5]
|
dates_wke = [d for d in dates if d.weekday() >= 5]
|
||||||
for dts, dn in [
|
for dts, dn in [
|
||||||
(dates, 'total'),
|
(dates, 'total'),
|
||||||
# (dates_wkd, 'weekday'),
|
(dates_wkd, 'weekday'),
|
||||||
# (dates_wke, 'weekend')
|
(dates_wke, 'weekend')
|
||||||
]:
|
]:
|
||||||
mavgs = []
|
mavgs = []
|
||||||
if mavg is not None:
|
if mavg is not None:
|
||||||
|
@ -130,9 +134,10 @@ for attr, lims, mavg, fig in [
|
||||||
mavgs=mavgs,
|
mavgs=mavgs,
|
||||||
ylimits=lims,
|
ylimits=lims,
|
||||||
ytick_size=60,
|
ytick_size=60,
|
||||||
figure=1,
|
# figure=1,
|
||||||
)
|
)
|
||||||
# plt.savefig(f'{attr}_{dn}.png')
|
plt.savefig(f'{attr}_{dn}.png')
|
||||||
|
|
||||||
plt.savefig('res.png')
|
# TODO use proper names?
|
||||||
|
# plt.savefig('res.png')
|
||||||
# fig.show()
|
# fig.show()
|
||||||
|
|
Loading…
Add table
Reference in a new issue