def get_data(pre_win, post_win): settings = setup(dataset='test', data_loc='./data/controlIntervention/', subject_n=3) data = Dataset( settings, trim=True, check=False, used_data_types=[DATA_TYPES.event, DATA_TYPES.fitbit] ) minutes = post_win+pre_win PNUM = 0 bars = [] for evt in data.subject_data[0].event_data.time: time = evt-timedelta(minutes=pre_win) bars.append(data.get_steps_after_time(time, minutes, PNUM)) pids = [1]*len(bars) # all events are same participant return minutes, pids, bars
def get_fake_data(pre_win, post_win, minutes, pids, bars): # returns data from randomly chosen fake data points settings = setup(dataset='test', data_loc='./data/controlIntervention/', subject_n=3) data = Dataset( settings, trim=True, check=False, used_data_types=[DATA_TYPES.event, DATA_TYPES.fitbit] ) PNUM = 0 fake_bars = [] for evt in data.subject_data[0].event_data.time: time = evt-timedelta(days=1, minutes=pre_win) # get random(ish) time fake_bars.append(data.get_steps_after_time(time, minutes, PNUM)) diff_bars = [] for i in range(len(bars)): diff_bars.append(list_subtract(bars[i], fake_bars[i])) return minutes, pids, diff_bars