[Rivet-svn] r4260 - trunk/doc

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Wed Apr 24 13:10:34 BST 2013


Author: dgrell
Date: Wed Apr 24 13:10:34 2013
New Revision: 4260

Log:
Wrap "import yoda" in a try block

Modified:
   trunk/doc/mk-analysis-latex

Modified: trunk/doc/mk-analysis-latex
==============================================================================
--- trunk/doc/mk-analysis-latex	Wed Apr 24 12:38:56 2013	(r4259)
+++ trunk/doc/mk-analysis-latex	Wed Apr 24 13:10:34 2013	(r4260)
@@ -158,30 +158,32 @@
         page += "\n\\noindent " + niceify(para) + "\n"
 
 
-    # try:
-    anarefpath = os.path.join("..", "data", "refdata", ana.name()+".yoda")
-    hpaths = None
-    if os.path.exists(anarefpath):
+# If we can see yoda, include histogram lists
+    try:
         import yoda
-        aos = yoda.readYODA(anarefpath)
-        hpaths = [ao.path for ao in aos]
-    paths_titles = {}
-    if hpaths:
-        pp = rivet.PlotParser([os.path.join("..", "data", "plotinfo")])
-        for hp in hpaths:
-            attrs = pp.getHeaders(hp)
-            if attrs.has_key("Title"):
-                paths_titles[hp] = attrs["Title"]
-    if paths_titles:
-        page += "\n\\vspace{1em}\n\\noindent\n"
-        page += "\\textbf{Histograms (%d):}\n \\penalty 100\n" % len(paths_titles)
-        page += "\\begin{itemize}\n"
-        for hpath, htitle in sorted(paths_titles.iteritems()):
-            page += "  \\item %s ({\\smaller \\kbd{%s}})\n" % (htitle, hpath.replace(r"_", r"\_"))
-            # TODO: Truncate with a \dots after N ~ 50 or so?
-        page += "\\end{itemize}\n"
-    # except:
-    #     pass
+    except:
+        pass
+    else:
+        anarefpath = os.path.join("..", "data", "refdata", ana.name()+".yoda")
+        hpaths = None
+        if os.path.exists(anarefpath):
+            aos = yoda.readYODA(anarefpath)
+            hpaths = [ao.path for ao in aos]
+        paths_titles = {}
+        if hpaths:
+            pp = rivet.PlotParser([os.path.join("..", "data", "plotinfo")])
+            for hp in hpaths:
+                attrs = pp.getHeaders(hp)
+                if attrs.has_key("Title"):
+                    paths_titles[hp] = attrs["Title"]
+        if paths_titles:
+            page += "\n\\vspace{1em}\n\\noindent\n"
+            page += "\\textbf{Histograms (%d):}\n \\penalty 100\n" % len(paths_titles)
+            page += "\\begin{itemize}\n"
+            for hpath, htitle in sorted(paths_titles.iteritems()):
+                page += "  \\item %s ({\\smaller \\kbd{%s}})\n" % (htitle, hpath.replace(r"_", r"\_"))
+                # TODO: Truncate with a \dots after N ~ 50 or so?
+            page += "\\end{itemize}\n"
 
     page += "\n\\clearpage\n"
 


More information about the Rivet-svn mailing list