Exemple #1
0
                               kpts2,
                               fm2,
                               fs2,
                               fm_norm=None,
                               H1=None,
                               H2=None,
                               scale_factor1=sf1,
                               scale_factor2=sf2,
                               colorbar_=False,
                               colors=colors,
                               **kwargs)
        if colorbar_:
            pt.colorbar(flat_fs, flat_colors)
    bbox_list = [(x, y, w, h) for (x, y), (w, h) in zip(offset_list, wh_list)]
    return offset_list, sf_list, bbox_list


if __name__ == '__main__':
    """
    CommandLine:
        python -m ibeis.viz.viz_matches --test-show_matches --show

        python -m ibeis.viz.viz_matches
        python -m ibeis.viz.viz_matches --allexamples
        python -m ibeis.viz.viz_matches --allexamples --noface --nosrc
    """
    import multiprocessing
    multiprocessing.freeze_support()  # for win32
    import utool as ut  # NOQA
    ut.doctest_funcs()
        cd ~/code/ibeis/ibeis/algo/preproc
        python occurrence_blackbox.py --lat 42.727985 42.657414 42.658333 42.654384 --lon -73.683994 -73.774448 -73.770993 -73.768919 --sec 0 0 0 0
        # Should return
        X_labels = [2, 1, 1, 1]
    """
    import argparse
    parser = argparse.ArgumentParser(description='Compute agglomerative cluster')
    parser.add_argument('--lat', type=float, nargs='*', help='list of latitude coords')
    parser.add_argument('--lon', type=float, nargs='*', help='list of longitude coords')
    parser.add_argument('--sec', type=float, nargs='*', help='list of POSIX_TIMEs in seconds')
    parser.add_argument('--thresh', type=float, nargs=1, default=1., help='threshold in kilometers')
    parser.add_argument('--km_per_sec', type=float, nargs=1, default=KM_PER_SEC, help='reasonable animal speed in km/s')
    args = parser.parse_args()
    sec = [0] * len(args.lat) if args.sec is None else args.sec
    latlons = np.vstack([args.lat, args.lon]).T
    X_labels = cluster_timespace_km(sec, latlons, args.thresh, km_per_sec=args.km_per_sec)
    print('X_labels = %r' % (X_labels.tolist(),))


if __name__ == '__main__':
    r"""
    CommandLine:
        python -m ibeis.algo.preproc.occurrence_blackbox
        python -m ibeis.algo.preproc.occurrence_blackbox --allexamples
    """
    import multiprocessing
    multiprocessing.freeze_support()  # for win32
    import utool as ut  # NOQA
    if not ut.doctest_funcs():
        main()
Exemple #3
0
    return thread_obj


def _spawn_background_thread0(func, *args, **kwargs):
    thread_id = _thread.start_new_thread(func, args, kwargs)
    return thread_id


if __name__ == '__main__':
    """
    Ignore:
       timing things
       python reset_dbs.py --time-generate
       python reset_dbs.py --time-generate --force-serial
       python reset_dbs.py --time-generate --preinit
       python reset_dbs.py --time-generate --force-serial

    CommandLine:
        python -m utool.util_parallel
        python -m utool.util_parallel --allexamples --testslow
        coverage run -m utool.util_parallel --allexamples
        coverage run -m utool.util_parallel --allexamples --testslow
        coverage report html -m utool/util_parallel.py
        coverage html

    """
    #import multiprocessing
    multiprocessing.freeze_support()  # for win32
    import utool  # NOQA
    utool.doctest_funcs()
Exemple #4
0
def run_ibeis():
    r"""
    CommandLine:
        python -m ibeis
        python -m ibeis find_installed_tomcat
        python -m ibeis get_annot_groundtruth:1
    """
    #ut.set_process_title('IBEIS_main')
    #main_locals = ibeis.main()
    #ibeis.main_loop(main_locals)
    #ut.set_process_title('IBEIS_main')
    cmdline_varags = ut.get_cmdline_varargs()
    if len(cmdline_varags) > 0 and cmdline_varags[0] == 'rsync':
        from ibeis.scripts import rsync_ibeisdb
        rsync_ibeisdb.rsync_ibsdb_main()
        sys.exit(0)

    if ut.get_argflag('--devcmd'):
        # Hack to let devs mess around when using an installer version
        # TODO: add more hacks
        #import utool.tests.run_tests
        #utool.tests.run_tests.run_tests()
        ut.embed()
    # Run the tests of other modules
    elif ut.get_argflag('--run-utool-tests'):
        import utool.tests.run_tests
        retcode = utool.tests.run_tests.run_tests()
        print('... exiting')
        sys.exit(retcode)
    elif ut.get_argflag('--run-vtool-tests'):
        import vtool.tests.run_tests
        retcode = vtool.tests.run_tests.run_tests()
        print('... exiting')
        sys.exit(retcode)
    elif ut.get_argflag(('--run-ibeis-tests', '--run-tests')):
        from ibeis.tests import run_tests
        retcode = run_tests.run_tests()
        print('... exiting')
        sys.exit(retcode)

    if ut.get_argflag('-e'):
        """
        ibeis -e print -a default -t default
        """
        # Run dev script if -e given
        import ibeis.dev  # NOQA
        ibeis.dev.devmain()
        print('... exiting')
        sys.exit(0)

    # Attempt to run a test using the funciton name alone
    # with the --tf flag
    import ibeis.tests.run_tests
    import ibeis.tests.reset_testdbs
    import ibeis.scripts.thesis
    ignore_prefix = [
        #'ibeis.tests',
        'ibeis.control.__SQLITE3__',
        '_autogen_explicit_controller'
    ]
    ignore_suffix = ['_grave']
    func_to_module_dict = {
        'demo_bayesnet': 'ibeis.unstable.demobayes',
    }
    ut.main_function_tester('ibeis',
                            ignore_prefix,
                            ignore_suffix,
                            func_to_module_dict=func_to_module_dict)

    #if ut.get_argflag('-e'):
    #    import ibeis
    #    expt_kw = ut.get_arg_dict(ut.get_func_kwargs(ibeis.run_experiment),
    #    prefix_list=['--', '-'])
    #    ibeis.run_experiment(**expt_kw)
    #    sys.exit(0)

    doctest_modname = ut.get_argval(
        ('--doctest-module', '--tmod', '-tm', '--testmod'),
        type_=str,
        default=None,
        help_='specify a module to doctest')
    if doctest_modname is not None:
        """
        Allow any doctest to be run the main ibeis script

        python -m ibeis --tmod utool.util_str --test-align:0
        python -m ibeis --tmod ibeis.algo.hots.pipeline --test-request_ibeis_query_L0:0 --show
        python -m ibeis --tf request_ibeis_query_L0:0 --show
        ./dist/ibeis/IBEISApp --tmod ibeis.algo.hots.pipeline --test-request_ibeis_query_L0:0 --show  # NOQA
        ./dist/ibeis/IBEISApp --tmod utool.util_str --test-align:0
        ./dist/IBEIS.app/Contents/MacOS/IBEISApp --tmod utool.util_str --test-align:0
        ./dist/IBEIS.app/Contents/MacOS/IBEISApp --run-utool-tests
        ./dist/IBEIS.app/Contents/MacOS/IBEISApp --run-vtool-tests
        """
        print('[ibeis] Testing module')
        mod_alias_list = {'exptdraw': 'ibeis.expt.experiment_drawing'}
        doctest_modname = mod_alias_list.get(doctest_modname, doctest_modname)
        module = ut.import_modname(doctest_modname)
        (nPass, nTotal, failed_list,
         error_report_list) = ut.doctest_funcs(module=module)
        retcode = 1 - (len(failed_list) == 0)
        #print(module)
        sys.exit(retcode)

    import ibeis
    main_locals = ibeis.main()
    execstr = ibeis.main_loop(main_locals)
    # <DEBUG CODE>
    if 'back' in main_locals and CMD:
        back = main_locals['back']
        front = getattr(back, 'front', None)  # NOQA
        #front = back.front
        #ui = front.ui
    ibs = main_locals['ibs']  # NOQA
    exec(execstr)
Exemple #5
0
            aid2 = top_aids[0]
            fnum = df2.next_fnum()
            df2.figure(fnum=fnum, doclf=True)
            qres.ishow_top(ibs, fnum=fnum, top_aids=top_aids, ensure=False, annot_mode=1)
            df2.set_figtitle('Query Result')
            df2.adjust_subplots_safe(top=.8)
    return locals()


if __name__ == '__main__':
    """
    CommandLine:
        python -m ibeis.tests.test_ibs_query
        python -m ibeis.tests.test_ibs_query --allexamples
        python -m ibeis.tests.test_ibs_query --allexamples --noface --nosrc
    """
    import multiprocessing
    multiprocessing.freeze_support()  # for win32
    import utool as ut  # NOQA
    nPass, nTotal, failed_cmd_list = ut.doctest_funcs()
    if nTotal == 0:
        # OLD MAIN
        multiprocessing.freeze_support()  # For windows
        import ibeis
        main_locals = ibeis.main(defaultdb='testdb1', gui=False)
        ibs = main_locals['ibs']
        test_locals = utool.run_test(TEST_QUERY, ibs)
        execstr = utool.execstr_dict(test_locals, 'test_locals')
        exec(execstr)
        exec(utool.ipython_execstr())
Exemple #6
0
# -*- coding: utf-8 -*-
"""
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import utool as ut
(print, print_, printDBG, rrr, profile) = ut.inject(__name__,
                                                    '[preproc_residual]')


def add_residual_params_gen(ibs, fid_list, qreq_=None):
    return None


def on_delete(ibs, featweight_rowid_list):
    print('Warning: Not Implemented')
    print('Probably nothing to do here')


if __name__ == '__main__':
    import multiprocessing
    multiprocessing.freeze_support()
    testable_list = []
    ut.doctest_funcs(testable_list)