def render_ln(self, output_port, Nmax=None, Lvals=None, title=None):
     """
         Create and print L-N figures
         (for fixed L, how many configurations are L-close to an N-good,
          as N increases?)
     """
     Nmax = Nmax or self.Nmax
     Lvals = Lvals or self.Lvals
     figs = []
     yspace = np.linspace(0, self.num_configs, 6)
     yround = 0 if self.num_configs < 1000 else -2
     yticks = [int(yspace[0]),
               int(round(yspace[1], yround)),
               int(round(yspace[2], yround)),
               int(yspace[3]),
               int(round(yspace[4], yround)),
               int(yspace[5])]
     xposns = [1] + list(range(5, 1+Nmax, 5))
     xlbls  = ["%sx" % n for n in xposns]
     for L in Lvals:
         figs.append(plot.line([1, Nmax]
                              ,[lambda N_float: self.countLM_continuous(L, N_float)]
                              ,title=title # no title by default
                              ,xlabel="Overhead  (vs. untyped)"
                              ,ylabel="Count"
                               ,xticks=(xposns, xlbls)
                              ,yticks=(yticks, yticks)
                              ,samples=self.num_samples
                              ,output="%s/%s" % (self.output_dir, "%s%s" % (self.project_name.split("-", 1)[0], L))
                              ,hlines=[self.RED_HLINE]
                              ,vlines=[self.DELIVERABLE_VLINE, self.USABLE_VLINE]
                              ,ymax=self.num_configs))
     print(("\n%s" % latex.FIGSKIP).join([latex.figure(fg) for fg in figs]), file=output_port)
 def render_normalized(self, output_port, *labeled_preds):
     labels = [k for (k,_) in labeled_preds]
     preds  = [v for (_,v) in labeled_preds]
     title  = "%s-normalized.png" % self.project_name
     graph  = self.graph_normalized_runtimes(preds
                                            ,title
                                            ,xlabels=labels)
     print(latex.figure(graph), file=output_port)
 def render_absolute(self, output_port, *labeled_preds):
     labels = [k for (k,_) in labeled_preds]
     preds  = [v for (_,v) in labeled_preds]
     title = "%s-absolute.png" % self.project_name
     graph  = self.graph_absolute_runtimes(preds
                                          ,"Num. typed modules"
                                          ,labels
                                          ,title)
     print(latex.figure(graph), file=output_port)
 def render_all_paths(self, output_port, transitivity=[1]):
     print(latex.subsection("Sampling paths"), file=output_port)
     untyped_cfg = "0" * self.get_num_modules()
     for trans in transitivity:
         weights = [self.max_runtime_over_typed(config.random_walk(untyped_cfg, trans))
                    for _ in range(self.sample_size)]
         print(latex.figure(self.graph_histogram(weights
                            ,"%s-sample-paths-trans-%s.png" % (self.project_name, trans)
                            ,"Sampled Paths in a %s-trans lattice" % trans
                            ,"Max Overhead (runtime / typed runtime)")), file=output_port)
 def render_graphs(self, output_port, cfgs, baseline, title="Module Graphs"):
     print(latex.subsection(title), file=output_port)
     for cfg in cfgs:
         mean = self.stats_of_config(cfg)["mean"]
         diff, txt = latex.difference(mean, baseline)
         g = self.graph_config(
             cfg,
             title="Config %s: %s %s than baseline" % (cfg, diff, txt),
             output="%s-graph-%s.png" % (self.project_name, cfg),
         )
         print(latex.figure(g), file=output_port)
 def render_lnm(self, output_port, Nmax=None, Mmax=None, Lvals=None):
     """
         Create and print L-N/M figures
     """
     Nmax = Nmax or self.Nmax
     Mmax = Mmax or self.Mmax
     Lvals = Lvals or self.Lvals
     figs = []
     for L in Lvals:
         figs.append(plot3.contour([0, Nmax]
                              ,[0, Mmax]
                              ,self.countLNM_continuous(L)
                              # ,title="L=%s %s" % (L, "steps" if L==0 else "")
                              ,xlabel="\n\nN (overhead factor)"
                              ,ylabel="\n\nM (≥ N)"
                              ,zlabel="Count"
                              ,samples=self.num_samples
                              ,output="%s/%s" % (self.output_dir, "%s-lmn-%sstep" % (self.project_name, L))
                              ,zlim=self.num_configs))
     print("\n\\hfill{}".join([latex.figure(fg) for fg in figs]), file=output_port)