Set decay line width based on BR by default, contollable with new --decaystyle option

Tue, 30 Nov 2010 15:11:06 +0000

author
Andy Buckley <andy@insectnation.org>
date
Tue, 30 Nov 2010 15:11:06 +0000
changeset 96
6ad4a953db93
parent 95
63ae1d5bbe4e
child 97
f82d84b0002b

Set decay line width based on BR by default, contollable with new --decaystyle option

slhaplot file | annotate | diff | comparison | revisions
     1.1 --- a/slhaplot	Tue Nov 30 14:55:00 2010 +0000
     1.2 +++ b/slhaplot	Tue Nov 30 15:11:06 2010 +0000
     1.3 @@ -14,7 +14,6 @@
     1.4  images.
     1.5  
     1.6  TODOs:
     1.7 -  * Allow to set decay arrow color/thickness by branching ratio
     1.8    * Allow user control over aspect ratio
     1.9    * Use proper distinction between physical, plot-logical, and plot output coords
    1.10    * Drop make-plots support?
    1.11 @@ -128,8 +127,17 @@
    1.12  parser.add_option("--minbr", "--br", metavar="BR",
    1.13                    help="show decay lines for decays with a branching ratio of > BR (default: %default)",
    1.14                    dest="DECAYS_MINBR", type=float, default=1.0)
    1.15 +parser.add_option("--decaystyle", choices=["const", "brwidth"], metavar="STYLE",
    1.16 +                  help="drawing style of decay arrows, from const/brwidth. The 'const' style draws "
    1.17 +                  "all decay lines with the same width, 'brwidth' linearly scales the width of the "
    1.18 +                  "decay arrow according to the decay branching ratio. Other modes such as BR-dependent "
    1.19 +                  "colouring may be added later. (default: %default)",
    1.20 +                  dest="DECAYS_STYLE", default="brwidth")
    1.21  parser.add_option("--labels", choices=["none", "merge", "shift"], metavar="MODE",
    1.22 -                  help="treatment of labels for particle IDs, from none/merge/shift (default: %default)",
    1.23 +                  help="treatment of labels for particle IDs, from none/merge/shift. 'none' shows "
    1.24 +                  "no labels at all, 'merge' combines would-be-overlapping labels into a single "
    1.25 +                  "comma-separated list, and 'shift' vertically shifts the clashing labels to avoid "
    1.26 +                  "collisions (default: %default)",
    1.27                    dest="PARTICLES_LABELS", default="shift")
    1.28  
    1.29  
    1.30 @@ -440,9 +448,16 @@
    1.31          out += "\n  %% Decay arrows\n"
    1.32          for pidfrom, todict in sorted(DDETAILS.iteritems()):
    1.33              for pidto, dd in sorted(todict.iteritems()):
    1.34 -                out += "  %% decay_%d_%d\n" % (dd.pidfrom, dd.pidto)
    1.35 -                out += "  \\draw[-stealth,thick,dashed,color=%s] (%f,%f) -- (%f,%f);\n" % \
    1.36 -                    (dd.color, scalex(dd.xyfrom[0]), yscale*dd.xyfrom[1], scalex(dd.xyto[0]), yscale*dd.xyto[1])
    1.37 +                out += "  %% decay_%d_%d, BR=%0.1f%%\n" % (dd.pidfrom, dd.pidto, dd.br*100)
    1.38 +                def scalethickness(br):
    1.39 +                    if opts.DECAYS_STYLE == "const":
    1.40 +                        return 0.8
    1.41 +                    elif opts.DECAYS_STYLE == "brwidth":
    1.42 +                        return 1.0 * br
    1.43 +                    else:
    1.44 +                        raise Exception("Unexpected problem with unknown decay line style option: please contact the PySLHA author!")
    1.45 +                out += "  \\draw[-stealth,line width=%0.2fpt,dashed,color=%s] (%f,%f) -- (%f,%f);\n" % \
    1.46 +                    (scalethickness(dd.br), dd.color, scalex(dd.xyfrom[0]), yscale*dd.xyfrom[1], scalex(dd.xyto[0]), yscale*dd.xyto[1])
    1.47  
    1.48      ## Draw mass lines
    1.49      if PDETAILS:

mercurial