def run_tests(): """ >>> from ibeis.tests.run_tests import * # NOQA """ # DONT USE THESE FLAGS #print('--testall and --testslow give you more tests') # starts logging for tests import ibeis ibeis._preload() # Build module list and run tests import sys ensure_testing_data() if False: ut.change_term_title('RUN IBEIS TESTS') exclude_doctests_fnames = set([ '_autogen_explicit_controller', 'template_definitions.py', 'autogen_test_script.py', ]) exclude_dirs = [ '_broken', 'old', 'tests', 'timeits', '_scripts', '_timeits', '_doc', 'notebook', ] if ut.in_pyinstaller_package(): from os.path import dirname dpath_list = [dirname(ibeis.__file__)] # Run tests for installer doctest_modname_list_ = [ 'ibeis.ibsfuncs', 'ibeis.viz.interact.interact_qres2', 'ibeis.viz.interact.interact_matches', 'ibeis.viz.interact.interact_annotations2', 'ibeis.viz.interact.interact_name', 'ibeis.viz.interact.interact_query_decision', 'ibeis.viz.interact.interact_chip', 'ibeis.viz.interact.interact_qres', 'ibeis.algo.Config', 'ibeis.algo.hots._pipeline_helpers', 'ibeis.algo.hots.name_scoring', 'ibeis.algo.hots.devcases', 'ibeis.algo.hots.neighbor_index', 'ibeis.algo.hots.automated_helpers', 'ibeis.algo.hots.hots_query_result', 'ibeis.algo.hots.automated_oracle', 'ibeis.algo.hots.nn_weights', 'ibeis.algo.hots.pipeline', 'ibeis.algo.hots.automated_params', 'ibeis.algo.hots.vsone_pipeline', 'ibeis.algo.hots.automatch_suggestor', 'ibeis.algo.hots.score_normalization', 'ibeis.algo.hots.query_request', 'ibeis.algo.hots.chip_match', 'ibeis.algo.hots.multi_index', 'ibeis.algo.hots.qt_inc_automatch', 'ibeis.algo.hots.query_params', 'ibeis.algo.hots.precision_recall', 'ibeis.algo.hots.hstypes', 'ibeis.algo.hots.match_chips4', 'ibeis.algo.hots.distinctiveness_normalizer', 'ibeis.algo.hots.automated_matcher', 'ibeis.algo.hots.special_query', 'ibeis.algo.hots.scoring', 'ibeis.algo.preproc.preproc_annot', 'ibeis.algo.preproc.preproc_imageset', 'ibeis.algo.preproc.preproc_image', 'ibeis.algo.preproc.preproc_residual', 'ibeis.algo.detect.grabmodels', 'ibeis.control.manual_annot_funcs', 'ibeis.control.manual_chip_funcs', 'ibeis.control.manual_species_funcs', 'ibeis.control.manual_ibeiscontrol_funcs', 'ibeis.control._autogen_party_funcs', 'ibeis.control.manual_garelate_funcs', 'ibeis.control.manual_name_funcs', 'ibeis.control._sql_helpers', 'ibeis.control.manual_wildbook_funcs', 'ibeis.control.controller_inject', 'ibeis.control.manual_lblimage_funcs', 'ibeis.control.IBEISControl', 'ibeis.control._autogen_featweight_funcs', 'ibeis.control.manual_imageset_funcs', 'ibeis.control.manual_feat_funcs', 'ibeis.control.manual_gsgrelate_funcs', 'ibeis.control._autogen_annotmatch_funcs', 'ibeis.control.manual_meta_funcs', 'ibeis.control.manual_lblannot_funcs', 'ibeis.control.DB_SCHEMA', 'ibeis.control.manual_lbltype_funcs', 'ibeis.control.SQLDatabaseControl', 'ibeis.control.manual_image_funcs', 'ibeis.control.manual_annotgroup_funcs', 'ibeis.control.DBCACHE_SCHEMA', 'ibeis.init.main_helpers', 'ibeis.init.sysres', 'ibeis.gui.clock_offset_gui', 'ibeis.dbio.export_subset', 'ibeis.dbio.export_hsdb', 'ibeis.dbio.ingest_database', ] else: dpath_list = ['ibeis'] doctest_modname_list_ = ut.find_doctestable_modnames( dpath_list, exclude_doctests_fnames, exclude_dirs) exclude_doctest_pattern = ut.get_argval( ('--exclude-doctest-patterns', '--x'), type_=list, default=[]) if exclude_doctest_pattern is not None: import re is_ok = [ all([ re.search(pat, name) is None for pat in exclude_doctest_pattern ]) for name in doctest_modname_list_ ] doctest_modname_list = ut.compress(doctest_modname_list_, is_ok) else: doctest_modname_list = doctest_modname_list_ doctest_modname_list2 = [] for modname in doctest_modname_list: try: exec('import ' + modname, globals(), locals()) except ImportError as ex: ut.printex(ex, iswarning=True) if not ut.in_pyinstaller_package(): raise else: doctest_modname_list2.append(modname) module_list = [sys.modules[name] for name in doctest_modname_list2] nPass, nTotal, failed_cmd_list = ut.doctest_module_list(module_list) if nPass != nTotal: return 1 else: return 0
""" # TODO: ADD COPYRIGHT TAG from __future__ import absolute_import, division, print_function import multiprocessing import sys #from ibeis._devscript import devcmd, DEVCMD_FUNCTIONS, DEVPRECMD_FUNCTIONS, DEVCMD_FUNCTIONS2, devcmd2 from ibeis._devscript import devcmd, DEVCMD_FUNCTIONS, DEVPRECMD_FUNCTIONS import utool as ut from utool.util_six import get_funcname import utool #from ibeis.algo.hots import smk import plottool as pt import ibeis if __name__ == '__main__': multiprocessing.freeze_support() ibeis._preload() #from ibeis.all_imports import * # NOQA #utool.util_importer.dynamic_import(__name__, ('_devcmds_ibeis', None), # developing=True) from ibeis._devcmds_ibeis import * # NOQA # IBEIS from ibeis.init import main_helpers # NOQA from ibeis.other import dbinfo # NOQA from ibeis.expt import experiment_configs # NOQA from ibeis.expt import harness # NOQA from ibeis import params # NOQA print, print_, printDBG, rrr, profile = utool.inject(__name__, '[dev]') #------------------ # DEV DEVELOPMENT
# eid = model.eid gid = id_ print("SINGLE CLICKED ID: %r" % gid) @slot_(QtCore.QModelIndex) def on_doubleclick(ibswgt, qtindex): printDBG('on_doubleclick') model = qtindex.model() id_ = model._get_row_id(qtindex) if model.name == NAMES_TREE: # eid = model.eid gid = id_ #ibswgt.annotation_interact = interact_annotations2.ANNOTATION_Interaction2(ibswgt.ibs, gid) print("DOUBLECLICKED ID: %r" % gid) if __name__ == '__main__': import ibeis import sys ibeis._preload(mpl=False, par=False) guitool.ensure_qtapp() dbdir = ibeis.sysres.get_args_dbdir(defaultdb='cache') ibs = IBEISControl.IBEISController(dbdir=dbdir) ibswgt = IBEISGuiWidget(ibs=ibs) ibswgt.resize(900, 600) if '--cmd' in sys.argv: guitool.qtapp_loop(qwin=ibswgt, ipy=True) exec(utool.ipython_execstr()) else: guitool.qtapp_loop(qwin=ibswgt)
def fix_pz_master(): r""" CommandLine: python -m ibeis.algo.hots.devcases --test-fix_pz_master --show Example: >>> # DISABLE_DOCTEST >>> from ibeis.algo.hots.devcases import * # NOQA >>> # build test data >>> # execute function >>> result = fix_pz_master() >>> # verify results >>> print(result) """ # ReROI aid4513+name """ 82 97 117 118 157 213 299 336 351 368 392 415 430 434 441 629 664 679 682 685 695 835 1309 1317 1327 1382 1455 1816 3550 4067 4125 4131 4141 4191 4239 4242 4256 4257 4258 4439 4489 4625 4797 4800 4809 4812 4813 4819 4829 4831 4864 4865 4871 4877 4879 4885 4886 4891 4897 4899 4902 4904 4909 4912 4931 4933 4934 4935 4936 4952 5053 5073 5248 5249 5367 5776 5999 6150 6699 6882 7197 7225 7231 7237 7247 7254 7263 7280 7298 7357 7373 7385 7412 7424 7426 7464 7470 7472 7473 7479 7480 7507 7533 7535 7537 7578 7589 7629 7666 7669 7672 7720 7722 7734 7740 7754 7778 7792 7796 7798 7807 7812 7813 7829 7840 7846 7875 7876 7888 7889 7896 7899 7900 7901 7908 7909 7911 7915 7916 7917 7925 7931 7936 7938 7944 7947 7951 7954 7961 7965 7966 7978 7979 7981 7988 7992 7998 8019 8044 8045 8047 8051 8052 8059 8062 8063 8064 8066 8069 8074 8075 8083 8088 8093 8094 8095 8100 8102 8103 8105 8113 8116 8118 8119 8120 8123 8126 8128 8139 8144 8151 8152 8153 8154 8155 8157 8165 8170 8178 8180 8186 8188 8189 8195 8197 8198 8201 8202 8206 8213 8216 8226 8228 8231 8238 8245 8258 8265 8269 8276 8281 8285 8287 8297 8301 8305 8306 8308 8312 8318 8319 8321 8329 8332 8345 8349 8357 8361 8365 8367 8372 8373 8381 8386 8389 8392 8398 8399 8400 8402 8403 8406 8407 8412 8423 8424 8426 8427 8428 8429 8431 8439 8444 8446 8447 8450 8456 8457 8461 8463 8464 8466 8471 8472 8477 8481 8486 8489 8490 8494 8497 8499 8500 8501 8503 8506 8508 8535 8536 8537 8538 8539 8540 8541 8544 8545 8550 8552 8554 8555 8557 8558 8559 8564 8567 8568 8574 8575 8582 8584 8587 8589 8591 8592 8593 8596 8597 8601 8602 8605 8607 8608 8616 8617 8618 8619 8620 8621 8622 8629 8637 8639 8647 8662 8664 8665 8666 8673 8674 8676 8689 8691 8692 8693 8694 8699 8700 8702 8703 8712 8714 8715 8719 8724 8733 8734 8736 """ qaids_str = """ 82 117 118 213 299 336 351 368 392 430 434 441 495 616 629 664 679 682 685 695 835 915 1317 1382 3550 4239 4242 4246 4256 4257 4258 4439 4445 4447 4489 4706 4800 4812 4813 4819 4828 4829 4831 4864 4865 4871 4877 4879 4885 4886 4891 4897 4899 4902 4904 4909 4912 4933 4934 4936 4952 5053 5073 5248 5367 5776 7197 7225 7254 7263 7298 7309 7470 7473 7479 7507 7535 7570 7589 7666 7672 7722 7734 7740 7754 7760 7796 7798 7807 7813 7829 7840 7875 7876 7888 7889 7896 7899 7900 7901 7908 7909 7911 7916 7917 7925 7931 7934 7936 7938 7944 7947 7951 7954 7961 7964 7965 7966 7978 7979 7981 7988 7992 7998 8019 8044 8045 8047 8051 8052 8058 8059 8062 8063 8064 8066 8074 8075 8083 8088 8094 8095 8100 8101 8102 8103 8105 8111 8113 8116 8119 8120 8121 8123 8126 8128 8144 8151 8152 8153 8155 8156 8157 8165 8170 8180 8186 8188 8198 8201 8206 8213 8216 8226 8228 8231 8238 8258 8276 8281 8285 8287 8295 8297 8301 8305 8306 8308 8312 8318 8319 8329 8332 8355 8357 8361 8365 8367 8372 8373 8381 8386 8388 8389 8392 8398 8399 8402 8403 8406 8407 8412 8424 8425 8426 8428 8429 8439 8442 8444 8446 8447 8449 8450 8452 8456 8457 8461 8463 8464 8466 8470 8471 8481 8486 8489 8490 8494 8497 8499 8500 8501 8503 8506 8508 8535 8536 8537 8538 8539 8540 8544 8545 8550 8554 8555 8557 8558 8559 8563 8564 8567 8574 8575 8582 8584 8587 8589 8592 8593 8596 8597 8600 8601 8604 8605 8607 8608 8616 8617 8618 8619 8620 8621 8622 8623 8629 8637 8639 8647 8662 8665 8666 8673 8674 8676 8691 8693 8694 8699 8700 8702 8703 8712 8714 8715 8719 8724 8731 8733 8734 8736 """ qaids_ = map(int, filter(len, qaids_str.replace('\n', ' ').split(' '))) import ibeis ibeis._preload() from ibeis.gui import inspect_gui import guitool ibs = ibeis.opendb('PZ_Master0') #ibs._default_config() #ibs.cfg.save() daids = ibs.get_valid_aids(minqual='poor') qaids = ibs.filter_junk_annotations(qaids_) #qaids = qaids[64:128] qreq_ = ibs.new_query_request(qaids, daids) #qreq_.lazy_load() qres_list = ibs.query_chips(qreq_=qreq_, verbose=True) qres_wgt = inspect_gui.launch_review_matches_interface( ibs, qres_list, dodraw=ut.show_was_requested()) if ut.show_was_requested(): guitool.guitool_main.qtapp_loop() return qres_wgt
DEFAULT_DATA_DIR = 'data' FILE_CREATION_WAIT = 5 # seconds MIN_TASKS = 8 TASK_TIMEOUT = 5 # seconds IBEIS_USE_TWO_DBS = False # parameters that will be passed to the analyze module analyze_params = { 'DEFAULT_DATA_DIR': DEFAULT_DATA_DIR, 'SERVER_IP_ADDRESS': '127.0.0.1', 'SERVER_PORT': 5000, 'FRACTION_FOR_REVIEW': 0.8, 'MINIMUM_FOR_REVIEW': 8 } ibeis._preload() if IBEIS_USE_TWO_DBS: IBEIS_DB1 = 'PZ_MUGU_ALL' # the specialist plains zebra database IBEIS_DB2 = 'GIRM_MUGU_20' # the specialist masai giraffe database ibspz = ibeis.opendb(IBEIS_DB1) ibsgir = ibeis.opendb(IBEIS_DB2) ibsmap = {'zebra': ibspz, 'giraffe': ibsgir} else: IBEIS_DB = 'MUGU_MASTER' # the merged database containing both plains zebras and masai giraffes ibs_single = ibeis.opendb(IBEIS_DB) ibsmap = {'zebra': ibs_single, 'giraffe': ibs_single} # TODO: update the species name for GIRAFFE_MASAI when the DB is ready # species_dict = {'zebra': const.TEST_SPECIES.ZEB_PLAIN, 'giraffe': const.TEST_SPECIES.GIR_MASAI} species_dict = {
def run_tests(): """ >>> from ibeis.tests.run_tests import * # NOQA """ # starts logging for tests import ibeis ibeis._preload() # Build module list and run tests import sys if True: ensure_testing_data() if ut.in_pyinstaller_package(): # Run tests for installer doctest_modname_list_ = static_doctest_modnames() else: doctest_modname_list_ = dynamic_doctest_modnames() exclude_doctest_pattern = ut.get_argval( ('--exclude-doctest-patterns', '--x'), type_=list, default=[]) if exclude_doctest_pattern is not None: import re is_ok = [ all([ re.search(pat, name) is None for pat in exclude_doctest_pattern ]) for name in doctest_modname_list_ ] doctest_modname_list = ut.compress(doctest_modname_list_, is_ok) else: doctest_modname_list = doctest_modname_list_ coverage = ut.get_argflag(( '--coverage', '--cov', )) if coverage: import coverage cov = coverage.Coverage(source=doctest_modname_list) cov.start() print('Starting coverage') exclude_lines = [ 'pragma: no cover', 'def __repr__', 'if self.debug:', 'if settings.DEBUG', 'raise AssertionError', 'raise NotImplementedError', 'if 0:', 'if ut.VERBOSE', 'if _debug:', 'if __name__ == .__main__.:', 'print(.*)', ] for line in exclude_lines: cov.exclude(line) doctest_modname_list2 = [] try: import guitool # NOQA except ImportError: HAVE_GUI = False else: HAVE_GUI = True # Remove gui things if possible import re if not HAVE_GUI: doctest_modname_list = [ modname for modname in doctest_modname_list_ if not re.search('\\bgui\\b', modname) and not re.search('\\bviz\\b', modname) ] for modname in doctest_modname_list: try: exec('import ' + modname, globals(), locals()) except ImportError as ex: ut.printex(ex, iswarning=True) # import parse # if not HAVE_GUI: # try: # parsed = parse.parse('No module named {}', str(ex)) # if parsed is None: # parsed = parse.parse('cannot import name {}', str(ex)) # if parsed is not None: # if parsed[0].endswith('_gui'): # print('skipping gui module %r' % (parsed[0],)) # continue # if parsed[0].startswith('viz_'): # print('skipping viz module %r' % (parsed[0],)) # continue # if parsed[0].startswith('interact_'): # print('skipping interact module %r' % (parsed[0],)) # continue # # if parsed[0] in ['sip']: # # print('skipping Qt module %r' % (parsed[0],)) # # continue # except: # pass if not ut.in_pyinstaller_package(): raise else: doctest_modname_list2.append(modname) module_list = [sys.modules[name] for name in doctest_modname_list2] # Write to py.test / nose format if ut.get_argflag('--tonose'): convert_tests_from_ibeis_to_nose(module_list) return 0 nPass, nTotal, failed_cmd_list = ut.doctest_module_list(module_list) if coverage: print('Stoping coverage') cov.stop() print('Saving coverage') cov.save() print('Generating coverage html report') cov.html_report() if nPass != nTotal: return 1 else: return 0
def fix_pz_master(): r""" CommandLine: python -m ibeis.algo.hots.devcases --test-fix_pz_master --show Example: >>> # DISABLE_DOCTEST >>> from ibeis.algo.hots.devcases import * # NOQA >>> # build test data >>> # execute function >>> result = fix_pz_master() >>> # verify results >>> print(result) """ # ReROI aid4513+name """ 82 97 117 118 157 213 299 336 351 368 392 415 430 434 441 629 664 679 682 685 695 835 1309 1317 1327 1382 1455 1816 3550 4067 4125 4131 4141 4191 4239 4242 4256 4257 4258 4439 4489 4625 4797 4800 4809 4812 4813 4819 4829 4831 4864 4865 4871 4877 4879 4885 4886 4891 4897 4899 4902 4904 4909 4912 4931 4933 4934 4935 4936 4952 5053 5073 5248 5249 5367 5776 5999 6150 6699 6882 7197 7225 7231 7237 7247 7254 7263 7280 7298 7357 7373 7385 7412 7424 7426 7464 7470 7472 7473 7479 7480 7507 7533 7535 7537 7578 7589 7629 7666 7669 7672 7720 7722 7734 7740 7754 7778 7792 7796 7798 7807 7812 7813 7829 7840 7846 7875 7876 7888 7889 7896 7899 7900 7901 7908 7909 7911 7915 7916 7917 7925 7931 7936 7938 7944 7947 7951 7954 7961 7965 7966 7978 7979 7981 7988 7992 7998 8019 8044 8045 8047 8051 8052 8059 8062 8063 8064 8066 8069 8074 8075 8083 8088 8093 8094 8095 8100 8102 8103 8105 8113 8116 8118 8119 8120 8123 8126 8128 8139 8144 8151 8152 8153 8154 8155 8157 8165 8170 8178 8180 8186 8188 8189 8195 8197 8198 8201 8202 8206 8213 8216 8226 8228 8231 8238 8245 8258 8265 8269 8276 8281 8285 8287 8297 8301 8305 8306 8308 8312 8318 8319 8321 8329 8332 8345 8349 8357 8361 8365 8367 8372 8373 8381 8386 8389 8392 8398 8399 8400 8402 8403 8406 8407 8412 8423 8424 8426 8427 8428 8429 8431 8439 8444 8446 8447 8450 8456 8457 8461 8463 8464 8466 8471 8472 8477 8481 8486 8489 8490 8494 8497 8499 8500 8501 8503 8506 8508 8535 8536 8537 8538 8539 8540 8541 8544 8545 8550 8552 8554 8555 8557 8558 8559 8564 8567 8568 8574 8575 8582 8584 8587 8589 8591 8592 8593 8596 8597 8601 8602 8605 8607 8608 8616 8617 8618 8619 8620 8621 8622 8629 8637 8639 8647 8662 8664 8665 8666 8673 8674 8676 8689 8691 8692 8693 8694 8699 8700 8702 8703 8712 8714 8715 8719 8724 8733 8734 8736 """ qaids_str = """ 82 117 118 213 299 336 351 368 392 430 434 441 495 616 629 664 679 682 685 695 835 915 1317 1382 3550 4239 4242 4246 4256 4257 4258 4439 4445 4447 4489 4706 4800 4812 4813 4819 4828 4829 4831 4864 4865 4871 4877 4879 4885 4886 4891 4897 4899 4902 4904 4909 4912 4933 4934 4936 4952 5053 5073 5248 5367 5776 7197 7225 7254 7263 7298 7309 7470 7473 7479 7507 7535 7570 7589 7666 7672 7722 7734 7740 7754 7760 7796 7798 7807 7813 7829 7840 7875 7876 7888 7889 7896 7899 7900 7901 7908 7909 7911 7916 7917 7925 7931 7934 7936 7938 7944 7947 7951 7954 7961 7964 7965 7966 7978 7979 7981 7988 7992 7998 8019 8044 8045 8047 8051 8052 8058 8059 8062 8063 8064 8066 8074 8075 8083 8088 8094 8095 8100 8101 8102 8103 8105 8111 8113 8116 8119 8120 8121 8123 8126 8128 8144 8151 8152 8153 8155 8156 8157 8165 8170 8180 8186 8188 8198 8201 8206 8213 8216 8226 8228 8231 8238 8258 8276 8281 8285 8287 8295 8297 8301 8305 8306 8308 8312 8318 8319 8329 8332 8355 8357 8361 8365 8367 8372 8373 8381 8386 8388 8389 8392 8398 8399 8402 8403 8406 8407 8412 8424 8425 8426 8428 8429 8439 8442 8444 8446 8447 8449 8450 8452 8456 8457 8461 8463 8464 8466 8470 8471 8481 8486 8489 8490 8494 8497 8499 8500 8501 8503 8506 8508 8535 8536 8537 8538 8539 8540 8544 8545 8550 8554 8555 8557 8558 8559 8563 8564 8567 8574 8575 8582 8584 8587 8589 8592 8593 8596 8597 8600 8601 8604 8605 8607 8608 8616 8617 8618 8619 8620 8621 8622 8623 8629 8637 8639 8647 8662 8665 8666 8673 8674 8676 8691 8693 8694 8699 8700 8702 8703 8712 8714 8715 8719 8724 8731 8733 8734 8736 """ qaids_ = map(int, filter(len, qaids_str.replace('\n', ' ').split(' '))) import ibeis ibeis._preload() from ibeis.gui import inspect_gui import guitool ibs = ibeis.opendb('PZ_Master0') #ibs._default_config() #ibs.cfg.save() daids = ibs.get_valid_aids(minqual='poor') qaids = ibs.filter_junk_annotations(qaids_) #qaids = qaids[64:128] qreq_ = ibs.new_query_request(qaids, daids) #qreq_.lazy_load() qres_list = ibs.query_chips(qreq_=qreq_, verbose=True) qres_wgt = inspect_gui.launch_review_matches_interface(ibs, qres_list, dodraw=ut.show_was_requested()) if ut.show_was_requested(): guitool.guitool_main.qtapp_loop() return qres_wgt
print("on double click") printDBG('on_doubleclick') model = qtindex.model() id_ = model._get_row_id(qtindex) print('dblclick (%r,%r)' % (qtindex.row(), qtindex.column())) if model.name == THUMB_TABLE: # imgsetid = model.imgsetid gid = id_ if gid is None: return ibswgt.roi_interact = interact_annotations2.ANNOTATION_Interaction2( ibswgt.ibs, gid) print("DOUBLECLICKED ID: %r" % gid) if __name__ == '__main__': import ibeis import sys ibeis._preload(mpl=False, par=False) guitool.ensure_qtapp() dbdir = ibeis.sysres.get_args_dbdir(defaultdb='cache') ibs = IBEISControl.IBEISController(dbdir=dbdir) ibswgt = IBEISGuiWidget(ibs=ibs) ibswgt.resize(900, 600) if '--cmd' in sys.argv: guitool.qtapp_loop(qwin=ibswgt, ipy=True) exec(utool.ipython_execstr()) else: guitool.qtapp_loop(qwin=ibswgt)