[HepData-svn] r1413 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Fri Oct 15 12:13:28 BST 2010


Author: whalley
Date: Fri Oct 15 12:13:27 2010
New Revision: 1413

Log:
adding more framework to jhepwork output

Modified:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/JhepworkFormatter.java

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/JhepworkFormatter.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/JhepworkFormatter.java	Fri Oct 15 12:12:38 2010	(r1412)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/JhepworkFormatter.java	Fri Oct 15 12:13:27 2010	(r1413)
@@ -80,11 +80,37 @@
             path.setAttribute("did", d.getId());
             path.setAttribute("xid", x.getId());
             path.setAttribute("yid", y.getId());
-//            s.append("Path: "  + path.toString() + "\n");
+            String ref = "";
+            if( d.getPaper().getFirstPublished() != null) {
+                ref = d.getPaper().getFirstPublished();
+            } 
+            else if (d.getPaper().getFirstPreprint() != null) {
+                ref = d.getPaper().getFirstPreprint();
+            } 
+            else if (d.getPaper().getArchive() != null) {
+                ref = d.getPaper().getArchive();
+            }
+            else{
+                ref = "no reference";
+            }
+            String tfp = "";
+            for ( String comment : d.getComments()){
+                if(comment.startsWith("Location:")){
+                    tfp = comment;
+                }
+            }
+            s.append("from jhplot import *\n");
+            s.append("c1 = HPlot('HepData')\n");
+            
+            s.append("c1.setGTitle('" + ref + "," + tfp.substring(9) + "')\n");
+            s.append("c1.visible(1) # can be set to visible(0) to generate figure only without pop-up window\n");
+            s.append("c1.setAutoRange()\n");
+            s.append("c1.setNameX('" + x.getHeader() + "')\n");
+            s.append("c1.setNameY('" + y.getHeader() + "')\n");
             s.append("p1=P1D('" + path.toString() + "')" + "\n");
             for (int r = 1; r <= d.getMaxPointId(); ++r) {
                 StringTemplate row = new StringTemplate();
-                String  template = "p1.add($xfocus$,$yval$,$xup$,$xdn$,$statup$,$statdn$,$xup$,$xdn$,$systup$,$systdn$);";
+                String  template = "p1.add($xfocus$,$yval$,$xup$,$xdn$,$statup$,$statdn$,0.0,0.0,$systup$,$systdn$)";
                 Bin b = x.getBin(r);
                 Point p = y.getPoint(r);
                 if (b != null && p != null) {
@@ -152,8 +178,11 @@
                 }
                 s.append("\n");
             }
-
-
+            s.append("# draw and export\n");
+            s.append("p1.setErrAll(1) # show all errors\n");
+            s.append("c1.draw(p1)\n");
+            s.append("c1.export('jhepwork.eps')\n");
+   
 
             out = s.toString();
         }


More information about the HepData-svn mailing list