[Rivet-svn] r3143 - in trunk: . bin doc

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Fri Jun 10 12:40:01 BST 2011


Author: buckley
Date: Fri Jun 10 12:40:01 2011
New Revision: 3143

Log:
Adding \physicsxcoor and \physicsycoor treatment to make-plots.

Modified:
   trunk/ChangeLog
   trunk/bin/make-plots
   trunk/doc/make-plots.txt

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	Fri Jun 10 11:14:09 2011	(r3142)
+++ trunk/ChangeLog	Fri Jun 10 12:40:01 2011	(r3143)
@@ -1,3 +1,7 @@
+2011-06-10  Andy Buckley  <andy at insectnation.org>
+
+	* Adding \physicsxcoor and \physicsycoor treatment to make-plots.
+
 2011-06-06  Hendrik Hoeth <hendrik.hoeth at cern.ch>
 
 	* Allow for negative cross-sections. NLO tools need this.

Modified: trunk/bin/make-plots
==============================================================================
--- trunk/bin/make-plots	Fri Jun 10 11:14:09 2011	(r3142)
+++ trunk/bin/make-plots	Fri Jun 10 12:40:01 2011	(r3143)
@@ -929,14 +929,17 @@
         out = ""
         out += ('\n%\n% Special\n%\n')
         for i in range(len(self.data)):
-            if self.data[i].count('\\physicscoor'):
-                line = self.data[i].split('\\physicscoor')
-                self.data[i] = line[0]
-                for j in range(1,len(line)):
-                    coor = line[j].split(')')[0].lstrip(' (').split(',')
-                    self.data[i] +=   '(' + coors.strphys2frameX(float(coor[0])) \
-                                    + ',' + coors.strphys2frameY(float(coor[1])) \
-                                    + ')' + line[j].split(')',1)[1]
+            import re
+            regex = re.compile(r'^(.*?)(\\physics[xy]?coor)\(([^,]+),([^,]+)\)(.*)')
+            while regex.search(self.data[i]):
+                match = regex.search(self.data[i])
+                xcoor, ycoor = float(match.group(3)), float(match.group(4))
+                if match.group(2) in ["physicscoor", "physicsxcoor"]:
+                    xcoor = coors.strphys2frameX(xcoor)
+                if match.group(2) in ["physicscoor", "physicsycoor"]:
+                    ycoor = coors.strphys2frameY(ycoor)
+                line = "%s(%1.2e,%1.2e)%s" % (match.group(1), xcoor, ycoor, match.group(5))
+                self.data[i] = line
             out += self.data[i]+'\n'
         return out
 
@@ -1584,7 +1587,7 @@
             top = inputdata.description['TopMargin']+0.1
             bottom = inputdata.description['BottomMargin']+0.1
 
-            # 
+            #
             out += ('\\rput(0,1){\\psline[linewidth=%scm,linecolor=%s](%scm,%scm)(%scm,%scm)}' %(top, color, -left, top/2, width+right, top/2))
             out += ('\\rput(0,%scm){\\psline[linewidth=%scm,linecolor=%s](%scm,%scm)(%scm,%scm)}' %(height[1], bottom, color, -left, -bottom/2, width+right, -bottom/2))
             out += ('\\rput(0,0){\\psline[linewidth=%scm,linecolor=%s](%scm,%scm)(%scm,%scm)}' %(left, color, -left/2, height[1]-0.05, -left/2, height[0]+0.05))

Modified: trunk/doc/make-plots.txt
==============================================================================
--- trunk/doc/make-plots.txt	Fri Jun 10 11:14:09 2011	(r3142)
+++ trunk/doc/make-plots.txt	Fri Jun 10 12:40:01 2011	(r3143)
@@ -339,7 +339,7 @@
 2-dimensional plots. The syntax is the same as for the `\definecolorseries`
 command in the `xcolor` LaTeX package after the color series name, i.e.
 `{core-model}{method}[begin-model]{begin-spec}[end-model]{end-spec}`. For more
-information you can consult the 
+information you can consult the
 http://www.ctan.org/tex-archive/macros/latex/contrib/xcolor/xcolor.pdf[xcolor documentation].
 Here is an example:
 
@@ -505,7 +505,7 @@
 --------------------
 The size of the markers. With `DotSize` you can specify the absolute size, e.g.
 in units of `pt`, while `DotScale` is a relative measure with respect to the
-default size. 
+default size.
 
 
 Normalization, Rebinning
@@ -592,7 +592,8 @@
 `\physicscoor` command in front of a coordinate pair, these coordinates are
 interpreted not in the pstricks coordinate system, but in the physics
 coordinate system of the plot, which is useful e.g. for marking cut values in a
-plot.
+plot. Similar `\physicsxcoor` and `\physicsycoor` commands exist which will only
+treat the x or y coordinate respectively as being in physics units.
 
 Hint: If you want to clip your `SPECIAL` code to the plot area, you can use
 --------------------


More information about the Rivet-svn mailing list