import sys import os from tools import Logger log_dir = '' log_dir += sys.argv[1] if log_dir is '': print('[ERROR] Please provide the log directory') exit() log = Logger(log_dir, '*log_of_logs.log', printLog=True, timestampOn=False) log.emit('NEW STATUS REPORT', newRun=True) filenames = os.listdir(log_dir) filenames.sort() sleepsightLogs = [] for filename in filenames: if 'sleepsight' in filename: ssLog = Logger(log_dir, filename) log.emit('{}\t{}'.format(filename, ssLog.getLastMessage()))
path = args[2] plot_path = args[3] log_path = args[4] p = Participant(id=participantID, path=path) p.activeSensingFilenameSelector = 'diary' p.metaDataFileName = 'meta_patients.json' p.sleepSummaryFileName = 'FB_sleep_summary.csv' p.load() p.pipelineStatus['GP model sim.'] = False #p.saveSnapshot(p.path) print(p) log = Logger(log_path, 'sleepsight' + p.id + '.log', printLog=True) log.emit('BEGIN ANALYSIS PIPELINE', newRun=True) # Task: 'trim data' to Study Duration if not p.isPipelineTaskCompleted('trim data'): log.emit('Continuing with TRIM DATA...') p.trimData(p.info['startDate'], duration=56) p.updatePipelineStatusForTask('trim data', log=log) p.saveSnapshot(path, log=log) else: log.emit('Skipping TRIM DATA - already completed.') # Task: 'missingness' (Decision tree: No missingness vs not worn vs not charged) if not p.isPipelineTaskCompleted('missingness'): log.emit('Continuing with MISSINGNESS computation...') mdt = MissingnessDT(passiveData=p.passiveData, activeDataSymptom=p.activeDataSymptom,
options = {'periodicity': False, 'participant-info': False, 'compliance': False, 'stationarity': False, 'symptom-score-discretisation': False, 'feature-delay': False, 'feature-selection': False, 'non-parametric-svm': False, 'non-parametric-gp': True } log = Logger(log_path, 'thesis_outputs.log', printLog=True) # Load Participants log.emit('Loading participants...', newRun=True) aggr = T.Aggregates('.pkl', path, plot_path) # Export Periodicity tables if options['periodicity']: log.emit('Generating PERIODCITY table...') pt = T.PeriodictyTable(aggr, log) pt.run() pt.exportLatexTable(summary=False) pt.exportLatexTable(summary=True) # Export Participant Info if options['participant-info']: log.emit('Generating PARTICIPANTS-INFO table...')