예제 #1
0
def visualize_result(id_tc, id_algo, stats):
    """ Returns a report """

    result = stats['result']
    r = Report('%s-%s' % (id_tc, id_algo))
    #    tc = config.testcases.instance(id_tc)
    #    discdds = config.discdds.instance(tc.id_discdds)
    algo = stats['algo']
    tc = stats['tc']
    discdds = algo.get_dds()

    tc.display(r.section('testcase'), discdds=discdds)

    if not result.success:
        r.text('warning', 'Plannning unsuccesful')
    else:
        rsol = r.section('solution')
        rsol.text('plan', 'Plan: %s' % str(result.plan))

        y0 = tc.y0
        y1 = tc.y1
        y1plan = discdds.predict(y0, result.plan)
        mismatch = np.abs(y1.get_values() - y1plan.get_values()).sum(axis=2)

        f = rsol.figure(cols=4)
        zoom = lambda x: rgb_zoom(x, 8)

        f.data_rgb('y1plan',
                   zoom(y1plan.get_rgb()),
                   caption='plan prediction (certain)')
        f.data_rgb('y1plan_certain',
                   zoom(y1plan.get_rgb_uncertain()),
                   caption='certainty of prediction')

        f.data_rgb('mismatch',
                   zoom(scale(mismatch)),
                   caption='Mismatch value pixel by pixel '
                   '(zero for synthetic testcases...)')

    algo.plan_report(r.section('planning'), result, tc)

    extra = result.extra

    write_log_lines(r, extra)

    return r
예제 #2
0
def visualize_result(id_tc, id_algo, stats):
    """ Returns a report """
    
    result = stats['result']
    r = Report('%s-%s' % (id_tc, id_algo))
#    tc = config.testcases.instance(id_tc)
#    discdds = config.discdds.instance(tc.id_discdds)
    algo = stats['algo']
    tc = stats['tc']
    discdds = algo.get_dds()
    
    tc.display(r.section('testcase'), discdds=discdds)
    
    if not result.success:
        r.text('warning', 'Plannning unsuccesful')
    else:
        rsol = r.section('solution')
        rsol.text('plan', 'Plan: %s' % str(result.plan))
    
        y0 = tc.y0
        y1 = tc.y1
        y1plan = discdds.predict(y0, result.plan)
        mismatch = np.abs(y1.get_values() - y1plan.get_values()).sum(axis=2)
        
        f = rsol.figure(cols=4)
        zoom = lambda x: rgb_zoom(x, 8)
        
        f.data_rgb('y1plan', zoom(y1plan.get_rgb()),
                   caption='plan prediction (certain)')
        f.data_rgb('y1plan_certain', zoom(y1plan.get_rgb_uncertain()),
                   caption='certainty of prediction')
        
        f.data_rgb('mismatch', zoom(scale(mismatch)),
                   caption='Mismatch value pixel by pixel '
                            '(zero for synthetic testcases...)')
    
    
    algo.plan_report(r.section('planning'), result, tc)
    
    extra = result.extra
    
    write_log_lines(r, extra)
    
    return r
예제 #3
0
def visualize_result(config, id_tc, id_algo, stats):
    """ Returns a report """
    set_current_config(config)

    result = stats["result"]
    r = Report("%s-%s" % (id_tc, id_algo))
    #    tc = config.testcases.instance(id_tc)
    #    discdds = config.discdds.instance(tc.id_discdds)
    algo = stats["algo"]
    tc = stats["tc"]
    discdds = algo.get_dds()

    tc.display(r.section("testcase"), discdds=discdds)

    if not result.success:
        r.text("warning", "Plannning unsuccesful")
    else:
        rsol = r.section("solution")
        rsol.text("plan", "Plan: %s" % str(result.plan))

        y0 = tc.y0
        y1 = tc.y1
        y1plan = discdds.predict(y0, result.plan)
        mismatch = np.abs(y1.get_values() - y1plan.get_values()).sum(axis=2)

        f = rsol.figure(cols=4)
        zoom = lambda x: rgb_zoom(x, 8)

        f.data_rgb("y1plan", zoom(y1plan.get_rgb()), caption="plan prediction (certain)")
        f.data_rgb("y1plan_certain", zoom(y1plan.get_rgb_uncertain()), caption="certainty of prediction")

        f.data_rgb(
            "mismatch",
            zoom(scale(mismatch)),
            caption="Mismatch value pixel by pixel " "(zero for synthetic testcases...)",
        )

    algo.plan_report(r.section("planning"), result, tc)

    extra = result.extra

    write_log_lines(r, extra)

    return r
예제 #4
0
def predict_report(data_central, id_agent, id_robot, statistics, save_pickle=False):
    from reprep import Report

    u_stats = statistics['u_stats'] 
    y_dot_stats = statistics['y_dot_stats'] 
    y_dot_sign_stats = statistics['y_dot_sign_stats']
    id_state = statistics['id_state']
    
    basename = 'pred-%s-%s' % (id_agent, id_robot)
    
    r = Report(basename)
    
    y_dot_stats.publish(r.section('y_dot'))
    y_dot_sign_stats.publish(r.section('y_dot_sign'))
    u_stats.publish(r.section('u'))
    
    ds = data_central.get_dir_structure()
    report_dir = ds.get_report_res_dir(id_agent=id_agent, id_robot=id_robot,
                                       id_state=id_state, phase='predict')
    filename = ds.get_report_filename(id_agent=id_agent, id_robot=id_robot,
                                       id_state=id_state, phase='predict')
    
    save_report(data_central, r, filename, resources_dir=report_dir,
                save_pickle=save_pickle) 
예제 #5
0
def all_demos(argv): #@UnusedVariable
    if len(argv) == 0:
        which = DemoStorage.demos.keys()
    else:
        which = argv

    print(DemoStorage.demos.keys())
    r = Report('reprep_demos')
    for id_f in which: 
        demof = DemoStorage.demos[id_f]
        ri = r.section(nid='%s' % demof.__name__, caption=demof.__doc__)
        ri.text('source', inspect.getsource(demof))
        with ri.subsection('output') as sub:
            demof(sub)

    r.to_html('reprep_demos_out/index.html')
예제 #6
0
파일: manager.py 프로젝트: alezana/reprep
def all_demos(argv):  # @UnusedVariable
    if len(argv) == 0:
        which = DemoStorage.demos.keys()
    else:
        which = argv

    print(DemoStorage.demos.keys())
    r = Report("reprep_demos")
    for id_f in which:
        demof = DemoStorage.demos[id_f]
        ri = r.section(nid="%s" % demof.__name__, caption=demof.__doc__)
        ri.text("source", inspect.getsource(demof))
        with ri.subsection("output") as sub:
            demof(sub)

    r.to_html("reprep_demos_out/index.html")
예제 #7
0
def main():
    theta = get_uniform_directions(360, 180)
    D = distances_from_angles(theta)
    
    def identity(x):
        return x
    
    def exp1(x):
        return np.exp(-x)
    
    def exp2(x):
        return np.exp(-5 * x)

    def exp3(x):
        return np.exp(-x * x)

    def p1(x):
        return np.cos(2 * np.pi - x)

    functions = [identity, exp1, exp2, exp3, p1]
    
    r = Report()
    for function in functions:
        name = function.__name__
        section = r.section(name)
        f = section.figure()
        
        M = function(D)
        sigma = 0.0001
        D1 = np.maximum(0, D + sigma * np.random.randn(*D.shape))
        M1 = function(D1)
        
        with f.plot('svd') as pylab:
            plot_matrix_svd(pylab, M)
        with f.plot('svd1', caption='Perturbed') as pylab:
            plot_matrix_svd(pylab, M1)

    out = 'check_rank.html'
    print('Writing to %r' % out)
    r.to_html(out)
예제 #8
0
def test_all_demos():
    for id_f in DemoStorage.demos:
        demof = DemoStorage.demos[id_f]
        r = Report(id_f)
        ri = r.section(nid="%s" % demof.__name__, caption=demof.__doc__)
        demof(ri)