Various fixes to ISAWIG output (and conversion to use new tuple-indexing on mixing matrices and single-value accessing on ALPHA).

Sun, 28 Apr 2013 21:13:25 +0200

author
Andy Buckley <andy@insectnation.org>
date
Sun, 28 Apr 2013 21:13:25 +0200
changeset 199
80d4b063103a
parent 198
6a10f5f8a9b0
child 200
651b0fac2163

Various fixes to ISAWIG output (and conversion to use new tuple-indexing on mixing matrices and single-value accessing on ALPHA).

ChangeLog file | annotate | diff | comparison | revisions
pyslha.py file | annotate | diff | comparison | revisions
     1.1 --- a/ChangeLog	Sun Apr 28 19:31:53 2013 +0200
     1.2 +++ b/ChangeLog	Sun Apr 28 21:13:25 2013 +0200
     1.3 @@ -1,10 +1,21 @@
     1.4 +2013-04-28  Andy Buckley  <andy.buckley@cern.ch>
     1.5 +
     1.6 +	* Various fixes to ISAWIG output (and conversion to use new
     1.7 +	tuple-indexing on mixing matrices and single-value accessing on
     1.8 +	ALPHA).
     1.9 +
    1.10 +	* Improved API for access to entries/values and single/multi-value
    1.11 +	state on Block.
    1.12 +
    1.13  2013-04-26  Andy Buckley  <andy.buckley@cern.ch>
    1.14  
    1.15  	* Improved SLHA output formatting.
    1.16  
    1.17 -	* Adding direct entry access via the [] operator to the Block class's entries.
    1.18 +	* Adding direct entry access via the [] operator to the Block
    1.19 +	class's entries.
    1.20  
    1.21 -	* Converting entries storage to avoid recursion, by using tuples as dict keys if necessary.
    1.22 +	* Converting entries storage to avoid recursion, by using tuples
    1.23 +	as dict keys if necessary.
    1.24  
    1.25  	* Version 1.5.0, since the behaviour has significantly altered.
    1.26  
     2.1 --- a/pyslha.py	Sun Apr 28 19:31:53 2013 +0200
     2.2 +++ b/pyslha.py	Sun Apr 28 21:13:25 2013 +0200
     2.3 @@ -117,7 +117,7 @@
     2.4      def is_single_valued(self):
     2.5          """Return true if there is only one entry, and it has no index: the
     2.6          'value()' attribute may be used in that case without an argument."""
     2.7 -        return not( len(self.entries) == 1 and self.entries.keys[0] is None )
     2.8 +        return len(self.entries) == 1 and self.entries.keys()[0] is None
     2.9  
    2.10      def value(self, key=None):
    2.11          """Get a value from the block with the supplied key.
    2.12 @@ -820,7 +820,7 @@
    2.13              if len(d.ids) == 3:
    2.14                  # TODO: How to determine the conditions for using 200 and 300 MEs? Enumeration of affected decays?
    2.15                  pass
    2.16 -            decayout += "%d " + fmte + " %d " % (hwid, d.br, nme)
    2.17 +            decayout += ("%d " + fmte + " %d ") % (hwid, d.br, nme)
    2.18  
    2.19              def is_quark(pid):
    2.20                  return (abs(pid) in range(1, 7))
    2.21 @@ -867,11 +867,11 @@
    2.22                  if len(absids) == 2:
    2.23                      ## 2 body mode, to Higgs: Higgs; Bottom
    2.24                      if (25 in absids or 26 in absids) and 5 in absids:
    2.25 -                        d.ids = sorted(d.ids, key=cmp_bottomlast)
    2.26 +                        d.ids = sorted(d.ids, cmp=cmp_bottomlast)
    2.27                  elif len(absids) == 3:
    2.28                      ## 3 body mode, via charged Higgs/W: quarks or leptons from W/Higgs; Bottom
    2.29                      if 37 in absids or 23 in absids:
    2.30 -                        d.ids = sorted(d.ids, key=cmp_bottomlast)
    2.31 +                        d.ids = sorted(d.ids, cmp=cmp_bottomlast)
    2.32              ## Gluino
    2.33              elif abs(pid) == 1000021:
    2.34                  if len(absids) == 2:
    2.35 @@ -886,7 +886,7 @@
    2.36                              if b == 21:
    2.37                                  return True
    2.38                              return cmp(a, b)
    2.39 -                        d.ids = sorted(d.ids, key=cmp_gluonfirst)
    2.40 +                        d.ids = sorted(d.ids, cmp=cmp_gluonfirst)
    2.41                  elif len(absids) == 3:
    2.42                      ## 3-body modes, R-parity conserved: colour neutral; q or qbar
    2.43                      def cmp_quarkslast(a, b):
    2.44 @@ -896,7 +896,7 @@
    2.45                          if is_quark(b):
    2.46                              return False
    2.47                          return cmp(a, b)
    2.48 -                    d.ids = sorted(d.ids, key=cmp_quarkslast)
    2.49 +                    d.ids = sorted(d.ids, cmp=cmp_quarkslast)
    2.50              ## Squark/Slepton
    2.51              elif is_squark(pid) or is_slepton(pid):
    2.52                  def cmp_susy_quark_lepton(a, b):
    2.53 @@ -917,7 +917,7 @@
    2.54                  ##                 Baryon number violated               quark     quark
    2.55                  ## Slepton
    2.56                  ##   2 body modes: Lepton Number Violated               q or qbar
    2.57 -                d.ids = sorted(d.ids, key=cmp_bottomlast)
    2.58 +                d.ids = sorted(d.ids, cmp=cmp_bottomlast)
    2.59              ## Higgs
    2.60              elif pid in (25, 26):
    2.61                  # TODO: Includes SUSY Higgses?
    2.62 @@ -933,7 +933,7 @@
    2.63                          if is_quark(b):
    2.64                              return False
    2.65                          return cmp(a, b)
    2.66 -                    d.ids = sorted(d.ids, key=cmp_quarkslast)
    2.67 +                    d.ids = sorted(d.ids, cmp=cmp_quarkslast)
    2.68              elif is_gaugino(pid):
    2.69                  # TODO: Is there actually anything to do here?
    2.70                  ## Gaugino
    2.71 @@ -950,7 +950,7 @@
    2.72                          if is_quark(b):
    2.73                              return False
    2.74                          return cmp(a, b)
    2.75 -                    d.ids = sorted(d.ids, key=cmp_quarkslast)
    2.76 +                    d.ids = sorted(d.ids, cmp=cmp_quarkslast)
    2.77  
    2.78              # TODO: Gaugino/Gluino
    2.79              ##   3 body modes:  R-parity violating:   Particles in the same order as the R-parity violating superpotential
    2.80 @@ -966,25 +966,25 @@
    2.81  
    2.82      ## Now the SUSY parameters
    2.83      ## TANB, ALPHAH:
    2.84 -    out += (fmte + " " + fmte + "\n") % (blocks["MINPAR"].entries[3], blocks["ALPHA"].entries)
    2.85 +    out += (fmte + " " + fmte + "\n") % (blocks["MINPAR"].value(3), blocks["ALPHA"].value())
    2.86      ## Neutralino mixing matrix
    2.87      nmix = blocks["NMIX"].entries
    2.88      for i in xrange(1, 5):
    2.89 -        out += (fmte + " " + fmte + " " + fmte + " " + fmte + "\n") % (nmix[i][1], nmix[i][2], nmix[i][3], nmix[i][4])
    2.90 +        out += (fmte + " " + fmte + " " + fmte + " " + fmte + "\n") % (nmix[i,1], nmix[i,2], nmix[i,3], nmix[i,4])
    2.91      ## Chargino mixing matrices V and U
    2.92      vmix = blocks["VMIX"].entries
    2.93 -    out += (fmte + " " + fmte + " " + fmte + " " + fmte + "\n") % (vmix[1][1], vmix[1][2], vmix[2][1], vmix[2][2])
    2.94 +    out += (fmte + " " + fmte + " " + fmte + " " + fmte + "\n") % (vmix[1,1], vmix[1,2], vmix[2,1], vmix[2,2])
    2.95      umix = blocks["UMIX"].entries
    2.96 -    out += (fmte + " " + fmte + " " + fmte + " " + fmte + "\n") % (umix[1][1], umix[1][2], umix[2][1], umix[2][2])
    2.97 +    out += (fmte + " " + fmte + " " + fmte + " " + fmte + "\n") % (umix[1,1], umix[1,2], umix[2,1], umix[2,2])
    2.98      ## THETAT,THETAB,THETAL
    2.99      import math
   2.100 -    out += (fmte + " " + fmte + " " + fmte + " " + "\n") % (math.acos(blocks["STOPMIX"].entries[1][1]),
   2.101 -                                                            math.acos(blocks["SBOTMIX"].entries[1][1]),
   2.102 -                                                            math.acos(blocks["STAUMIX"].entries[1][1]))
   2.103 +    out += (fmte + " " + fmte + " " + fmte + " " + "\n") % (math.acos(blocks["STOPMIX"].entries[1,1]),
   2.104 +                                                            math.acos(blocks["SBOTMIX"].entries[1,1]),
   2.105 +                                                            math.acos(blocks["STAUMIX"].entries[1,1]))
   2.106      ## ATSS,ABSS,ALSS
   2.107 -    out += (fmte + " " + fmte + " " + fmte + " " + "\n") % (blocks["AU"].entries[3][3],
   2.108 -                                                            blocks["AD"].entries[3][3],
   2.109 -                                                            blocks["AE"].entries[3][3])
   2.110 +    out += (fmte + " " + fmte + " " + fmte + " " + "\n") % (blocks["AU"].entries[3,3],
   2.111 +                                                            blocks["AD"].entries[3,3],
   2.112 +                                                            blocks["AE"].entries[3,3])
   2.113      ## MUSS == sign(mu)
   2.114      out += "%f\n" % blocks["MINPAR"].entries[4]
   2.115  

mercurial