def check_violations(thermdict, t1, t2): """Check a list of MSIDs for limit/expected state violations. :param thermdict: Dictionary of MSID information (MSID name, condition type, etc.) :param t1: String containing start date in HOSC format :param t2: String containgin stop date in HOSC format Note: The thermdict object is structured with each 'Ska' msid as the primary key for each sub-dictionary. Each sub-dictionary has these keys: 'type', 'greta_msid'. The type is either 'limit' or 'expst'. The greta_msid is used to identify the mnemonic used by GRETA which in some cases differs from the mnemonic used by Ska (e.g. widerange thermal MSIDs). """ t1 = DateTime(t1).date t2 = DateTime(t2).date allviolations = {} missingmsids = [] checkedmsids = [] for key in thermdict.keys(): greta_msid = thermdict[key]['greta_msid'] try: if thermdict[key]['type'] == 'limit': if "wide" in greta_msid.lower(): violations = handle_widerange_cases(key, t1, t2, greta_msid) checkedmsids.append(key) else: violations = pylimmon.check_limit_msid(key, t1, t2, greta_msid=greta_msid) checkedmsids.append(key) elif thermdict[key]['type'] == 'expst': violations = pylimmon.check_state_msid(key, t1, t2, greta_msid=greta_msid) checkedmsids.append(key) if len(violations) > 0: allviolations[key] = process_violations(key, violations) except IndexError: print('{} not in DB'.format(key)) missingmsids.append(key) return allviolations, missingmsids, checkedmsids
def check_violations(thermdict, t1, t2): """Check a list of MSIDs for limit/expected state violations. :param thermdict: Dictionary of MSID information (MSID name, condition type, etc.) :param t1: String containing start date in HOSC format :param t2: String containgin stop date in HOSC format """ t1 = DateTime(t1).date t2 = DateTime(t2).date allviolations = {} missingmsids = [] checkedmsids = [] for key in thermdict.keys(): greta_msid = thermdict[key]['greta_msid'] try: if thermdict[key]['type'] == 'limit': if "wide" in greta_msid.lower(): violations = handle_widerange_cases( key, t1, t2, greta_msid) checkedmsids.append(key) else: violations = pylimmon.check_limit_msid( key, t1, t2, greta_msid=greta_msid) checkedmsids.append(key) elif thermdict[key]['type'] == 'expst': violations = pylimmon.check_state_msid(key, t1, t2, greta_msid=greta_msid) checkedmsids.append(key) if len(violations) > 0: allviolations[key] = process_violations(key, violations) except IndexError: print('{} not in DB'.format(key)) missingmsids.append(key) return allviolations, missingmsids, checkedmsids
def check_violations(thermdict, t1, t2): """Check a list of MSIDs for limit/expected state violations. :param thermdict: Dictionary of MSID information (MSID name, condition type, etc.) :param t1: String containing start date in HOSC format :param t2: String containgin stop date in HOSC format """ t1 = DateTime(t1).date t2 = DateTime(t2).date allviolations = {} missingmsids = [] checkedmsids = [] for key in thermdict.keys(): greta_msid = thermdict[key]['greta_msid'] try: if thermdict[key]['type'] == 'limit': if "wide" in greta_msid.lower(): violations = handle_widerange_cases(key, t1, t2, greta_msid) checkedmsids.append(key) else: violations = pylimmon.check_limit_msid(key, t1, t2, greta_msid=greta_msid) checkedmsids.append(key) elif thermdict[key]['type'] == 'expst': violations = pylimmon.check_state_msid(key, t1, t2, greta_msid=greta_msid) checkedmsids.append(key) if len(violations) > 0: allviolations[key] = process_violations(key, violations) except IndexError: print('{} not in DB'.format(key)) missingmsids.append(key) return allviolations, missingmsids, checkedmsids