def jobs_report_summary_servo_xy(context, combinations, explogs_test):
    parts = StoreResults()
    for id_robot, id_agent in combinations:
        for e in explogs_test:
            key = dict(id_robot=id_robot, id_agent=id_agent, id_episode=e.id_episode)
            job_id = 'part-' + basename_from_key(key)
            arrows = context.comp(get_node, 'xy_arrows_colors',
                                      context.get_report('servo1', **key),
                                      job_id=job_id)
            parts[key] = arrows 
    
    r = context.comp(report_servo1_global, combinations,
                     map(str, explogs_test), parts)
    context.add_report(r, 'servo1_global')
    
    interps = StoreResults()
    for id_robot, id_agent in combinations:
        for e in explogs_test:
            key = dict(id_robot=id_robot, id_agent=id_agent, id_episode=e.id_episode)
            job_id = 'interpolation-' + basename_from_key(key)
            field = context.comp(get_node, 'interpolation',
                                 context.get_report('distances2', **key),
                                 job_id=job_id)
            interps[key] = field 
            
    r = context.comp(report_distances2_global, combinations,
                     map(str, explogs_test), parts, interps)
    context.add_report(r, 'distances2_global')
def report_distances2_global(combs, explogs_test, arrows, interps):
    r = Report()
    figs = {}
    
    def get_fig(id_robot):
        if not id_robot in figs:
            figs[id_robot] = r.figure(cols=len(explogs_test), caption=id_robot)
        return figs[id_robot]
    
    for id_robot, id_agent in combs:

        for id_episode in map(str, explogs_test):
            key = dict(id_robot=id_robot, id_agent=id_agent, id_episode=id_episode)
            interp = interps[key]
            interp.nid = basename_from_key(key) + '-interp'
            interp.caption = '%s, %s' % (id_robot, id_agent)
            r.add_child(interp)
            get_fig(id_robot).sub(interp)

        for id_episode in map(str, explogs_test):
            key = dict(id_robot=id_robot, id_agent=id_agent, id_episode=id_episode)
            arrow = arrows[key]
            arrow.nid = basename_from_key(key) + '-vf'
            arrow.caption = '%s, %s' % (id_robot, id_agent)
            r.add_child(arrow)
            get_fig(id_robot).sub(arrow)

    return r
def report_summary_servo_theta(context, combinations, explogs_test):
    context = context.child('servo_theta')
    rp = ReportProxy(context)
    for id_robot, id_agent in combinations:
        context.needs(RM_AGENT_LEARN, id_robot=id_robot, id_agent=id_agent)
        
        f = rp.figure('%s-%s-servo_theta' % (id_robot, id_agent), cols=8,
                      caption='%s, %s' % (id_robot, id_agent))

        for e in explogs_test:

            key = dict(report_type='servo1', id_robot=id_robot,
                       id_agent=id_agent,
                       id_episode=e.id_episode)
        
            s = 'servo-%s-' % basename_from_key(dict(id_agent=id_agent,
                                                     id_robot=id_robot,
                                                     id_episode=e.id_episode))
            
            def add(url, nid, strict):
                r = rp.add_child_from_other(url, s + nid, strict=strict, ** key)
                f.sub(r, caption=nid)
        
            add('u/figure2/tw', 'u-tw', True)
            add('descent/figure2/tw', 'descent-tw', False)
        
    return rp.get_job()
def job_report_learn(context, combs):
    context = context.child('report_learn')
    rp = ReportProxy(context)
    for id_robot, id_agent in combs:
        context.needs(RM_AGENT_LEARN, id_robot=id_robot, id_agent=id_agent)
        
        f = rp.figure('%s-%s-model' % (id_robot, id_agent), cols=8,
                      caption='%s, %s' % (id_robot, id_agent))
        
        key = dict(report_type='agent_report', id_robot=id_robot, id_agent=id_agent)
        
        s = 'bds-%s-' % basename_from_key(dict(id_agent=id_agent, id_robot=id_robot))
        add = lambda n, nid: f.sub(rp.add_child_from_other(n, s + nid, **key), caption=nid)
        addif = lambda n, nid: f.sub(rp.add_child_from_other(n, s + nid, strict=False, **key), caption=nid)
        
        add('estimator/model/M/slices/0/normalized/png', 'M0')
        add('estimator/model/M/slices/1/normalized/png', 'M1')
        addif('estimator/model/M/slices/2/normalized/png', 'M2')
        add('estimator/model/N/slices/0/figure1/plot_scaled', 'N0')
        add('estimator/model/N/slices/1/figure1/plot_scaled', 'N1')
        addif('estimator/model/N/slices/2/figure1/plot_scaled', 'N2')
        
        f = rp.figure('%s-%s-learn' % (id_robot, id_agent), cols=8,
                      caption='%s, %s' % (id_robot, id_agent))
        
        add('estimator/tensors/T/slices/0/normalized/png', 'T0')
        add('estimator/tensors/T/slices/1/normalized/png', 'T1')
        addif('estimator/tensors/T/slices/2/normalized/png', 'T2')
        add('estimator/tensors/U/slices/0/figure1/plot_scaled', 'U0')
        add('estimator/tensors/U/slices/1/figure1/plot_scaled', 'U1')
        addif('estimator/tensors/U/slices/2/figure1/plot_scaled', 'U2')
                
        add('estimator/tensors/P/posneg', 'P')
        
    return rp.get_job()
Example #5
0
    def add_child_from_other(self, url, nid, report_type, strict=True, **report_args):
        part = self.get_part_of(url, report_type, strict=strict, **report_args)

        if nid is None:
            nid = basename_from_key(report_args) + "-" + url.replace("/", "-")  # XXX url chars

        self.add_child_with_id(part, nid)
        return nid
Example #6
0
 def add_child_from_other(self, url, nid, report_type, strict=True, **report_args):
     part = self.get_part_of(url, report_type, strict=strict, ** report_args)
     
     if nid is None:
         nid = basename_from_key(report_args) + '-' + url.replace('/', '-')  # XXX url chars
         
     self.add_child_with_id(part, nid)
     return nid
 def rp_simulation_tranche(c, id_robot, tranche):
     tranche_episodes = tranches[tranche]
     job_id = basename_from_key(dict(id_robot=id_robot, explorer=explorer, tranche=tranche))
     return c.comp_config(simulate_agent_robot,
                         data_central=data_central,
                          id_agent=explorer,
                          id_robot=id_robot,
                          max_episode_len=max_episode_len,
                          stateful=False,
                          interval_print=5,
                          num_episodes=len(tranche_episodes),
                          id_episodes=tranche_episodes,
                          cumulative=False,
                          write_extra=False,
                          job_id=job_id)    
def report_servo1_global(combs, explogs_test, parts):
    r = Report()
    figs = {}
    
    def get_fig(id_robot):
        if not id_robot in figs:
            figs[id_robot] = r.figure(cols=len(explogs_test), caption=id_robot)
        return figs[id_robot]
    
    for id_robot, id_agent in combs:
        for id_episode in map(str, explogs_test):
            key = dict(id_robot=id_robot, id_agent=id_agent, id_episode=id_episode)
            part = parts[key]
            part.nid = basename_from_key(key)
            part.caption = '%s, %s' % (id_robot, id_agent)
            r.add_child(part)
            get_fig(id_robot).sub(part)

    return r
Example #9
0
def bds_report(output_dir, report, agent, robot):
    prefix = basename_from_key(dict(id_agent=agent, id_robot=robot))
#     prefix = '%s-%s' % (agent, robot)
    filename = os.path.join(output_dir, prefix + '.tex')
    filename_doc = os.path.join(output_dir, prefix + '-single.tex')
    preamble = """
\usepackage{graphicx}
\usepackage{fullpage}
\usepackage{nopageno}
\usepackage{subfig}
\usepackage{etoolbox}
\input{tex/config-draft.tex}
% \input{tex/preamble_figures.tex}
\input{tex/preamble_label_trick.tex}

% \input{tex/preamble_fancy_formatting.tex}
\input{tex/preamble_symbols.tex}
% \input{tex/preamble_symbols_nuisances.tex}
\input{tex/preamble_symbols_calib.tex}
\input{tex/preamble_symbols_bds.tex}
% \input{tex/preamble_thesis_layout.tex}
\input{tex/preamble_biblio.tex}
\input{tex/preamble_nomenclature.tex}
% \input{tex/preamble_prettyref.tex}
\input{tex/preamble_algo.tex}
% \input{tex/preamble_firstmention.tex}
\input{tex/preamble_hyperref.tex}
\input{tex/preamble_drafttools.tex}
\input{tex/preamble_info.tex}
\input{tex/preamble_python.tex}

    """
    print('Writing to %s' % friendly_path(filename))
    prefix_paths = 'jbds-tables/'
    label_prefix = 'fig:%s-jlearn' % prefix
    with latex_fragment(filename, graphics_path=output_dir) as frag:
        jbds_bds_report(frag, report, prefix, label_prefix, agent, robot, prefix_paths=prefix_paths)
        
    with latex_document(filename_doc, graphics_path=output_dir, document_class='IEEEtran') as doc:
        doc.context.preamble.write(preamble)
        with doc.figure(label=label_prefix, placement="p", double=True) as fig:
            fig.input(os.path.basename(filename))
Example #10
0
 def get_part_of(self, url, report_type, strict=True, **report_args):
     job_id = "get_part-" + report_type + "-" + basename_from_key(report_args)
     r = self.context.get_report(report_type, **report_args)
     job_id += "-" + url.replace("/", "_")  # XXX
     part = self.context.comp(get_node, url=url, r=r, strict=strict, job_id=job_id)
     return part
Example #11
0
 def get_part_of(self, url, report_type, strict=True, **report_args):
     job_id = 'get_part-' + report_type + '-' + basename_from_key(report_args)
     r = self.context.get_report(report_type, **report_args)
     job_id += '-' + url.replace('/', '_')  # XXX
     part = self.context.comp(get_node, url=url, r=r, strict=strict, job_id=job_id)
     return part
Example #12
0
 def get_part_of(self, url, report_type, strict=True, **report_args):
     job_id = 'get_part-' + report_type + '-' + basename_from_key(report_args)
     r = self.context.get_report(report_type, **report_args)
     job_id += '-' + url.replace('/', '_')  # XXX
     part = self.context.comp(get_node, url=url, r=r, strict=strict, job_id=job_id)
     return part