Skip to content

Commit

Permalink
Changes to CGM Generator
Browse files Browse the repository at this point in the history
  • Loading branch information
TrafficCop committed Feb 29, 2024
1 parent e128fc3 commit f7d9406
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions wearipedia/devices/nutrisense/cgm_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def gen_data(start_date, end_date, seed=0):
summary = gen_summary(Y)
stat = {
"today": gen_stats(Y),
"average": gen_stats(Y, weekly=True),
"average": gen_stats(Y, weekly=True, seed=seed),
}
return (scores, continuous, summary, stat)

Expand Down Expand Up @@ -81,9 +81,9 @@ def gen_glucose(t, index, seed=0):
Y.append(y)

added = local_rng.normal(scale=1) * 10 + 0.01 * (160 / y)
if y < 80:
if y < 95:
added = abs(added)
elif y > 130:
elif y > 120:
added = -1 * abs(added)
y += added

Expand Down Expand Up @@ -149,7 +149,7 @@ def gen_scores():
return score


def gen_stats(Y, weekly=False):
def gen_stats(Y, weekly=False, seed=0):
"""Generate random scores for the daily statistics
:param Y: the synthetic sensor data
Expand Down Expand Up @@ -188,8 +188,8 @@ def gen_stats(Y, weekly=False):
"healthyRange": first,
"range": second,
"timeWithinRange": timeWithinRange,
"min": max(70, low),
"max": min(140, high),
"min": low,
"max": high,
"mean": avg,
"median": median,
"standardDeviation": std,
Expand Down

0 comments on commit f7d9406

Please sign in to comment.