Exemple #1
0
def parse_arguments(defaultdb, usedbcache):
    args = argparse2.parse_arguments(defaultdb=defaultdb)
    # Parse arguments
    args = argparse2.fix_args_with_cache(args)
    if usedbcache:
        if args.vdd:
            helpers.vd(args.dbdir)
            args.vdd = False
    params.args = args
    # Preload process args
    if args.delete_global:
        io.delete_global_cache()
    return args
Exemple #2
0
def main(defaultdb='NAUTS', usedbcache=False, default_load_all=True):
    import matplotlib
    matplotlib.use('Qt4Agg')
    imports()
    from hscom import argparse2
    from hscom import helpers
    from hotspotter import HotSpotterAPI as api
    args = argparse2.parse_arguments(defaultdb=defaultdb)
    # Parse arguments
    args = argparse2.fix_args_with_cache(args)
    if usedbcache:
        load_all, cids = preload_args_process(args)
    else:
        args = argparse2.fix_args_shortnames(args)
        load_all = helpers.get_flag('--load-all', default_load_all)

    # Preload process args
    if args.delete_global:
        from hscom import fileio as io
        io.delete_global_cache()

    # --- Build HotSpotter API ---
    hs = api.HotSpotter(args)
    setcfg = args.setcfg
    if setcfg is not None:
        import experiment_harness
        print('[main] setting cfg to %r' % setcfg)
        varried_list = experiment_harness.get_varried_params_list([setcfg])
        cfg_dict = varried_list[0]
        #print(cfg_dict)
        hs.prefs.query_cfg.update_cfg(**cfg_dict)
        hs.prefs.save()
        #hs.prefs.printme()
        # load default preferences
        hs.default_preferences()

    # Load all data if needed now, otherwise be lazy
    try:
        hs.load(load_all=load_all)
        from hscom import fileio as io
        #imported from wrong module
        #from hotspotter import fileio as io
        db_dir = hs.dirs.db_dir
        io.global_cache_write('db_dir', db_dir)
    except ValueError as ex:
        print('[main] ValueError = %r' % (ex, ))
        if hs.args.strict:
            raise
    return hs
Exemple #3
0
def parse_arguments(defaultdb, usedbcache):
    args = argparse2.parse_arguments(defaultdb=defaultdb)
    # Parse arguments
    args = argparse2.fix_args_with_cache(args)
    if usedbcache:
        if args.vdd:
            helpers.vd(args.dbdir)
            args.vdd = False
        if helpers.inIPython() or '--cmd' in sys.argv:
            args.nosteal = True
    params.args = args
    # Preload process args
    if args.delete_global:
        io.delete_global_cache()
    return args
Exemple #4
0
def main(defaultdb='NAUTS', usedbcache=False, default_load_all=True):
    import matplotlib
    matplotlib.use('Qt4Agg')
    imports()
    from hscom import argparse2
    from hscom import helpers
    from hotspotter import HotSpotterAPI as api
    args = argparse2.parse_arguments(defaultdb=defaultdb)
    # Parse arguments
    args = argparse2.fix_args_with_cache(args)
    if usedbcache:
        load_all, cids = preload_args_process(args)
    else:
        args = argparse2.fix_args_shortnames(args)
        load_all = helpers.get_flag('--load-all', default_load_all)

    # Preload process args
    if args.delete_global:
        from hscom import fileio as io
        io.delete_global_cache()

    # --- Build HotSpotter API ---
    hs = api.HotSpotter(args)
    setcfg = args.setcfg
    if setcfg is not None:
        import experiment_harness
        print('[main] setting cfg to %r' % setcfg)
        varried_list = experiment_harness.get_varried_params_list([setcfg])
        cfg_dict = varried_list[0]
        #print(cfg_dict)
        hs.prefs.query_cfg.update_cfg(**cfg_dict)
        hs.prefs.save()
        #hs.prefs.printme()
        #hs.default_preferences()

    # Load all data if needed now, otherwise be lazy
    try:
        hs.load(load_all=load_all)
        from hotspotter import fileio as io
        db_dir = hs.dirs.db_dir
        io.global_cache_write('db_dir', db_dir)
    except ValueError as ex:
        print('[main] ValueError = %r' % (ex,))
        if hs.args.strict:
            raise
    return hs
Exemple #5
0
def parse_arguments(defaultdb, usedbcache):
    from hscom import argparse2
    from hscom import params
    from hscom import helpers as util
    from hscom import fileio as io
    import sys
    args = argparse2.parse_arguments(defaultdb=defaultdb)
    # Parse arguments
    args = argparse2.fix_args_with_cache(args)
    if usedbcache:
        if args.vdd:
            util.vd(args.dbdir)
            args.vdd = False
        if util.inIPython() or '--cmd' in sys.argv:
            args.nosteal = True
    params.args = args
    # Preload process args
    if args.delete_global:
        io.delete_global_cache()
    return args
Exemple #6
0
from hscom import argparse2
from hscom import helpers
from hscom import helpers as util
from hsviz import viz
import multiprocessing
import numpy as np  # NOQA

if __name__ == '__main__':
    multiprocessing.freeze_support()
    # Debugging vars
    chip_cfg = None
    #l')=103.7900s
    cx_list = None
    kwargs = {}
    # --- LOAD TABLES --- #
    args = argparse2.parse_arguments(defaultdb='NAUTS')
    hs = api.HotSpotter(args)
    hs.load_tables()
    hs.update_samples()
    # --- LOAD CHIPS --- #
    force_compute = helpers.get_flag('--force', default=False)
    cc2.load_chips(hs, force_compute=force_compute)
    cx = helpers.get_arg('--cx', type_=int)
    if not cx is None:
        #tau = np.pi * 2
        #hs.change_theta(cx, tau / 8)
        viz.show_chip(hs, cx, draw_kpts=False, fnum=1)
        viz.show_image(hs, hs.cx2_gx(cx), fnum=2)
    else:
        print('usage: feature_compute.py --cx [cx]')
    exec(viz.df2.present())
Exemple #7
0
from hscom import argparse2
import multiprocessing

if __name__ == '__main__':
    multiprocessing.freeze_support()
    print('[fc2] __main__ = feature_compute2.py')
    # Read Args
    cx = helpers.get_arg('--cx', type_=int)
    delete_features = helpers.get_flag('--delete-features', default=False)
    nRandKpts = helpers.get_arg('--nRandKpts', type_=int)
    # Debugging vars
    feat_cfg = None
    cx_list = None
    kwargs = {}
    # --- LOAD TABLES --- #
    args = argparse2.parse_arguments(db='NAUTS')
    hs = api.HotSpotter(args)
    hs.load_tables()
    # --- LOAD CHIPS --- #
    hs.update_samples()
    hs.load_chips()
    # Delete features if needed
    if delete_features:
        fc2.clear_feature_cache(hs)
    # --- LOAD FEATURES --- #
    fc2.load_features(hs)
    if not cx is None:
        viz.show_chip(hs, cx, nRandKpts=nRandKpts)
    else:
        print(
            'usage: feature_compute.py --cx [cx] --nRandKpts [num] [--delete-features]'