pyslha.py: Fix handling of particles with NaN widths (and decay channels with NaN BRs). Both are filled into the blocks in readSLHA(File) now, with None as the value for the invalid width/BR: test for correctness with e.g. 'myparticle.width is not None'. BR == NaN decays will be added if the ignorenobr arg == False (the default). Thanks to Lukas Vanelderen for the report. pyslha-1.4.4

Mon, 08 Apr 2013 17:24:14 +0200

author
Andy Buckley <andy@insectnation.org>
date
Mon, 08 Apr 2013 17:24:14 +0200
changeset 185
6cae67cd3cc1
parent 184
edf68c5a75da
child 186
426cfd05e18d

pyslha.py: Fix handling of particles with NaN widths (and decay channels with NaN BRs). Both are filled into the blocks in readSLHA(File) now, with None as the value for the invalid width/BR: test for correctness with e.g. 'myparticle.width is not None'. BR == NaN decays will be added if the ignorenobr arg == False (the default). Thanks to Lukas Vanelderen for the report.

ChangeLog file | annotate | diff | comparison | revisions
pyslha.py file | annotate | diff | comparison | revisions
     1.1 --- a/ChangeLog	Fri Nov 16 13:20:36 2012 +0100
     1.2 +++ b/ChangeLog	Mon Apr 08 17:24:14 2013 +0200
     1.3 @@ -1,3 +1,14 @@
     1.4 +2013-04-08  Andy Buckley  <andy.buckley@cern.ch>
     1.5 +
     1.6 +	* Version 1.4.4
     1.7 +
     1.8 +	* pyslha.py: Fix handling of particles with NaN widths (and decay
     1.9 +	channels with NaN BRs). Both are filled into the blocks in
    1.10 +	readSLHA(File) now, with None as the value for the invalid
    1.11 +	width/BR: test for correctness with e.g. 'myparticle.width is not
    1.12 +	None'. BR == NaN decays will be added if the ignorenobr arg ==
    1.13 +	False (the default). Thanks to Lukas Vanelderen for the report.
    1.14 +
    1.15  2012-11-16  Andy Buckley  <andy.buckley@cern.ch>
    1.16  
    1.17  	* Version 1.4.2, 1.4.3
     2.1 --- a/pyslha.py	Fri Nov 16 13:20:36 2012 +0100
     2.2 +++ b/pyslha.py	Mon Apr 08 17:24:14 2013 +0200
     2.3 @@ -24,7 +24,7 @@
     2.4  """
     2.5  
     2.6  __author__ = "Andy Buckley <andy.buckley@cern.ch"
     2.7 -__version__ = "1.4.3"
     2.8 +__version__ = "1.4.4"
     2.9  
    2.10  
    2.11  def _autotype(var):
    2.12 @@ -206,11 +206,11 @@
    2.13              currentdecay = None
    2.14              blocks[blockname] = Block(blockname, q=qstr)
    2.15          elif line.upper().startswith("DECAY"):
    2.16 -            match = re.match(r"DECAY\s+(\d+)\s+([\d\.E+-]+).*", line.upper())
    2.17 +            match = re.match(r"DECAY\s+(-?\d+)\s+([\d\.E+-]+|NAN).*", line.upper())
    2.18              if not match:
    2.19                  continue
    2.20              pdgid = int(match.group(1))
    2.21 -            width = float(match.group(2))
    2.22 +            width = float(match.group(2)) if match.group(2) != "NAN" else None
    2.23              currentblock = "DECAY"
    2.24              currentdecay = pdgid
    2.25              decays[pdgid] = Particle(pdgid, width)
    2.26 @@ -228,10 +228,10 @@
    2.27                      else:
    2.28                          blocks[currentblock].add_entry(items)
    2.29                  else:
    2.30 -                    br = float(items[0])
    2.31 +                    br = float(items[0]) if items[0].upper() != "NAN" else None
    2.32                      nda = int(items[1])
    2.33                      ids = map(int, items[2:])
    2.34 -                    if br > 0.0 or not ignorenobr:
    2.35 +                    if br > 0.0 or not ignorenobr: # br == None is < 0
    2.36                          decays[currentdecay].add_decay(br, nda, ids)
    2.37  
    2.38      ## Try to populate Particle masses from the MASS block

mercurial