def load_experiment(data_path, diary_path, start_hour): # Configure an Experiment exp = Experiment() # Iterates over a set of files in a directory. # Unfortunately, we have to do it manually with RawProcessing because we are modifying the annotations for file in glob(data_path): pp = RawProcessing( file, # HR information col_for_hr="HR", # Activity information cols_for_activity=["Axis1", "Axis2", "Axis3"], is_act_count=False, # Datetime information col_for_datetime="time", strftime="%Y-%b-%d %H:%M:%S", # Participant information col_for_pid="pid") w = Wearable(pp) # Creates a wearable from a pp object exp.add_wearable(w) # Set frequency for every wearable in the collection # exp.set_freq_in_secs(5) # Changing the hour the experiment starts from midnight (0) to 3pm (15) exp.change_start_hour_for_experiment_day(start_hour) diary = Diary().from_file(diary_path) exp.add_diary(diary) return exp
def load_experiment(data_path, diary_path, start_hour): # Configure an Experiment exp = Experiment() # Iterates over a set of files in a directory. # Unfortunately, we have to do it manually with RawProcessing because we are modifying the annotations print("Running %s" % data_path) for file in glob(data_path): print("FILE", file) pp = RawProcessing(file, cols_for_activity=["stdMET_highIC_Branch"], is_act_count=False, col_for_datetime="REALTIME", strftime="%d-%b-%Y %H:%M:%S", col_for_pid="id", col_for_hr="mean_hr", device_location="dw") pp.data["hyp_act_x"] = pp.data[ "hyp_act_x"] - 1.0 # adjust for the BBVA dataset w = Wearable(pp) # Creates a wearable from a pp object exp.add_wearable(w) # Set frequency for every wearable in the collection exp.set_freq_in_secs(60) # Changing the hour the experiment starts from midnight (0) to 3pm (15) exp.change_start_hour_for_experiment_day(start_hour) diary = Diary().from_file(diary_path) exp.add_diary(diary) return exp
def setup_experiment(file_path, diary_path, start_hour): # Configure an Experiment exp = Experiment() # Iterates over a set of files in a directory. # Unfortunately, we have to do it manually with RawProcessing because we are modifying the annotations for file in glob(file_path): pp = RawProcessing(file, device_location="dw", # HR information col_for_hr="mean_hr", # Activity information cols_for_activity=["activity"], is_act_count=True, # Datetime information col_for_datetime="linetime", strftime="%Y-%m-%d %H:%M:%S", # Participant information col_for_pid="mesaid") w = Wearable(pp) # Creates a wearable from a pp object # Invert the two_stages flag. Now True means sleeping and False means awake w.data["hyp_annotation"] = (w.data["stages"] > 0) exp.add_wearable(w) exp.set_freq_in_secs(30) w.change_start_hour_for_experiment_day(start_hour) diary = Diary().from_file(diary_path) exp.add_diary(diary) return exp
def setup_experiment(file_path, diary_path, start_hour): # Configure an Experiment exp = Experiment() # Iterates over a set of files in a directory. # Unfortunately, we have to do it manually with RawProcessing because we are modifying the annotations for file in glob(file_path): pp = MESAPreProcessing(file) w = Wearable(pp) # Creates a wearable from a pp object # Invert the two_stages flag. Now True means sleeping and False means awake w.data["interval_sleep"] = w.data["interval"].isin(["REST-S", "REST"]) exp.add_wearable(w) exp.set_freq_in_secs(30) w.change_start_hour_for_experiment_day(start_hour) diary = Diary().from_file(diary_path) exp.add_diary(diary) return exp