Changeset 1892 for trunk/GSASIIIO.py


Ignore:
Timestamp:
Jun 17, 2015 9:49:43 AM (6 years ago)
Author:
toby
Message:

treat mis-aligned numbers as zero

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r1863 r1892  
    4848
    4949def sfloat(S):
    50     'Convert a string to float. An empty field is treated as zero'
     50    'Convert a string to float. An empty field or a unconvertable value is treated as zero'
    5151    if S.strip():
    52         return float(S)
    53     else:
    54         return 0.0
     52        try:
     53            return float(S)
     54        except ValueError:
     55            pass
     56    return 0.0
    5557
    5658def sint(S):
Note: See TracChangeset for help on using the changeset viewer.