def query_groundtruth(hs, qcx, query_cfg=None, **kwargs): 'wrapper that restricts query to only known groundtruth' print('\n====================') print('[hs] query groundtruth') print('====================') if query_cfg is None: hs.assert_prefs() query_cfg = hs.prefs.query_cfg if len(kwargs) > 0: query_cfg = query_cfg.deepcopy(**kwargs) qdat = hs.qdat qdat.set_cfg(query_cfg) gt_cxs = hs.get_other_indexed_cxs(qcx) qdat.dcxs = gt_cxs print('[mc3] len(gt_cxs) = %r' % (gt_cxs,)) return mc3.query_dcxs(hs, qcx, gt_cxs, qdat)
def query_groundtruth(hs, qcx, query_cfg=None, **kwargs): 'wrapper that restricts query to only known groundtruth' print('\n====================') print('[hs] query groundtruth') print('====================') if query_cfg is None: hs.assert_prefs() query_cfg = hs.prefs.query_cfg if len(kwargs) > 0: query_cfg = query_cfg.deepcopy(**kwargs) qdat = hs.qdat qdat.set_cfg(query_cfg) gt_cxs = hs.get_other_indexed_cxs(qcx) qdat.dcxs = gt_cxs print('[mc3] len(gt_cxs) = %r' % (gt_cxs, )) return mc3.query_dcxs(hs, qcx, gt_cxs, qdat)
def query_database(hs, qcx, query_cfg=None, dochecks=True, **kwargs): 'queries the entire (sampled) database' print('\n====================') print('[hs] query database') print('====================') if query_cfg is None: hs.assert_prefs() query_cfg = hs.prefs.query_cfg if len(kwargs) > 0: query_cfg = query_cfg.deepcopy(**kwargs) qdat = hs.qdat qdat.set_cfg(query_cfg) dcxs = hs.get_indexed_sample() try: res = mc3.query_dcxs(hs, qcx, dcxs, hs.qdat, dochecks=dochecks) except mf.QueryException as ex: msg = '[hs] Query Failure: %r' % ex print(msg) if hs.args.strict: raise return msg return res