def set_internal_masked_qaids(qreq_, masked_qaid_list): r""" used by the pipeline to execute a subset of the query request without modifying important state Example: >>> # ENABLE_DOCTEST >>> from wbia.algo.hots.query_request import * # NOQA >>> import utool as ut >>> import wbia >>> qaid_list = [1, 2, 3, 4] >>> daid_list = [1, 2, 3, 4] >>> qreq_ = wbia.testdata_qreq_(qaid_override=qaid_list, daid_override=daid_list, p='default:sv_on=True') >>> qaids = qreq_.get_internal_qaids() >>> ut.assert_lists_eq(qaid_list, qaids) >>> masked_qaid_list = [1, 2, 3,] >>> qreq_.set_internal_masked_qaids(masked_qaid_list) >>> new_internal_aids = qreq_.get_internal_qaids() >>> ut.assert_lists_eq(new_internal_aids, [4]) """ if masked_qaid_list is None or len(masked_qaid_list) == 0: qreq_.internal_qaids_mask = None else: # input denotes invalid elements mark all elements not in that # list as True flags = vt.get_uncovered_mask(qreq_.internal_qaids, masked_qaid_list) assert len(flags) == len(qreq_.internal_qaids), 'unequal len internal qaids' qreq_.internal_qaids_mask = flags
def set_internal_masked_qaids(qreq_, masked_qaid_list): r""" used by the pipeline to execute a subset of the query request without modifying important state Example: >>> # ENABLE_DOCTEST >>> from ibeis.algo.hots.query_request import * # NOQA >>> import utool as ut >>> from ibeis.algo.hots import pipeline >>> cfgdict1 = dict(codename='vsone', sv_on=True) >>> qaid_list = [1, 2, 3, 4] >>> daid_list = [1, 2, 3, 4] >>> ibs, qreq_ = plh.get_pipeline_testdata(cfgdict=cfgdict1, ... qaid_list=qaid_list, daid_list=daid_list) >>> qaids = qreq_.get_internal_qaids() >>> ut.assert_lists_eq(qaid_list, qaids) >>> masked_qaid_list = [1, 2, 3,] >>> qreq_.set_internal_masked_qaids(masked_qaid_list) >>> new_internal_aids = qreq_.get_internal_qaids() >>> ut.assert_lists_eq(new_internal_aids, [4]) """ if masked_qaid_list is None or len(masked_qaid_list) == 0: qreq_.internal_qaids_mask = None else: #with ut.EmbedOnException(): # input denotes invalid elements mark all elements not in that # list as True flags = vt.get_uncovered_mask(qreq_.internal_qaids, masked_qaid_list) assert len(flags) == len(qreq_.internal_qaids), ( 'unequal len internal qaids') qreq_.internal_qaids_mask = flags
def set_internal_masked_daids(qreq_, masked_daid_list): """ used by the pipeline to execute a subset of the query request without modifying important state """ if masked_daid_list is None or len(masked_daid_list) == 0: qreq_.internal_daids_mask = None else: # with ut.EmbedOnException(): # input denotes invalid elements mark all elements not in that # list as True flags = vt.get_uncovered_mask(qreq_.internal_daids, masked_daid_list) assert len(flags) == len(qreq_.internal_daids), 'unequal len internal daids' qreq_.internal_daids_mask = flags
def set_internal_masked_daids(qreq_, masked_daid_list): """ used by the pipeline to execute a subset of the query request without modifying important state """ if masked_daid_list is None or len(masked_daid_list) == 0: qreq_.internal_daids_mask = None else: #with ut.EmbedOnException(): # input denotes invalid elements mark all elements not in that # list as True flags = vt.get_uncovered_mask(qreq_.internal_daids, masked_daid_list) assert len(flags) == len(qreq_.internal_daids), ( 'unequal len internal daids') qreq_.internal_daids_mask = flags
def assert_can_add_aids(mxer, new_aid_list): """ Aids that are already indexed should never be added. Ignore: qreq_vsmany_ = ut.search_stack_for_localvar('qreq_vsmany_') qreq_vsmany_.daids qreq_vsmany_.qaids qreq_vsmany_.ibs.get_annot_exemplar_flags(new_aid_list) """ indexed_aids_list = mxer.get_multi_indexed_aids() indexed_aids = np.hstack(indexed_aids_list) uncovered_mask = vt.get_uncovered_mask(indexed_aids, new_aid_list) if not np.all(uncovered_mask): msg_list = [ 'new aids must be disjoint from current aids', 'new_aid_list = %r' % (new_aid_list,) ] msg = '\n'.join(msg_list) raise AssertionError(msg)
def assert_can_add_aids(mxer, new_aid_list): """ Aids that are already indexed should never be added. Ignore: qreq_vsmany_ = ut.search_stack_for_localvar('qreq_vsmany_') qreq_vsmany_.get_external_daids() qreq_vsmany_.get_external_qaids() qreq_vsmany_.ibs.get_annot_exemplar_flags(new_aid_list) """ indexed_aids_list = mxer.get_multi_indexed_aids() indexed_aids = np.hstack(indexed_aids_list) uncovered_mask = vt.get_uncovered_mask(indexed_aids, new_aid_list) if not np.all(uncovered_mask): msg_list = [ 'new aids must be disjoint from current aids', 'new_aid_list = %r' % (new_aid_list,) ] msg = '\n'.join(msg_list) raise AssertionError(msg)