def camera_figures(report): output_pattern_conf = 'out/camera_figures/conf_{variant}.tex' output_pattern_rep = 'out/camera_figures/report_{variant}.tex' graphics_path = 'out/camera_figures/' summary = 'out/camera_figures/conf_summary.tex' with Latex.document(summary, document_class='ieeeconf', graphics_path=graphics_path) as doc: for variant_report in report.children: doc.input('conf_' + variant_report.id) summary = 'out/camera_figures/report_summary.tex' with Latex.document(summary, document_class='article', graphics_path=graphics_path) as doc: for variant_report in report.children: doc.input('report_' + variant_report.id) for variant_report in report.children: variant = variant_report.id frag_file = output_pattern_conf.format(variant=variant) write_variant(frag_file, variant_report, variant, graphics_path, conference=True) frag_file = output_pattern_rep.format(variant=variant) write_variant(frag_file, variant_report, variant, graphics_path, conference=False)
def create_latex_frag(frag_file, graphics_path, report, id, conference): if conference: w1 = "2cm" else: w1 = "5cm" with Latex.fragment(frag_file, graphics_path=graphics_path) as frag: with frag.figure(caption=makecmd(frag, id + 'demo'), label=makelabel(id + ':demo')) as fig: fig.hfill() with fig.subfigure(caption=makecmd(frag, 'mem_signal')) as sub: data = report.resolve_url('y/rgb') write_graphics(sub, data, w1) fig.hfill() with fig.subfigure(caption=makecmd(frag, 'mem_signal_dot')) as sub: data = report.resolve_url('y_dot/posneg') write_graphics(sub, data, w1) fig.hfill() if not conference: fig.parbreak() fig.hfill() with fig.subfigure(caption=makecmd(frag, 'mem_signal_dot_pred')) as sub: data = report.resolve_url('y_dot_pred/posneg') write_graphics(sub, data, w1) fig.hfill() with fig.subfigure(caption=makecmd(frag, 'mem_signal_detect')) as sub: data = report.resolve_url('prod/scale') write_graphics(sub, data, w1) fig.hfill()
def write_figures_for_paper_(frag_file, report, graphics_path, conference): if conference: w1 = "4cm" else: w1 = "5.5cm" with Latex.fragment(frag_file, graphics_path=graphics_path) as frag: with frag.figure(caption=makecmd(frag, 'LaserStatsCaption'), label=makelabel('LaserStats'), double=True) as fig: fig.hfill() with fig.subfigure(caption=makecmd(frag, 'report_y_mean')) as sub: data = report.resolve_url('report_y_mean') write_graphics(sub, data, w1, border=False) fig.hfill() with fig.subfigure(caption=makecmd(frag, 'report_y_var')) as sub: data = report.resolve_url('report_y_var') write_graphics(sub, data, w1, border=False) fig.hfill() if not conference: fig.parbreak() fig.hfill() with fig.subfigure(caption=makecmd(frag, 'report_gy_var')) as sub: data = report.resolve_url('report_gy_var') write_graphics(sub, data, w1, border=False) fig.hfill() with fig.subfigure(caption=makecmd(frag, 'report_y_dot_var')) as sub: data = report.resolve_url('report_y_dot_var') write_graphics(sub, data, w1, border=False) fig.hfill() with frag.figure(caption=makecmd(frag, 'LaserTensorsCaption'), label=makelabel('LaserTensors'), double=True) as fig: fig.hfill() with fig.subfigure(caption=makecmd(frag, 'report_Gv')) as sub: data = report.resolve_url('report_Gv') write_graphics(sub, data, w1, border=False) fig.hfill() with fig.subfigure(caption=makecmd(frag, 'report_Gomega')) as sub: data = report.resolve_url('report_Gomega') write_graphics(sub, data, w1, border=False) fig.hfill() if not conference: fig.parbreak() fig.hfill() with fig.subfigure(caption=makecmd(frag, 'report_Bv')) as sub: data = report.resolve_url('report_Bv') write_graphics(sub, data, w1, border=False) fig.hfill() with fig.subfigure(caption=makecmd(frag, 'report_Bomega')) as sub: data = report.resolve_url('report_Bomega') write_graphics(sub, data, w1, border=False) fig.hfill()
def write_figures_for_paper(report): output_conf = 'out/laser_bgds_boot/figures/conf.tex' output_rep = 'out/laser_bgds_boot/figures/report.tex' graphics_path = 'out/laser_bgds_boot/figures/' summary = 'out/laser_bgds_boot/figures/summary.tex' if not os.path.exists(graphics_path): os.makedirs(graphics_path) with Latex.document(summary, document_class='ieeeconf', graphics_path=graphics_path) as doc: doc.input('conf') write_figures_for_paper_(output_conf, report, graphics_path, True) write_figures_for_paper_(output_rep, report, graphics_path, False)
def write_variant(frag_file, variant_report, variant, graphics_path, conference): if conference: w1 = "4cm" else: w1 = "5.5cm" with Latex.fragment(frag_file, graphics_path=graphics_path) as frag: with frag.figure(caption=makecmd(frag, variant + 'StatsCaption'), label=makelabel(variant + ':Stats'), double=True) as fig: fig.hfill() with fig.subfigure(caption=makecmd(frag, 'y_mean')) as sub: data = variant_report.resolve_url('y_mean/scale') write_graphics(sub, data, w1) fig.hfill() with fig.subfigure(caption=makecmd(frag, 'y_var')) as sub: data = variant_report.resolve_url('y_var/scale') write_graphics(sub, data, w1) fig.hfill() if not conference: fig.parbreak() fig.hfill() with fig.subfigure(caption=makecmd(frag, 'y_dot_var')) as sub: data = variant_report.resolve_url('y_dot_var/scale') write_graphics(sub, data, w1) fig.hfill() with fig.subfigure(caption=makecmd(frag, 'gx_var')) as sub: data = variant_report.resolve_url('gx_var/scale') write_graphics(sub, data, w1) fig.hfill() # with fig.subfigure(caption=makecmd(frag, 'gy_var')) as sub: # data = variant_report.resolve_url('gy_var/scale') # write_graphics(sub, data, w1) # fig.hfill() # if not conference: with frag.figure(caption=makecmd(frag, variant + 'GCaption'), label=makelabel(variant + ':G'), double=True) as fig: fig.hfill() with fig.subfigure(caption=makecmd(frag, 'Gxl')) as sub: data = variant_report.resolve_url('Gxl/posneg') write_graphics(sub, data, w1) fig.hfill() with fig.subfigure(caption=makecmd(frag, 'Gyl')) as sub: data = variant_report.resolve_url('Gyl/posneg') write_graphics(sub, data, w1) fig.hfill() if not conference: fig.parbreak() fig.hfill() with fig.subfigure(caption=makecmd(frag, 'Gxa')) as sub: data = variant_report.resolve_url('Gxa/posneg') write_graphics(sub, data, w1) fig.hfill() with fig.subfigure(caption=makecmd(frag, 'Gya')) as sub: data = variant_report.resolve_url('Gya/posneg') write_graphics(sub, data, w1) fig.hfill() with frag.figure(caption=makecmd(frag, variant + 'GnormCaption'), label=makelabel(variant + ':Gnorm'), double=True) as fig: fig.hfill() with fig.subfigure(caption=makecmd(frag, 'Gxl_norm')) as sub: data = variant_report.resolve_url('Gxl_norm/posneg') write_graphics(sub, data, w1) fig.hfill() with fig.subfigure(caption=makecmd(frag, 'Gyl_norm')) as sub: data = variant_report.resolve_url('Gyl_norm/posneg') write_graphics(sub, data, w1) fig.hfill() if not conference: fig.parbreak() fig.hfill() with fig.subfigure(caption=makecmd(frag, 'Gxa_norm')) as sub: data = variant_report.resolve_url('Gxa_norm/posneg') write_graphics(sub, data, w1) fig.hfill() with fig.subfigure(caption=makecmd(frag, 'Gya_norm')) as sub: data = variant_report.resolve_url('Gya_norm/posneg') write_graphics(sub, data, w1) fig.hfill() print "ciaop"
def create_techreport_figures_sub(reports, directory, prefix, use_vehicles): if not os.path.exists(directory): os.makedirs(directory) # create dict vname -> report all_vehicles = dict([(report.id, report) for report in reports]) not_used = set(all_vehicles.keys()).difference(set(use_vehicles)) print "Vehicles not used: %s" % list(not_used) success_file = '%ssuccess.tex' % prefix tensors_file = '%stensors.tex' % prefix covariance_file = '%scovariance.tex' % prefix all_figures = os.path.join(directory, '%sall_figures.tex' % prefix) W = "1.7cm" interspace="2mm" padding="2.5mm" with Latex.document(all_figures, document_class='svmult') as doc: #doc.use_package('fullpage') #doc.input('vehicles_covariance') #doc.tex('\\clearpage') doc.input(tensors_file) doc.tex('\\clearpage') doc.input(success_file) vehicles_covariance = os.path.join(directory, covariance_file) with Latex.fragment(vehicles_covariance, graphics_path=directory) as frag: for vname in use_vehicles: report = all_vehicles[vname] icon = report.resolve_url('vehicle-icon/icon') covfig = report.resolve_url('covariance/posneg') corrfig = report.resolve_url('correlation/posneg') inffig = report.resolve_url('information/posneg') # TODO: add information label = "%s:covariance" % vname frag.pagebreak() with frag.figure(label=label, caption=latexify(vname)) as fig: fig.hfill() with fig.subfigure(caption="Robot") as sub: graphics(sub, icon, W,border=False) fig.hfill() with fig.subfigure(caption="Covariance matrix") as sub: graphics(sub, covfig, W) fig.hfill() with fig.subfigure(caption="Correlation matrix") as sub: graphics(sub, corrfig, W) with fig.subfigure(caption="Information matrix") as sub: graphics(sub, inffig, W) fig.hfill() learned_tensors = os.path.join(directory, tensors_file) with Latex.fragment(learned_tensors, graphics_path=directory) as frag: frag.tex( makeupcmd("Mcov") ) frag.tex( makeupcmd("Minf") ) frag.tex( makeupcmd("Txnat") ) frag.tex( makeupcmd("Tynat") ) frag.tex( makeupcmd("Tthetanat") ) frag.tex( makeupcmd("Txnorm") ) frag.tex( makeupcmd("Tynorm") ) frag.tex( makeupcmd("Tthetanorm") ) for vname in use_vehicles: report = all_vehicles[vname] icon = report.resolve_url('vehicle-icon/icon') covfig = report.resolve_url('covariance/posneg') inffig = report.resolve_url('information/posneg') Tx_nat = report.resolve_url('tensors-natural/tensors/Tx/posneg') Ty_nat = report.resolve_url('tensors-natural/tensors/Ty/posneg') Ttheta_nat = report.resolve_url('tensors-natural/tensors/Ttheta/posneg') Tx_norm = report.resolve_url('tensors-normalized/tensors/Tx/posneg') Ty_norm = report.resolve_url('tensors-normalized/tensors/Ty/posneg') Ttheta_norm = report.resolve_url('tensors-normalized/tensors/Ttheta/posneg') # TODO: add information captioncmd = "%sCAPTIONTENS" % safecmd(vname) frag.tex( makeupcmd(captioncmd) ) label = "%s:tensors" % vname with frag.figure(label=label, caption="\\%s"%captioncmd, placement="p") as fig: fig.hfill() with fig.subfigure(caption="Robot") as sub: graphics(sub, icon, W, border=False) fig.hfill() with fig.subfigure(caption="\\Txnat") as sub: sub.hspace(padding) graphics(sub, Tx_nat, W) sub.hspace(padding) fig.hspace(interspace) with fig.subfigure(caption="\\Tynat") as sub: sub.hspace(padding) graphics(sub, Ty_nat, W) sub.hspace(padding) fig.hspace(interspace) with fig.subfigure(caption="\\Tthetanat") as sub: sub.hspace(padding) graphics(sub, Ttheta_nat, W) sub.hspace(padding) # I don't know why it makes things uneven #fig.hspace(interspace) fig.parbreak() fig.hfill() fig.hspace("-4mm") with fig.subfigure(caption="\\Mcov") as sub: graphics(sub, covfig, W) fig.hspace(interspace) with fig.subfigure(caption="\\Minf") as sub: graphics(sub, inffig, W) fig.hfill() with fig.subfigure(caption="\\Txnorm") as sub: sub.hspace(padding) graphics(sub, Tx_norm, W) sub.hspace(padding) fig.hspace(interspace) with fig.subfigure(caption="\\Tynorm") as sub: sub.hspace(padding) graphics(sub, Ty_norm, W) sub.hspace(padding) fig.hspace(interspace) with fig.subfigure(caption="\\Tthetanorm") as sub: sub.hspace(padding) graphics(sub, Ttheta_norm, W) sub.hspace(padding) fig.hspace(interspace) success = os.path.join(directory, success_file) with Latex.fragment(success, graphics_path=directory) as frag: frag.tex( makeupcmd("sxynat") ) frag.tex( makeupcmd("sytnat") ) frag.tex( makeupcmd("sxtnat") ) frag.tex( makeupcmd("sxynorm") ) frag.tex( makeupcmd("sytnorm") ) frag.tex( makeupcmd("sxtnorm") ) frag.tex( makeupcmd("sucfigA") ) frag.tex( makeupcmd("sucfigB") ) frag.tex( makeupcmd("sucfigC") ) for i, vname in enumerate(use_vehicles): report = all_vehicles[vname] icon = report.resolve_url('vehicle-icon/icon') succ_xy_nat = report.resolve_url('fields-natural/success-x_y/success') succ_yt_nat = report.resolve_url('fields-natural/success-theta_y/success') succ_xt_nat = report.resolve_url('fields-natural/success-x_theta/success') succ_xy_norm = report.resolve_url('fields-normalized/success-x_y/success') succ_yt_norm = report.resolve_url('fields-normalized/success-theta_y/success') succ_xt_norm = report.resolve_url('fields-normalized/success-x_theta/success') # TODO: add information label = "%s:success" % vname captioncmd = "%sCAPTIONSUCC" % safecmd(vname) frag.tex( makeupcmd(captioncmd) ) label = "%s:success" % vname with frag.figure(label=label, caption="\\%s"%captioncmd, placement="p") as fig: fig.hfill() #with fig.subfigure(caption="Robot") as sub: graphics(fig, icon, W, border=False) fig.hfill() with fig.subfigure(caption="\\sxynat") as sub: sub.hspace(padding) graphics(sub, succ_xy_nat, W) sub.hspace(padding) fig.hspace(interspace) with fig.subfigure(caption="\\sytnat") as sub: sub.hspace(padding) graphics(sub, succ_yt_nat, W) sub.hspace(padding) fig.hspace(interspace) with fig.subfigure(caption="\\sxtnat") as sub: sub.hspace(padding) graphics(sub, succ_xt_nat, W) sub.hspace(padding) #fig.hspace(interspace) fig.parbreak() fig.hfill() letter = ['A','B','C'] fig.tex('\\sucfig%s' % letter[i % 3]) with fig.subfigure(caption="\\sxynorm") as sub: sub.hspace(padding) graphics(sub, succ_xy_norm, W) sub.hspace(padding) fig.hspace(interspace) with fig.subfigure(caption="\\sytnorm") as sub: sub.hspace(padding) graphics(sub, succ_yt_norm, W) sub.hspace(padding) fig.hspace(interspace) with fig.subfigure(caption="\\sxtnorm") as sub: sub.hspace(padding) graphics(sub, succ_xt_norm, W) sub.hspace(padding) fig.hspace(interspace)