def of_rktd(self, rktdfile):
     """ (-> Path-String Path-String)
         Input: a .rktd file; the results of running the benchmarks.
         Output: the string name of a newly-generated .tab file
                 (a more human-readable and Python-parse-able version of the .rktd)
     """
     # We have a Racket script to generate the .tab file,
     # make sure it exists.
     print("Parsing a .tab file from the raw source '%s'" % rktdfile)
     sexp_to_tab = shell.find_file("sexp-to-tab.rkt")
     if not sexp_to_tab:
         raise ValueError("Could not access 'sexp_to_tab' script. Cannot parse '%s'." % rktdfile)
     shell.execute("racket %s %s" % (sexp_to_tab, rktdfile))
     # Strip the suffix from the input file, replace with .tab
     return "%s.tab" % rktdfile.rsplit(".", 1)[0]
 def __init__(self, fname, *args, **kwargs):
     ### Find external scripts
     #self.setup_script = shell.find_file(self.setup_script)
     #if not self.setup_script:
     #    raise ValueError("Could not find setup script within current directory, goodbye.")
     self.run_script   = shell.find_file(self.run_script)
     if not self.run_script:
         raise ValueError("Could not find run script within current directory, goodbye.")
     ### Check assumptions
     self.check_directory_structure(fname)
     #self.setup_variations(fname)
     ### Setup fields
     self.project_name = fname
     self.graph        = ModuleGraph(fname)
     self.module_names = glob.glob("%s/untyped/*.rkt" % self.project_name)
     self.num_iters    = kwargs.get("num_iters", self.num_iters)
     self.sample_size  = kwargs.get("sample_size", self.sample_size)
     self.strategy     = constants.APPEND # or, recompute?
 def infer_graph(self, fname):
     """
         Try to find the .graph file associated with `fname`
     """
     prefix = util.strip_suffix(fname)
     gfile1 = "%s.graph" % prefix
     gfile2 = "%s.graph" % prefix.split("-", 1)[0]
     tag = prefix.rsplit("/", 1)[-1]
     gfile3 = "%s.graph" % tag
     gfile4 = "%s/%s.graph" % (tag, tag)
     if os.path.exists(gfile1):
         return gfile1
     elif os.path.exists(gfile2):
         return gfile2
     elif os.path.exists(gfile3):
         return gfile3
     elif os.path.exists(gfile4):
         return gfile4
     else: ## Last resort, try searching for the first result
         return shell.find_file(gfile3)