pyslha.py

changeset 199
80d4b063103a
parent 198
6a10f5f8a9b0
child 200
651b0fac2163
     1.1 --- a/pyslha.py	Sun Apr 28 19:31:53 2013 +0200
     1.2 +++ b/pyslha.py	Sun Apr 28 21:13:25 2013 +0200
     1.3 @@ -117,7 +117,7 @@
     1.4      def is_single_valued(self):
     1.5          """Return true if there is only one entry, and it has no index: the
     1.6          'value()' attribute may be used in that case without an argument."""
     1.7 -        return not( len(self.entries) == 1 and self.entries.keys[0] is None )
     1.8 +        return len(self.entries) == 1 and self.entries.keys()[0] is None
     1.9  
    1.10      def value(self, key=None):
    1.11          """Get a value from the block with the supplied key.
    1.12 @@ -820,7 +820,7 @@
    1.13              if len(d.ids) == 3:
    1.14                  # TODO: How to determine the conditions for using 200 and 300 MEs? Enumeration of affected decays?
    1.15                  pass
    1.16 -            decayout += "%d " + fmte + " %d " % (hwid, d.br, nme)
    1.17 +            decayout += ("%d " + fmte + " %d ") % (hwid, d.br, nme)
    1.18  
    1.19              def is_quark(pid):
    1.20                  return (abs(pid) in range(1, 7))
    1.21 @@ -867,11 +867,11 @@
    1.22                  if len(absids) == 2:
    1.23                      ## 2 body mode, to Higgs: Higgs; Bottom
    1.24                      if (25 in absids or 26 in absids) and 5 in absids:
    1.25 -                        d.ids = sorted(d.ids, key=cmp_bottomlast)
    1.26 +                        d.ids = sorted(d.ids, cmp=cmp_bottomlast)
    1.27                  elif len(absids) == 3:
    1.28                      ## 3 body mode, via charged Higgs/W: quarks or leptons from W/Higgs; Bottom
    1.29                      if 37 in absids or 23 in absids:
    1.30 -                        d.ids = sorted(d.ids, key=cmp_bottomlast)
    1.31 +                        d.ids = sorted(d.ids, cmp=cmp_bottomlast)
    1.32              ## Gluino
    1.33              elif abs(pid) == 1000021:
    1.34                  if len(absids) == 2:
    1.35 @@ -886,7 +886,7 @@
    1.36                              if b == 21:
    1.37                                  return True
    1.38                              return cmp(a, b)
    1.39 -                        d.ids = sorted(d.ids, key=cmp_gluonfirst)
    1.40 +                        d.ids = sorted(d.ids, cmp=cmp_gluonfirst)
    1.41                  elif len(absids) == 3:
    1.42                      ## 3-body modes, R-parity conserved: colour neutral; q or qbar
    1.43                      def cmp_quarkslast(a, b):
    1.44 @@ -896,7 +896,7 @@
    1.45                          if is_quark(b):
    1.46                              return False
    1.47                          return cmp(a, b)
    1.48 -                    d.ids = sorted(d.ids, key=cmp_quarkslast)
    1.49 +                    d.ids = sorted(d.ids, cmp=cmp_quarkslast)
    1.50              ## Squark/Slepton
    1.51              elif is_squark(pid) or is_slepton(pid):
    1.52                  def cmp_susy_quark_lepton(a, b):
    1.53 @@ -917,7 +917,7 @@
    1.54                  ##                 Baryon number violated               quark     quark
    1.55                  ## Slepton
    1.56                  ##   2 body modes: Lepton Number Violated               q or qbar
    1.57 -                d.ids = sorted(d.ids, key=cmp_bottomlast)
    1.58 +                d.ids = sorted(d.ids, cmp=cmp_bottomlast)
    1.59              ## Higgs
    1.60              elif pid in (25, 26):
    1.61                  # TODO: Includes SUSY Higgses?
    1.62 @@ -933,7 +933,7 @@
    1.63                          if is_quark(b):
    1.64                              return False
    1.65                          return cmp(a, b)
    1.66 -                    d.ids = sorted(d.ids, key=cmp_quarkslast)
    1.67 +                    d.ids = sorted(d.ids, cmp=cmp_quarkslast)
    1.68              elif is_gaugino(pid):
    1.69                  # TODO: Is there actually anything to do here?
    1.70                  ## Gaugino
    1.71 @@ -950,7 +950,7 @@
    1.72                          if is_quark(b):
    1.73                              return False
    1.74                          return cmp(a, b)
    1.75 -                    d.ids = sorted(d.ids, key=cmp_quarkslast)
    1.76 +                    d.ids = sorted(d.ids, cmp=cmp_quarkslast)
    1.77  
    1.78              # TODO: Gaugino/Gluino
    1.79              ##   3 body modes:  R-parity violating:   Particles in the same order as the R-parity violating superpotential
    1.80 @@ -966,25 +966,25 @@
    1.81  
    1.82      ## Now the SUSY parameters
    1.83      ## TANB, ALPHAH:
    1.84 -    out += (fmte + " " + fmte + "\n") % (blocks["MINPAR"].entries[3], blocks["ALPHA"].entries)
    1.85 +    out += (fmte + " " + fmte + "\n") % (blocks["MINPAR"].value(3), blocks["ALPHA"].value())
    1.86      ## Neutralino mixing matrix
    1.87      nmix = blocks["NMIX"].entries
    1.88      for i in xrange(1, 5):
    1.89 -        out += (fmte + " " + fmte + " " + fmte + " " + fmte + "\n") % (nmix[i][1], nmix[i][2], nmix[i][3], nmix[i][4])
    1.90 +        out += (fmte + " " + fmte + " " + fmte + " " + fmte + "\n") % (nmix[i,1], nmix[i,2], nmix[i,3], nmix[i,4])
    1.91      ## Chargino mixing matrices V and U
    1.92      vmix = blocks["VMIX"].entries
    1.93 -    out += (fmte + " " + fmte + " " + fmte + " " + fmte + "\n") % (vmix[1][1], vmix[1][2], vmix[2][1], vmix[2][2])
    1.94 +    out += (fmte + " " + fmte + " " + fmte + " " + fmte + "\n") % (vmix[1,1], vmix[1,2], vmix[2,1], vmix[2,2])
    1.95      umix = blocks["UMIX"].entries
    1.96 -    out += (fmte + " " + fmte + " " + fmte + " " + fmte + "\n") % (umix[1][1], umix[1][2], umix[2][1], umix[2][2])
    1.97 +    out += (fmte + " " + fmte + " " + fmte + " " + fmte + "\n") % (umix[1,1], umix[1,2], umix[2,1], umix[2,2])
    1.98      ## THETAT,THETAB,THETAL
    1.99      import math
   1.100 -    out += (fmte + " " + fmte + " " + fmte + " " + "\n") % (math.acos(blocks["STOPMIX"].entries[1][1]),
   1.101 -                                                            math.acos(blocks["SBOTMIX"].entries[1][1]),
   1.102 -                                                            math.acos(blocks["STAUMIX"].entries[1][1]))
   1.103 +    out += (fmte + " " + fmte + " " + fmte + " " + "\n") % (math.acos(blocks["STOPMIX"].entries[1,1]),
   1.104 +                                                            math.acos(blocks["SBOTMIX"].entries[1,1]),
   1.105 +                                                            math.acos(blocks["STAUMIX"].entries[1,1]))
   1.106      ## ATSS,ABSS,ALSS
   1.107 -    out += (fmte + " " + fmte + " " + fmte + " " + "\n") % (blocks["AU"].entries[3][3],
   1.108 -                                                            blocks["AD"].entries[3][3],
   1.109 -                                                            blocks["AE"].entries[3][3])
   1.110 +    out += (fmte + " " + fmte + " " + fmte + " " + "\n") % (blocks["AU"].entries[3,3],
   1.111 +                                                            blocks["AD"].entries[3,3],
   1.112 +                                                            blocks["AE"].entries[3,3])
   1.113      ## MUSS == sign(mu)
   1.114      out += "%f\n" % blocks["MINPAR"].entries[4]
   1.115  

mercurial