pyslha.py

changeset 185
6cae67cd3cc1
parent 183
5dcd3f1622be
child 188
e706e3b2a647
     1.1 --- a/pyslha.py	Fri Nov 16 13:20:36 2012 +0100
     1.2 +++ b/pyslha.py	Mon Apr 08 17:24:14 2013 +0200
     1.3 @@ -24,7 +24,7 @@
     1.4  """
     1.5  
     1.6  __author__ = "Andy Buckley <andy.buckley@cern.ch"
     1.7 -__version__ = "1.4.3"
     1.8 +__version__ = "1.4.4"
     1.9  
    1.10  
    1.11  def _autotype(var):
    1.12 @@ -206,11 +206,11 @@
    1.13              currentdecay = None
    1.14              blocks[blockname] = Block(blockname, q=qstr)
    1.15          elif line.upper().startswith("DECAY"):
    1.16 -            match = re.match(r"DECAY\s+(\d+)\s+([\d\.E+-]+).*", line.upper())
    1.17 +            match = re.match(r"DECAY\s+(-?\d+)\s+([\d\.E+-]+|NAN).*", line.upper())
    1.18              if not match:
    1.19                  continue
    1.20              pdgid = int(match.group(1))
    1.21 -            width = float(match.group(2))
    1.22 +            width = float(match.group(2)) if match.group(2) != "NAN" else None
    1.23              currentblock = "DECAY"
    1.24              currentdecay = pdgid
    1.25              decays[pdgid] = Particle(pdgid, width)
    1.26 @@ -228,10 +228,10 @@
    1.27                      else:
    1.28                          blocks[currentblock].add_entry(items)
    1.29                  else:
    1.30 -                    br = float(items[0])
    1.31 +                    br = float(items[0]) if items[0].upper() != "NAN" else None
    1.32                      nda = int(items[1])
    1.33                      ids = map(int, items[2:])
    1.34 -                    if br > 0.0 or not ignorenobr:
    1.35 +                    if br > 0.0 or not ignorenobr: # br == None is < 0
    1.36                          decays[currentdecay].add_decay(br, nda, ids)
    1.37  
    1.38      ## Try to populate Particle masses from the MASS block

mercurial