Commit a2e40720 authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Merge branch 'develop-GA' of gitlab.aei.uni-hannover.de:GregAshton/PyFstat into develop-GA

parents d5ca13d8 4a00f518
...@@ -120,10 +120,14 @@ def _get_dictionary_from_lines(lines, comments, raise_error): ...@@ -120,10 +120,14 @@ def _get_dictionary_from_lines(lines, comments, raise_error):
try: try:
key, val = line.rstrip('\n').split('=') key, val = line.rstrip('\n').split('=')
key = key.strip() key = key.strip()
try: val = val.strip()
d[key] = np.float64(eval(val.rstrip('; '))) if (val[0] in ["'", '"']) and (val[-1] in ["'", '"']):
except NameError: d[key] = val.lstrip('"').lstrip("'").rstrip('"').rstrip("'")
d[key] = val.rstrip('; ') else:
try:
d[key] = np.float64(eval(val.rstrip('; ')))
except NameError:
d[key] = val.rstrip('; ')
except SyntaxError: except SyntaxError:
if raise_error: if raise_error:
raise IOError('Line {} not understood'.format(line)) raise IOError('Line {} not understood'.format(line))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment