本文整理汇总了Python中utool.get_argval函数的典型用法代码示例。如果您正苦于以下问题:Python get_argval函数的具体用法?Python get_argval怎么用?Python get_argval使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_argval函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: testdata_ibeis
def testdata_ibeis(**kwargs):
"""
DEPRICATE
Step 1
builds ibs for testing
Example:
>>> from ibeis.algo.hots.smk.smk_debug import * # NOQA
>>> kwargs = {}
"""
print(' === Test Data IBEIS ===')
print('kwargs = ' + ut.dict_str(kwargs))
print('[smk_debug] testdata_ibeis')
db = kwargs.get('db', ut.get_argval('--db', str, 'PZ_MTEST'))
#with ut.Indenter('ENSURE'):
if db == 'PZ_MTEST':
ibeis.ensure_pz_mtest()
ibs = ibeis.opendb(db=db)
ibs._default_config()
aggregate = kwargs.get('aggregate', ut.get_argflag(('--agg', '--aggregate')))
nWords = kwargs.get( 'nWords', ut.get_argval(('--nWords', '--nCentroids'), int, default=8E3))
nAssign = kwargs.get( 'nAssign', ut.get_argval(('--nAssign', '--K'), int, default=10))
# Configs
ibs.cfg.query_cfg.pipeline_root = 'smk'
ibs.cfg.query_cfg.smk_cfg.aggregate = aggregate
ibs.cfg.query_cfg.smk_cfg.smk_alpha = 3
ibs.cfg.query_cfg.smk_cfg.smk_thresh = 0
ibs.cfg.query_cfg.smk_cfg.vocabtrain_cfg.nWords = nWords
ibs.cfg.query_cfg.smk_cfg.vocabassign_cfg.nAssign = nAssign
if ut.VERYVERBOSE:
ibs.cfg.query_cfg.smk_cfg.printme3()
return ibs
开发者ID:Erotemic,项目名称:ibeis,代码行数:33,代码来源:smk_debug.py
示例2: make_ibeis_cell_list
def make_ibeis_cell_list(ibs):
cell_template_list = get_default_cell_template_list(ibs)
autogen_str = make_autogen_str()
dbname = ibs.get_dbname()
#if ut.get_argflag('--hacktestscore'):
# annotconfig_list_body = ut.codeblock(
# '''
# 'timectrl',
# '''
# )
#else:
default_acfgstr = ut.get_argval('-a', type_=str, default='default:is_known=True')
annotconfig_list_body = ut.codeblock(
ut.repr2(default_acfgstr) + '\n' +
ut.codeblock('''
# See ibeis/expt/annotation_configs.py for names of annot configuration options
#'default:has_any=(query,),dpername=1,exclude_reference=True',
#'default:is_known=True',
#'default:qsame_encounter=True,been_adjusted=True,excluderef=True'
#'default:qsame_encounter=True,been_adjusted=True,excluderef=True,qsize=10,dsize=20',
#'default:require_timestamp=True,min_timedelta=3600',
#'default:species=primary',
#'timectrl:',
#'timectrl:been_adjusted=True,dpername=3',
#'timectrl:qsize=10,dsize=20',
#'unctrl:been_adjusted=True',
''')
)
#if ut.get_argflag('--hacktestscore'):
# pipeline_list_body = ut.codeblock(
# '''
# # See ibeis/algo/Config.py for names of pipeline config options
# 'default:lnbnn_on=True,bar_l2_on=False,normonly_on=False,fg_on=True',
# 'default:lnbnn_on=False,bar_l2_on=True,normonly_on=False,fg_on=True',
# 'default:lnbnn_on=False,bar_l2_on=False,normonly_on=True,fg_on=True',
# 'default:lnbnn_on=True,bar_l2_on=False,normonly_on=False,fg_on=False',
# 'default:lnbnn_on=False,bar_l2_on=True,normonly_on=False,fg_on=False',
# 'default:lnbnn_on=False,bar_l2_on=False,normonly_on=True,fg_on=False',
# '''
# )
#elif True:
default_pcfgstr_list = ut.get_argval(('-t', '-p'), type_=list, default='default')
default_pcfgstr = ut.repr3(default_pcfgstr_list, nobr=True)
pipeline_list_body = ut.codeblock(
default_pcfgstr + '\n' +
ut.codeblock('''
#'default',
#'default:K=1',
#'default:K=1,AI=False',
#'default:K=1,AI=False,QRH=True',
#'default:K=1,RI=True,AI=False',
#'default:K=1,adapteq=True',
#'default:fg_on=[True,False]',
''')
)
locals_ = locals()
_format = partial(format_cells, locals_=locals_)
cell_list = ut.flatten(map(_format, cell_template_list))
return cell_list
开发者ID:heroinlin,项目名称:ibeis,代码行数:60,代码来源:generate_notebook.py
示例3: testsdata_match_verification
def testsdata_match_verification(defaultdb='testdb1', aid1=1, aid2=2):
r"""
CommandLine:
main.py --imgsetid 2
main.py --imgsetid 13 --db PZ_MUGU_19
CommandLine:
python -m ibeis.viz.interact.interact_name --test-testsdata_match_verification --show
python -m ibeis.viz.interact.interact_name --test-testsdata_match_verification --aid1 2 --aid2 3 --show
# Merge case
python -m ibeis.viz.interact.interact_name --test-testsdata_match_verification --show --db PZ_MTEST --aid1 1 --aid2 30
# Split case
python -m ibeis.viz.interact.interact_name --test-testsdata_match_verification --show --db PZ_MTEST --aid1 30 --aid2 32
Example:
>>> # ENABLE_DOCTEST
>>> from ibeis.viz.interact.interact_name import * # NOQA
>>> self = testsdata_match_verification()
>>> # verify results
>>> ut.quit_if_noshow()
>>> self.show_page()
>>> ut.show_if_requested()
"""
#from ibeis.viz.interact.interact_name import * # NOQA
import ibeis
#ibs = ibeis.opendb(defaultdb='PZ_Master0')
ibs = ibeis.opendb(defaultdb=defaultdb)
#aid1 = ut.get_argval('--aid1', int, 14)
#aid2 = ut.get_argval('--aid2', int, 5545)
aid1 = ut.get_argval('--aid1', int, aid1)
aid2 = ut.get_argval('--aid2', int, aid2)
self = MatchVerificationInteraction(ibs, aid1, aid2, dodraw=False)
return self
开发者ID:Erotemic,项目名称:ibeis,代码行数:35,代码来源:interact_name.py
示例4: testdata_expts
def testdata_expts(defaultdb='testdb1',
default_acfgstr_name_list=['default:qindex=0:10:4,dindex=0:20'],
default_test_cfg_name_list=['default'],
a=None,
t=None,
qaid_override=None,
daid_override=None,
initial_aids=None,
):
"""
Use this if you want data from an experiment.
Command line interface to quickly get testdata for test_results.
Command line flags can be used to specify db, aidcfg, pipecfg, qaid
override, daid override (and maybe initial aids).
"""
print('[main_helpers] testdata_expts')
import ibeis
from ibeis.expt import experiment_harness
from ibeis.expt import test_result
if a is not None:
default_acfgstr_name_list = a
if t is not None:
default_test_cfg_name_list = t
if isinstance(default_acfgstr_name_list, six.string_types):
default_acfgstr_name_list = [default_acfgstr_name_list]
if isinstance(default_test_cfg_name_list, six.string_types):
default_test_cfg_name_list = [default_test_cfg_name_list]
#from ibeis.expt import experiment_helpers
ibs = ibeis.opendb(defaultdb=defaultdb)
acfg_name_list = ut.get_argval(('--aidcfg', '--acfg', '-a'), type_=list,
default=default_acfgstr_name_list)
test_cfg_name_list = ut.get_argval(('-t', '-p'), type_=list, default=default_test_cfg_name_list)
daid_override = ut.get_argval(('--daid-override', '--daids-override'), type_=list, default=daid_override)
qaid_override = ut.get_argval(('--qaid', '--qaids-override', '--qaid-override'), type_=list, default=qaid_override)
# Hack a cache here
use_bigtest_cache3 = not ut.get_argflag(('--nocache', '--nocache-hs'))
use_bigtest_cache3 &= ut.is_developer()
use_bigtest_cache3 &= False
if use_bigtest_cache3:
from os.path import dirname, join
cache_dir = ut.ensuredir(join(dirname(ut.get_module_dir(ibeis)), 'BIG_TESTLIST_CACHE3'))
load_testres = ut.cached_func('testreslist', cache_dir=cache_dir)(experiment_harness.run_test_configurations2)
else:
load_testres = experiment_harness.run_test_configurations2
testres_list = load_testres(
ibs, acfg_name_list, test_cfg_name_list, qaid_override=qaid_override,
daid_override=daid_override, initial_aids=initial_aids)
testres = test_result.combine_testres_list(ibs, testres_list)
print(testres)
return ibs, testres
开发者ID:heroinlin,项目名称:ibeis,代码行数:57,代码来源:main_helpers.py
示例5: __init__
def __init__(self):
import utool as ut
self.modname = None
code_dpath = ut.truepath(ut.get_argval('--code-dir', default='~/code'))
self.code_dpath = ut.unexpanduser(code_dpath)
self.repo_fname = (ut.get_argval(('--repo', '--repo-name'), type_=str))
self.repo_dpath = join(code_dpath, self.repo_fname)
self.modname = ut.get_argval('--modname', default=self.repo_fname)
self.regenfmt = 'python -m utool SetupRepo.{cmd} --modname={modname} --repo={repo_fname} --codedir={code_dpath}'
ut.ensuredir(self.repo_dpath, verbose=True)
开发者ID:Erotemic,项目名称:utool,代码行数:10,代码来源:util_project.py
示例6: testdata_show_qres
def testdata_show_qres():
import ibeis
cm, qreq_ = ibeis.testdata_cm()
kwargs = dict(
top_aids=ut.get_argval('--top-aids', type_=int, default=3),
sidebyside=not ut.get_argflag('--no-sidebyside'),
annot_mode=ut.get_argval('--annot_mode', type_=int, default=1),
viz_name_score=not ut.get_argflag('--no-viz_name_score'),
max_nCols=ut.get_argval('--max_nCols', type_=int, default=None)
)
return qreq_.ibs, cm, qreq_, kwargs
开发者ID:Erotemic,项目名称:ibeis,代码行数:11,代码来源:viz_qres.py
示例7: resolve_dbdir2
def resolve_dbdir2(defaultdb=None, allow_newdir=False, db=None, dbdir=None):
r"""
CommandLine:
python -m ibeis.init.sysres --exec-resolve_dbdir2 --db PZ_MTEST
python -m ibeis.init.sysres --exec-resolve_dbdir2 --db None
python -m ibeis.init.sysres --exec-resolve_dbdir2 --dbdir None
Args:
defaultdb (None): (default = None)
allow_newdir (bool): (default = False)
db (None): (default = None)
dbdir (None): (default = None)
CommandLine:
python -m ibeis.init.sysres --exec-resolve_dbdir2
Example:
>>> # ENABLE_DOCTEST
>>> from ibeis.init.sysres import * # NOQA
>>> defaultdb = 'cache'
>>> allow_newdir = False
>>> dbdir_ = resolve_dbdir2(defaultdb)
>>> result = ('dbdir_ = %r' % (dbdir_,))
>>> print(result)
"""
invalid = ['', ' ', '.', 'None']
if db in invalid:
db = None
if dbdir in invalid:
dbdir = None
db, db_specified = ut.get_argval(
'--db', type_=str, default=db, return_was_specified=True)
dbdir, dbdir_specified = ut.get_argval(
'--dbdir', type_=str, default=dbdir, return_was_specified=True)
dbdir_flag = dbdir_specified or dbdir is not None
db_flag = db_specified or db is not None
if dbdir_flag:
# Priority 1
dbdir_ = realpath(dbdir)
elif db_flag:
# Priority 2
dbdir_ = db_to_dbdir(db, allow_newdir=allow_newdir)
else:
# Priority 3
if defaultdb == 'cache':
dbdir_ = get_default_dbdir()
else:
dbdir_ = db_to_dbdir(defaultdb, allow_newdir=allow_newdir)
return dbdir_
开发者ID:heroinlin,项目名称:ibeis,代码行数:52,代码来源:sysres.py
示例8: train_featscore_normalizer
def train_featscore_normalizer():
r"""
CommandLine:
python -m ibeis --tf train_featscore_normalizer --show
# Write Encoder
python -m ibeis --tf train_featscore_normalizer --db PZ_MTEST -t best -a default --fsvx=0 --threshx=1 --show
# Visualize encoder score adjustment
python -m ibeis --tf TestResult.draw_feat_scoresep --db PZ_MTEST -a timectrl -t best:lnbnn_normer=lnbnn_fg_featscore --show --nocache --nocache-hs
# Compare ranking with encoder vs without
python -m ibeis --tf draw_rank_cdf --db PZ_MTEST -a timectrl -t best:lnbnn_normer=[None,wulu] --show
python -m ibeis --tf draw_rank_cdf --db PZ_MTEST -a default -t best:lnbnn_normer=[None,wulu] --show
# Compare in ipynb
python -m ibeis --tf autogen_ipynb --ipynb --db PZ_MTEST -a default -t best:lnbnn_normer=[None,lnbnn_fg_0.9__featscore]
# Big Test
python -m ibeis --tf draw_rank_cdf --db PZ_Master1 -a timectrl -t best:lnbnn_normer=[None,lovb],lnbnn_norm_thresh=.5 --show
python -m ibeis --tf draw_rank_cdf --db PZ_Master1 -a timectrl -t best:lnbnn_normer=[None,jypz],lnbnn_norm_thresh=.1 --show
python -m ibeis --tf draw_rank_cdf --db PZ_Master1 -a timectrl -t best:lnbnn_normer=[None,jypz],lnbnn_norm_thresh=0 --show
# Big Train
python -m ibeis --tf learn_featscore_normalizer --db PZ_Master1 -a timectrl -t best:K=1 --fsvx=0 --threshx=1 --show
python -m ibeis --tf train_featscore_normalizer --db PZ_Master1 -a timectrl:has_none=photobomb -t best:K=1 --fsvx=0 --threshx=1 --show --ainfo
python -m ibeis --tf train_featscore_normalizer --db PZ_Master1 -a timectrl:has_none=photobomb -t best:K=1 --fsvx=0 --threshx=1 --show
python -m ibeis --tf train_featscore_normalizer --db PZ_Master1 -a timectrl:has_none=photobomb -t best:K=3 --fsvx=0 --threshx=1 --show
Example:
>>> # SCRIPT
>>> from ibeis.algo.hots.scorenorm import * # NOQA
>>> encoder = train_featscore_normalizer()
>>> encoder.visualize(figtitle=encoder.get_cfgstr())
>>> ut.show_if_requested()
"""
import ibeis
# TODO: training / loading / general external models
qreq_ = ibeis.testdata_qreq_(
defaultdb='PZ_MTEST', a=['default'], p=['default'])
datakw = dict(
disttypes_=None,
namemode=ut.get_argval('--namemode', default=True),
fsvx=ut.get_argval('--fsvx', type_='fuzzy_subset',
default=slice(None, None, None)),
threshx=ut.get_argval('--threshx', type_=int, default=None),
thresh=ut.get_argval('--thresh', type_=float, default=.9),
)
encoder = learn_featscore_normalizer(qreq_, datakw=datakw)
encoder.save()
return encoder
开发者ID:heroinlin,项目名称:ibeis,代码行数:52,代码来源:scorenorm.py
示例9: testdata_showname
def testdata_showname():
import ibeis
ibs = ibeis.opendb(defaultdb='testdb1')
default = None
if ibs.dbname == 'testdb1':
default = 'easy'
name_text = ut.get_argval('--name', type_=str, default=default)
if name_text is None:
nid = 1
else:
nid = ibs.get_name_rowids_from_text(name_text)
in_image = not ut.get_argflag('--no-inimage')
index_list = ut.get_argval('--index_list', type_=list, default=None)
return ibs, nid, in_image, index_list
开发者ID:Erotemic,项目名称:ibeis,代码行数:15,代码来源:viz_name.py
示例10: testdata_matching_affine_inliers
def testdata_matching_affine_inliers():
import vtool.tests.dummy as dummy
import vtool as vt
scale_thresh = 2.0
xy_thresh = ut.get_argval('--xy-thresh', type_=float, default=.01)
dlen_sqrd2 = 447271.015
ori_thresh = 1.57
xy_thresh_sqrd = dlen_sqrd2 * xy_thresh
featkw = ut.argparse_dict(vt.get_extract_features_default_params())
fname1 = ut.get_argval('--fname1', type_=str, default='easy1.png')
fname2 = ut.get_argval('--fname2', type_=str, default='easy2.png')
(kpts1, kpts2, fm, fs, rchip1, rchip2) = dummy.testdata_ratio_matches(fname1, fname2, **featkw)
aff_inliers, aff_errors, Aff = get_best_affine_inliers_(
kpts1, kpts2, fm, fs, xy_thresh_sqrd, scale_thresh, ori_thresh)
return kpts1, kpts2, fm, aff_inliers, rchip1, rchip2, xy_thresh_sqrd
开发者ID:Erotemic,项目名称:vtool,代码行数:15,代码来源:spatial_verification.py
示例11: parse_latex_comments_for_commmands
def parse_latex_comments_for_commmands():
r"""
CommandLine:
python -m ibeis.scripts.gen_cand_expts --exec-parse_latex_comments_for_commmands
Example:
>>> # SCRIPT
>>> from ibeis.scripts.gen_cand_expts import * # NOQA
>>> parse_latex_comments_for_commmands()
"""
fname = ut.get_argval('--fname', type_=str, default='figdefexpt.tex')
text = ut.read_from(ut.truepath('~/latex/crall-candidacy-2015/' + fname))
#text = ut.read_from(ut.truepath('~/latex/crall-candidacy-2015/figdefindiv.tex'))
lines = text.split('\n')
cmd_list = ['']
in_comment = True
for line in lines:
if line.startswith('% ---'):
# Keep separators
toadd = line.replace('%', '#')
if not (len(cmd_list) > 1 and cmd_list[-1].startswith('# ---')):
cmd_list[-1] += (toadd)
else:
cmd_list.append(toadd)
cmd_list.append('')
if line.strip().startswith(r'\begin{comment}'):
in_comment = True
continue
if in_comment:
line = line.strip()
if line == '' or line.startswith('#') or line.startswith('%'):
in_comment = False
else:
cmd_list[-1] = cmd_list[-1] + line
if not line.strip().endswith('\\'):
cmd_list[-1] = cmd_list[-1] + ' [email protected]'
#cmd_list.append('')
#cmd_list.append('#--')
cmd_list.append('')
in_comment = False
else:
cmd_list[-1] = cmd_list[-1] + '\n'
cmd_list = [cmd.replace('--render', '').replace('--diskshow', '') for cmd in cmd_list]
# formatting
cmd_list2 = []
for cmd in cmd_list:
#cmd = cmd.replace(' -t ', ' \\\n -t ')
#cmd = cmd.replace('--db', '\\\n --db')
#cmd = cmd.replace('python -m ibeis.dev', './dev.py')
cmd = cmd.replace('python -m ibeis.dev -e', 'ibeis -e')
cmd_list2.append(cmd)
cmd_list = cmd_list2
print('cmd_list = %s' % (ut.list_str(cmd_list),))
from os.path import splitext
script_fname = 'regen_' + splitext(fname)[0] + '.sh'
fname, script, line_list = write_script_lines(cmd_list, script_fname)
开发者ID:heroinlin,项目名称:ibeis,代码行数:60,代码来源:gen_cand_expts.py
示例12: testdata_pipecfg
def testdata_pipecfg(p=None, t=None):
r"""
Returns:
dict: pcfgdict
CommandLine:
python -m ibeis.init.main_helpers --exec-testdata_pipecfg
python -m ibeis.init.main_helpers --exec-testdata_pipecfg -t default:AI=False
Example:
>>> # ENABLE_DOCTEST
>>> from ibeis.init.main_helpers import * # NOQA
>>> pcfgdict = testdata_pipecfg()
>>> result = ('pcfgdict = %s' % (ut.dict_str(pcfgdict),))
>>> print(result)
"""
print('[main_helpers] testdata_pipecfg')
if t is not None and p is None:
p = t
if p is None:
p = ['default']
from ibeis.expt import experiment_helpers
test_cfg_name_list = ut.get_argval(('-t', '-p'), type_=list, default=p)
pcfgdict_list = experiment_helpers.get_pipecfg_list(test_cfg_name_list)[0]
assert len(pcfgdict_list) == 1, 'can only specify one pipeline config here'
pcfgdict = pcfgdict_list[0]
return pcfgdict
开发者ID:Erotemic,项目名称:ibeis,代码行数:27,代码来源:main_helpers.py
示例13: run_devprecmds
def run_devprecmds():
"""
Looks for pre-tests specified with the -t flag and runs them
"""
#input_precmd_list = params.args.tests[:]
input_precmd_list = ut.get_argval('-e', type_=list, default=[])
valid_precmd_list = []
def intest(*args, **kwargs):
for precmd_name in args:
valid_precmd_list.append(precmd_name)
ret = precmd_name in input_precmd_list
ret2 = precmd_name in params.unknown # Let unparsed args count towards tests
if ret or ret2:
if ret:
input_precmd_list.remove(precmd_name)
else:
ret = ret2
print('+===================')
print('| running precmd = %s' % (args,))
return ret
return False
ut.start_logging(appname='ibeis')
# Implicit (decorated) test functions
for (func_aliases, func) in DEVPRECMD_FUNCTIONS:
if intest(*func_aliases):
#with utool.Indenter('[dev.' + get_funcname(func) + ']'):
func()
print('Exiting after first precommand')
sys.exit(1)
if len(input_precmd_list) > 0:
raise AssertionError('Unhandled tests: ' + repr(input_precmd_list))
开发者ID:Erotemic,项目名称:ibeis,代码行数:33,代码来源:dev.py
示例14: grab_numpy_testdata
def grab_numpy_testdata(shape=(3e3, 128), dtype=np.uint8):
ndata = utool.get_argval('--ndata', type_=int, default=2)
print('[TEST] build ndata=%d numpy arrays with shape=%r' % (ndata, shape))
print(' * expected_memory(table_list) = %s' % utool.byte_str2(ndata * np.product(shape)))
table_list = [np.empty(shape, dtype=dtype) for i in range(ndata)]
print(' * memory+overhead(table_list) = %s' % utool.byte_str2(utool.get_object_size(table_list)))
return table_list
开发者ID:Erotemic,项目名称:ibeis,代码行数:7,代码来源:test_sql_numpy.py
示例15: incremental_test
def incremental_test(ibs, qaid_list, daid_list=None):
"""
Adds / queries new images one at a time to a clean test database.
Tests the complete system.
Args:
ibs (list) : IBEISController object
qaid_list (list) : list of annotation-ids to query
CommandLine:
python dev.py -t inc --db PZ_MTEST --qaid 1:30:3 --cmd
python dev.py --db PZ_MTEST --allgt --cmd
python dev.py --db PZ_MTEST --allgt -t inc
python dev.py -t inc --db PZ_MTEST --qaid 1:30:3 --cmd
python dev.py -t inc --db GZ_ALL --ninit 100 --noqcache
python dev.py -t inc --db PZ_MTEST --noqcache --interactive-after 40
python dev.py -t inc --db PZ_Master0 --noqcache --interactive-after 10000 --ninit 400
Example:
>>> from ibeis.all_imports import * # NOQA
>>> ibs = ibeis.opendb('PZ_MTEST')
>>> qaid_list = ibs.get_valid_aids()
>>> daid_list = None
"""
from ibeis.algo.hots import automated_matcher
ibs1 = ibs
num_initial = ut.get_argval('--ninit', type_=int, default=0)
return automated_matcher.incremental_test(ibs1, num_initial)
开发者ID:Erotemic,项目名称:ibeis,代码行数:33,代码来源:dev.py
示例16: demo_model_idependencies
def demo_model_idependencies():
"""
Independences of the 3 annot 3 name model
CommandLine:
python -m ibeis.algo.hots.demobayes --exec-demo_model_idependencies --mode=1 --num-names=2 --show
python -m ibeis.algo.hots.demobayes --exec-demo_model_idependencies --mode=2
Example:
>>> # DISABLE_DOCTEST
>>> from ibeis.algo.hots.demobayes import * # NOQA
>>> result = demo_model_idependencies()
>>> print(result)
>>> ut.show_if_requested()
"""
num_names = ut.get_argval('--num-names', default=3)
model = test_model(num_annots=num_names, num_names=num_names, score_evidence=[], name_evidence=[])[0]
# This model has the following independenceis
idens = model.get_independencies()
iden_strs = [', '.join(sorted(iden.event1)) +
' _L ' +
','.join(sorted(iden.event2)) +
' | ' +
', '.join(sorted(iden.event3))
for iden in idens.independencies]
print('general idependencies')
print(ut.align(ut.align('\n'.join(sorted(iden_strs)), '_'), '|'))
开发者ID:heroinlin,项目名称:ibeis,代码行数:28,代码来源:demobayes.py
示例17: main
def main():
r"""
python win32bootstrap.py --dl numpy --nocache
python win32bootstrap.py --dl numpy-1.9.2rc1 --force
python win32bootstrap.py --dl numpy-1.9.2rc1 --run
python win32bootstrap.py --force
python win32bootstrap.py --dryrun
python win32bootstrap.py --dryrun --dl numpy scipy
python win32bootstrap.py --dl numpy
C:\Users\jon.crall\AppData\Roaming\utool\numpy-1.9.2rc1+mkl-cp27-none-win32.whl
pip install C:/Users/jon.crall/AppData/Roaming/utool/numpy-1.9.2rc1+mkl-cp27-none-win32.whl
"""
# Packages that you are requesting
pkg_list = []
if ut.get_argflag('--all'):
pkg_list = KNOWN_PKG_LIST
else:
print('specify --all to download all packages')
print('or specify --dl pkgname to download that package')
pkg_list.extend(ut.get_argval('--dl', list, []))
dryrun = ut.get_argflag('--dryrun')
pkg_exe_list = bootstrap_sysreq(pkg_list, dryrun=dryrun)
if ut.get_argflag('--run'):
for pkg_exe in pkg_exe_list:
if pkg_exe.endswith('.whl'):
ut.cmd('pip install ' + pkg_exe)
开发者ID:Erotemic,项目名称:ibeis,代码行数:28,代码来源:win32bootstrap.py
示例18: draw_tree_model
def draw_tree_model(model, **kwargs):
import plottool as pt
import networkx as netx
if not ut.get_argval('--hackjunc'):
fnum = pt.ensure_fnum(None)
fig = pt.figure(fnum=fnum, doclf=True) # NOQA
ax = pt.gca()
#name_nodes = sorted(ut.list_getattr(model.ttype2_cpds['name'], 'variable'))
netx_graph = model.to_markov_model()
#pos = netx.pygraphviz_layout(netx_graph)
#pos = netx.graphviz_layout(netx_graph)
#pos = get_hacked_pos(netx_graph, name_nodes, prog='neato')
pos = netx.pydot_layout(netx_graph)
node_color = [pt.WHITE] * len(pos)
drawkw = dict(pos=pos, ax=ax, with_labels=True, node_color=node_color,
node_size=1100)
netx.draw(netx_graph, **drawkw)
if kwargs.get('show_title', True):
pt.set_figtitle('Markov Model')
if not ut.get_argval('--hackmarkov'):
fnum = pt.ensure_fnum(None)
fig = pt.figure(fnum=fnum, doclf=True) # NOQA
ax = pt.gca()
netx_graph = model.to_junction_tree()
# prettify nodes
def fixtupkeys(dict_):
return {
', '.join(k) if isinstance(k, tuple) else k: fixtupkeys(v)
for k, v in dict_.items()
}
n = fixtupkeys(netx_graph.node)
e = fixtupkeys(netx_graph.edge)
a = fixtupkeys(netx_graph.adj)
netx_graph.node = n
netx_graph.edge = e
netx_graph.adj = a
#netx_graph = model.to_markov_model()
#pos = netx.pygraphviz_layout(netx_graph)
#pos = netx.graphviz_layout(netx_graph)
pos = netx.pydot_layout(netx_graph)
node_color = [pt.WHITE] * len(pos)
drawkw = dict(pos=pos, ax=ax, with_labels=True, node_color=node_color,
node_size=2000)
netx.draw(netx_graph, **drawkw)
if kwargs.get('show_title', True):
pt.set_figtitle('Junction/Clique Tree / Cluster Graph')
开发者ID:heroinlin,项目名称:ibeis,代码行数:47,代码来源:bayes.py
示例19: show_hist_submaxima
def show_hist_submaxima(hist_, edges=None, centers=None, maxima_thresh=.8, pnum=(1, 1, 1)):
r"""
For C++ to show data
Args:
hist_ (?):
edges (None):
centers (None):
CommandLine:
python -m vtool.histogram --test-show_hist_submaxima --show
python -m pyhesaff._pyhesaff --test-test_rot_invar --show
python -m vtool.histogram --test-show_hist_submaxima --dpath figures --save ~/latex/crall-candidacy-2015/figures/show_hist_submaxima.jpg
Example:
>>> # DISABLE_DOCTEST
>>> import plottool as pt
>>> from vtool.histogram import * # NOQA
>>> # build test data
>>> hist_ = np.array(list(map(float, ut.get_argval('--hist', type_=list, default=[1, 4, 2, 5, 3, 3]))))
>>> edges = np.array(list(map(float, ut.get_argval('--edges', type_=list, default=[0, 1, 2, 3, 4, 5, 6]))))
>>> maxima_thresh = ut.get_argval('--maxima_thresh', type_=float, default=.8)
>>> centers = None
>>> # execute function
>>> show_hist_submaxima(hist_, edges, centers, maxima_thresh)
>>> pt.show_if_requested()
"""
#print(repr(hist_))
#print(repr(hist_.shape))
#print(repr(edges))
#print(repr(edges.shape))
#ut.embed()
import plottool as pt
#ut.embed()
if centers is None:
centers = hist_edges_to_centers(edges)
bin_colors = pt.get_orientation_color(centers)
pt.figure(fnum=pt.next_fnum(), pnum=pnum)
POLAR = False
if POLAR:
pt.df2.plt.subplot(*pnum, polar=True, axisbg='#000000')
pt.draw_hist_subbin_maxima(hist_, centers, bin_colors=bin_colors, maxima_thresh=maxima_thresh)
#pt.gca().set_rmax(hist_.max() * 1.1)
#pt.gca().invert_yaxis()
#pt.gca().invert_xaxis()
pt.dark_background()
#if ut.get_argflag('--legend'):
# pt.figure(fnum=pt.next_fnum())
# centers_ = np.append(centers, centers[0])
# r = np.ones(centers_.shape) * .2
# ax = pt.df2.plt.subplot(111, polar=True)
# pt.plots.colorline(centers_, r, cmap=pt.df2.plt.get_cmap('hsv'), linewidth=10)
# #ax.plot(centers_, r, 'm', color=bin_colors, linewidth=100)
# ax.set_rmax(.2)
# #ax.grid(True)
# #ax.set_title("Angle Colors", va='bottom')
title = ut.get_argval('--title', default='')
import plottool as pt
pt.set_figtitle(title)
开发者ID:Erotemic,项目名称:vtool,代码行数:59,代码来源:histogram.py
示例20: make_ibeis_cell_list
def make_ibeis_cell_list(ibs):
cell_template_list = get_default_cell_template_list(ibs)
autogen_str = ut.make_autogen_str()
dbname = ibs.get_dbname()
default_acfgstr = ut.get_argval('-a', type_=str, default='default:is_known=True')
asreport = ut.get_argflag('--asreport')
default_pcfgstr_list = ut.get_argval(('-t', '-p'), type_=list, default='default')
default_pcfgstr = ut.repr3(default_pcfgstr_list, nobr=True)
if asreport:
annotconfig_list_body = ut.codeblock(
ut.repr2(default_acfgstr) )
pipeline_list_body = ut.codeblock(
default_pcfgstr
)
else:
annotconfig_list_body = ut.codeblock(
ut.repr2(default_acfgstr) + '\n' +
ut.codeblock('''
# See ibeis/expt/annotation_configs.py for names of annot configuration options
#'default:has_any=(query,),dpername=1,exclude_reference=True',
#'default:is_known=True',
#'default:qsame_imageset=True,been_adjusted=True,excluderef=True,qsize=10,dsize=20',
#'default:require_timestamp=True,min_timedelta=3600',
#'default:species=primary',
#'timectrl:',
#'unctrl:been_adjusted=True',
''')
)
pipeline_list_body = ut.codeblock(
default_pcfgstr + '\n' +
ut.codeblock('''
#'default',
#'default:K=1,AI=False,QRH=True',
#'default:K=1,RI=True,AI=False',
#'default:K=1,adapteq=True',
#'default:fg_on=[True,False]',
''')
)
locals_ = locals()
_format = partial(ut.format_cells, locals_=locals_)
cell_list = ut.flatten(map(_format, cell_template_list))
return cell_list
开发者ID:Erotemic,项目名称:ibeis,代码行数:46,代码来源:generate_notebook.py
注:本文中的utool.get_argval函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论