本文整理汇总了Python中reprep.Report.subsection方法的典型用法代码示例。如果您正苦于以下问题:Python Report.subsection方法的具体用法?Python Report.subsection怎么用?Python Report.subsection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reprep.Report
的用法示例。
在下文中一共展示了Report.subsection方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: report_servo1
# 需要导入模块: from reprep import Report [as 别名]
# 或者: from reprep.Report import subsection [as 别名]
def report_servo1(processed, area_graphs):
r = Report('servo1')
nmap = processed['nmap']
servo = processed['servo']
centroid = processed['centroid']
robot = processed['robot']
with r.subsection('u', robust=False) as s:
commands = [x['u'] for x in servo]
vels = map(robot.debug_get_vel_from_commands, commands)
vels = map(se2_project_from_se3, vels)
repsec_servo1_generic_vel_field(s, 'u', centroid, nmap, vels,
normalize=True, area_graphs=area_graphs)
if 'u_raw' in servo[0]:
with r.subsection('u_raw', robust=True) as s:
commands = [x['u_raw'] for x in servo]
vels = map(robot.debug_get_vel_from_commands, commands)
vels = map(se2_project_from_se3, vels)
repsec_servo1_generic_vel_field(s, 'u_raw', centroid, nmap, vels,
normalize=True, area_graphs=area_graphs)
if 'descent' in servo[0]:
with r.subsection('descent', robust=True) as s:
commands = [x['descent'] for x in servo]
vels = map(robot.debug_get_vel_from_commands, commands)
vels = map(se2_project_from_se3, vels)
repsec_servo1_generic_vel_field(s, 'descent', centroid, nmap, vels,
normalize=False, area_graphs=area_graphs)
return r
示例2: aer_stats_freq_meat
# 需要导入模块: from reprep import Report [as 别名]
# 或者: from reprep.Report import subsection [as 别名]
def aer_stats_freq_meat(log, pipeline):
events = aer_pipeline_transitions1_all(log, pipeline)
r = Report('index')
with r.subsection('all') as sub:
report_band(sub, events, min_f=20.0, max_f=3000.0)
with r.subsection('high') as sub:
report_band(sub, events, min_f=500.0, max_f=3000.0)
return r
示例3: report_dds_geometry
# 需要导入模块: from reprep import Report [as 别名]
# 或者: from reprep.Report import subsection [as 别名]
def report_dds_geometry(id_discdds, tolerance):
dds = get_conftools_discdds().instance(id_discdds)
r = Report('dds_geometry-%s-%s' % (id_discdds, tolerance))
ds = DiffeoStructure(dds, tolerance=tolerance)
with r.subsection('display') as r:
ds.display(r)
with r.subsection('show_reduction_steps') as r:
ds.show_reduction_steps(r, max_nsteps=5)
with r.subsection('show_reduction') as r:
ds.show_reduction(r)
return r
示例4: go
# 需要导入模块: from reprep import Report [as 别名]
# 或者: from reprep.Report import subsection [as 别名]
def go():
ieee_fonts_zoom3(pylab)
r = Report()
algos = [InvMult2.ALGO_UNIFORM, InvMult2.ALGO_VAN_DER_CORPUT]
for algo in algos:
InvMult2.ALGO = algo
InvPlus2.ALGO = algo
print("Using algorithm %s " % algo)
with r.subsection(algo) as r2:
# first
F = parse_poset("dimensionless")
R = F
dp = InvMult2(F, (R, R))
ns = [3, 4, 5, 6, 10, 15]
axis = (0.0, 6.0, 0.0, 6.0)
with r2.subsection("invmult2") as rr:
go1(rr, ns, dp, plot_nominal_invmult, axis)
# second
axis = (0.0, 1.2, 0.0, 1.2)
dp = InvPlus2(F, (R, R))
with r2.subsection("invplus2") as rr:
go1(rr, ns, dp, plot_nominal_invplus, axis)
fn = "out-plot_approximations/report.html"
print("writing to %s" % fn)
r.to_html(fn)
示例5: test_consistency_uncertainty
# 需要导入模块: from reprep import Report [as 别名]
# 或者: from reprep.Report import subsection [as 别名]
def test_consistency_uncertainty():
print 'here'
pass
contracts.disable_all()
symdds = 'sym-dpchain1-120'
print('instancing dds %s' % symdds)
dds = get_conftools_discdds().instance(symdds)
shape = dds.get_shape()
d1f = dds.actions[0].get_diffeo2d_forward()
d1b = dds.actions[0].get_diffeo2d_backward()
fb = Diffeomorphism2D.compose(d1f, d1b)
bf = Diffeomorphism2D.compose(d1b, d1f)
identity = Diffeomorphism2D.identity(shape)
print Diffeomorphism2D.distance_L2_infow(d1f, identity)
print Diffeomorphism2D.distance_L2_infow(d1b, identity)
print Diffeomorphism2D.distance_L2_infow(fb, identity)
print Diffeomorphism2D.distance_L2_infow(bf, identity)
action = dds.actions[0]
action2 = consistency_based_uncertainty(action, None)
r = Report(symdds)
r.text('symdds', symdds)
with r.subsection('action') as sub:
action.display(sub)
with r.subsection('action2') as sub:
action2.display(sub)
#
# with r.subsection('misc') as sub:
# d = d1f.get_discretized_diffeo()
# f = sub.figure()
# f.array_as_image('d0', d[:, :, 0])
# f.array_as_image('d1', d[:, :, 1])
#
# with r.subsection('d1f') as sub:
# d1f.display(sub)
# with r.subsection('d1b') as sub:
# d1b.display(sub)
#
# with r.subsection('fb') as sub:
# fb.display(sub)
# with r.subsection('bf') as sub:
# bf.display(sub)
r.to_html('test_consistency_uncertainty.html')
示例6: plot_different_solutions
# 需要导入模块: from reprep import Report [as 别名]
# 或者: from reprep.Report import subsection [as 别名]
def plot_different_solutions(libname, ndpname, query, out, upper=None):
if not os.path.exists(out):
os.makedirs(out)
library = get_test_library(libname)
#library.use_cache_dir(os.path.join(out, 'cache'))
context = Context()
ndp = library.load_ndp(ndpname, context)
context = library._generate_context_with_hooks()
ndp_labelled = get_labelled_version(ndp)
dp0 = ndp_labelled.get_dp()
if upper is not None:
_, dpU = get_dp_bounds(dp0, nl=1, nu=upper)
dp = dpU
else:
dp = dp0
M = dp.get_imp_space()
with open(os.path.join(out, 'ndp.txt'), 'w') as f:
f.write(ndp.repr_long())
with open(os.path.join(out, 'M.txt'), 'w') as f:
f.write(M.repr_long())
with open(os.path.join(out, 'dp.txt'), 'w') as f:
f.write(dp.repr_long())
with open(os.path.join(out, 'dp0.txt'), 'w') as f:
f.write(dp0.repr_long())
f = convert_string_query(ndp=ndp, query=query, context=context)
report = Report()
res = dp.solve(f)
print('num solutions: %s' % len(res.minimals))
for ri, r in enumerate(res.minimals):
ms = dp.get_implementations_f_r(f, r)
for j, m in enumerate(ms):
imp_dict = get_imp_as_recursive_dict(M, m)
print imp_dict
images_paths = library.get_images_paths()
gv = GetValues(ndp=ndp, imp_dict=imp_dict, nu=upper, nl=1)
gg = gvgen_from_ndp(ndp=ndp, style=STYLE_GREENREDSYM,
images_paths=images_paths,
plotting_info=gv)
with report.subsection('%s-%s' % (ri, j)) as rr:
gg_figure(rr, 'figure', gg, do_png=True, do_pdf=False,
do_svg=False, do_dot=False)
fn = os.path.join(out, 'solutions.html')
print('writing to %s' % fn)
report.to_html(fn)
示例7: aer_stats_events_meat
# 需要导入模块: from reprep import Report [as 别名]
# 或者: from reprep.Report import subsection [as 别名]
def aer_stats_events_meat(log):
# events = collect_all(aer_load_log_generic(log))
events = aer_raw_events_from_file_all(log)
hist = aer_histogram(events)
_, coords = md_argmax(hist)
r = Report('index')
with r.subsection('sub') as sub:
report_for_one(sub, events, coords)
return r
示例8: make_stream_report
# 需要导入模块: from reprep import Report [as 别名]
# 或者: from reprep.Report import subsection [as 别名]
def make_stream_report(id_stream, nsamples):
config = get_diffeo2ddslearn_config()
stream = config.streams.instance(id_stream)
r = Report(id_stream)
data = itertools.islice(stream.read_all(), nsamples)
for i, log_item in enumerate(data):
with r.subsection('log_item%d' % i) as sub:
log_item.display(sub)
return r
示例9: report_agent
# 需要导入模块: from reprep import Report [as 别名]
# 或者: from reprep.Report import subsection [as 别名]
def report_agent(res, pomdp):
agent = res['agent']
r = Report()
f = r.figure()
p_p0 = pomdp.get_start_dist_dist()
for i, (p0, _) in enumerate(p_p0.items()):
with f.plot('p0-%d' % i) as pylab:
pomdp.display_state_dist(pylab, p0)
turn_all_axes_off(pylab)
with r.subsection('states') as sub:
agent.report_states(sub)
with r.subsection('transitions') as sub:
agent.report_transitions(sub)
return r
示例10: report_ndp1
# 需要导入模块: from reprep import Report [as 别名]
# 或者: from reprep.Report import subsection [as 别名]
def report_ndp1(ndp):
r = Report()
gg = gvgen_from_ndp(ndp)
gg_figure(r, 'graph', gg)
styles = ['greenred', 'clean', 'greenredsym']
for style in styles:
with r.subsection(style) as r2:
gg = gvgen_from_ndp(ndp, style=style)
gg_figure(r2, 'graph', gg)
return r
示例11: report_raw_display
# 需要导入模块: from reprep import Report [as 别名]
# 或者: from reprep.Report import subsection [as 别名]
def report_raw_display(processed):
r = Report('raw_display')
f = r.figure()
centroid = processed['centroid']
nmap = processed['nmap']
xy = processed['nmap'].get_R2_points()
caption = "Raw trajectory and selected points"
with f.plot('sparse_xy', caption=caption) as pylab:
xy = np.array(xy)
pylab.plot(xy[:, 0], xy[:, 1], 'k+')
pylab.plot(centroid[0], centroid[1], 'go')
nmap.plot_points(pylab)
pylab.axis('equal')
with r.subsection('nmap') as n:
processed['nmap'].display(n)
return r
示例12: report_servo_details
# 需要导入模块: from reprep import Report [as 别名]
# 或者: from reprep.Report import subsection [as 别名]
def report_servo_details(servo_agent, processed, nsamples=6):
r = Report('servo_details')
nmap = processed['nmap']
y_goal = processed['y_goal']
robot = processed['robot']
for i in range(nsamples):
j = np.random.randint(len(nmap.data))
y0 = nmap.get_observations_at(j)
servo = processed['servo'][j]
with r.subsection('sample%s' % i) as r_i:
f = r.figure(cols=4)
with f.plot('map') as pylab:
nmap.plot_points(pylab)
vel = robot.debug_get_vel_from_commands(servo['u'])
nmap.plot_vel_at_index(pylab, j, se2_project_from_se3(vel), length=0.05)
with r_i.subsection('query') as rq:
servo_agent.display_query(rq, observations=y0, goal=y_goal)
return r
示例13: solve_main
# 需要导入模块: from reprep import Report [as 别名]
# 或者: from reprep.Report import subsection [as 别名]
#.........这里部分代码省略.........
print("artifact: %s" % artifact)
tracer.log(s)
if expect_nimp is not None:
if expect_nimp != nimplementations:
msg = "Found wrong number of implementations"
raise_desc(ExpectationsNotMet, msg, expect_nimp=expect_nimp, nimplementations=nimplementations)
# if expect_res is not None:
# value = interpret_string(expect_res)
# tracer.log('value: %s' % value)
# res_expected = value.value
# tu = get_types_universe()
# # If it's a tuple of two elements, then we assume it's upper/lower bounds
# if isinstance(value.unit, PosetProduct):
# subs = value.unit.subs
# assert len(subs) == 2, subs
#
# lower_UR_expected, upper_UR_expected = subs
# lower_res_expected, upper_res_expected = value.value
#
# lower_bound = tu.get_embedding(lower_UR_expected, UR)[0](lower_res_expected)
# upper_bound = tu.get_embedding(upper_UR_expected, UR)[0](upper_res_expected)
#
# tracer.log('lower: %s <= %s' % (UR.format(lower_bound), UR.format(res)))
# tracer.log('upper: %s <= %s' % (UR.format(upper_bound), UR.format(res)))
#
# UR.check_leq(lower_bound, res)
# UR.check_leq(res, upper_bound)
# else:
# # only one element: equality
# UR_expected = value.unit
# tu.check_leq(UR_expected, UR)
# A_to_B, _B_to_A = tu.get_embedding(UR_expected, UR)
#
# res_expected_f = A_to_B(res_expected)
# try:
# UR.check_equal(res, res_expected_f)
# except NotEqual as e:
# raise_wrapped(ExpectationsNotMet, e, 'res is different',
# res=res, res_expected=res_expected, compact=True)
if plot:
r = Report()
if _exp_advanced:
from mcdp_report.generic_report_utils import generic_report
generic_report(r, dp, trace, annotation=None, axis0=(0, 0, 0, 0))
else:
f = r.figure()
from mcdp_report.generic_report_utils import generic_plot
generic_plot(f, space=UR, value=res)
from mcdp_report.generic_report_utils import generic_report_trace
generic_report_trace(r, ndp, dp, trace, out, do_movie=do_movie)
out_html = os.path.join(out, "report.html")
logger.info("writing to %r" % out_html)
r.to_html(out_html)
if plot and imp:
from mcdp_report_ndp_tests.test1 import GetValues
from mcdp_report.gg_ndp import gvgen_from_ndp
from mcdp_report.gdc import STYLE_GREENREDSYM
from mcdp_report.gg_utils import gg_figure
M = dp.get_imp_space()
report_solutions = Report()
for i, r in enumerate(res.minimals):
ms = dp.get_implementations_f_r(fg, r)
for j, m in enumerate(ms):
imp_dict = get_imp_as_recursive_dict(M, m)
images_paths = library.get_images_paths()
gv = GetValues(ndp=ndp, imp_dict=imp_dict, nu=upper, nl=1)
setattr(ndp, "_hack_force_enclose", True)
with report_solutions.subsection("sol-%s-%s" % (i, j)) as rr:
# Left right
gg = gvgen_from_ndp(
ndp=ndp, style=STYLE_GREENREDSYM, images_paths=images_paths, plotting_info=gv, direction="LR"
)
gg_figure(rr, "figure", gg, do_png=True, do_pdf=True, do_svg=False, do_dot=False)
# Top-bottom
gg = gvgen_from_ndp(
ndp=ndp, style=STYLE_GREENREDSYM, images_paths=images_paths, plotting_info=gv, direction="TB"
)
gg_figure(rr, "figure2", gg, do_png=True, do_pdf=True, do_svg=False, do_dot=False)
out_html = os.path.join(out, "report_solutions.html")
logger.info("writing to %r" % out_html)
report_solutions.to_html(out_html)
示例14: report
# 需要导入模块: from reprep import Report [as 别名]
# 或者: from reprep.Report import subsection [as 别名]
def report(res):
r = Report()
dataL = res['dataL']
dataU = res['dataU']
what_to_plot_res = dict(total_cost="USD", total_mass='kg')
what_to_plot_fun = dict(endurance="hour", extra_payload="g")
queries = dataL['queries']
endurance = [q['endurance'] for q in queries]
def get_value(data, field):
for res in data['results']:
a = to_numpy_array({field: 'kg'}, res)
if len(a):
a = min(a[field])
else:
a = None
yield a
from matplotlib import pylab
ieee_fonts_zoom3(pylab)
markers = dict(markeredgecolor='none', markerfacecolor='black', markersize=6,
marker='o')
LOWER2 = dict(color='orange', linewidth=4, linestyle='-', clip_on=False)
UPPER2 = dict(color='purple', linewidth=4, linestyle='-', clip_on=False)
LOWER2.update(markers)
UPPER2.update(markers)
color_resources = '#700000'
color_functions = '#007000'
fig = dict(figsize=(4.5, 4))
with r.plot('total_mass', **fig) as pylab:
ieee_spines_zoom3(pylab)
total_massL = np.array(list(get_value(dataL, 'total_mass')))
total_massU = np.array(list(get_value(dataU, 'total_mass')))
print endurance
print total_massL, total_massU
pylab.plot(endurance, total_massL, **LOWER2)
pylab.plot(endurance, total_massU, **UPPER2)
set_axis_colors(pylab, color_functions, color_resources)
pylab.xlabel('endurance [hours]')
pylab.ylabel('total_mass [kg]')
return r
print('Plotting lower')
with r.subsection('lower') as rL:
plot_all_directions(rL,
queries=dataL['queries'],
results=dataL['results'],
what_to_plot_res=what_to_plot_res,
what_to_plot_fun=what_to_plot_fun)
print('Plotting upper')
with r.subsection('upper') as rU:
plot_all_directions(rU,
queries=dataU['queries'],
results=dataU['results'],
what_to_plot_res=what_to_plot_res,
what_to_plot_fun=what_to_plot_fun)
return r