def evalKnownErrors(js, minmax, knownerrors): '''Given comuted info about an exam (js) and the minmax values and a list of user-defined knownerrors, create a dict of sensors and failtype to ignore''' ignore= {} for tid in [js['LToolID'], js['RToolID']]: if tid in knownerrors.keys(): snsr = knownerrors[tid][0] failtype = knownerrors[tid][1] minormax = minmax[snsr][knownerrors[tid][2]] #Implemented so that OutOfRanges could be direction specific if failtype == 'OutOfRange' and knownerrors[tid][2]=='min': if minormax > knownerrors[tid][3] and minormax < task_ranges[js['TaskType']][snsr]['min']: appendOrCreate(ignore, snsr, failtype) elif failtype == 'OutOfRange' and knownerrors[tid][2]=='max': if minormax < knownerrors[tid][3] and minormax > task_ranges[js['TaskType']][snsr]['max']: appendOrCreate(ignore, snsr, failtype) else: ignore[snsr] = [failtype] return ignore
def ignoreErrors(js, minmax, isClipApply): '''create dict of errors to ignore for simscore. include ignoring known errors as well as specific, user-identified commonplace, non-important errors''' #Ignore known errors ignore = evalKnownErrors(js, minmax, knownerrors) #Ignore dead FgL during ClipApply if isClipApply: appendOrCreate(ignore, 'Fg_L', 'DeadSensors') #Ignore really high Fg if ClipApply if minmax['Fg_R']['max'] > ranges['Fg_R']['max'] and minmax['Fg_R']['min'] > ranges['Fg_R']['min']: appendOrCreate(ignore, 'Fg_R', 'OutOfRange') #Ignore dead FgOffhand during Cutting if js["TaskType"] == 1: hand = 'R' if js["ProctorValues"]["LeftToolIsScissors"] else 'L' appendOrCreate(ignore, 'Fg_'+hand, 'DeadSensors') #DURING PRACTICE: #Ignore all Dead Fg if js['IsPractice']: appendOrCreate(ignore, 'Fg_L', 'DeadSensors') appendOrCreate(ignore, 'Fg_R', 'DeadSensors') return ignore