aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Garlick <pgarlick@tourbillion-technology.com>2019-10-01 12:34:38 +0100
committerPaul Garlick <pgarlick@tourbillion-technology.com>2019-10-01 12:34:38 +0100
commit956aaf8ad683c85fc723e73c54674c8108207c92 (patch)
tree2ae8be61220077d0e028d2177833ca680c1fdb38
parentda737763230728774c728b616990b4bd6cc2dc43 (diff)
downloadfullSWOF-utils-956aaf8ad683c85fc723e73c54674c8108207c92.tar.gz
use ast module to evaluate items read from boundary definition file.
-rw-r--r--boundaryDefinition.txt4
-rwxr-xr-xmakeBoundary.py3
2 files changed, 4 insertions, 3 deletions
diff --git a/boundaryDefinition.txt b/boundaryDefinition.txt
index 2c3a021..36c74d5 100644
--- a/boundaryDefinition.txt
+++ b/boundaryDefinition.txt
@@ -2,8 +2,8 @@
# Boundary Definition File
#
-# Boundary location (top, bottom, left, right):
-location: top
+# Boundary location ("top", "bottom", "left", "right"):
+location: "top"
# Local gradient:
slope: -0.003646
diff --git a/makeBoundary.py b/makeBoundary.py
index 1fc6b69..21b1113 100755
--- a/makeBoundary.py
+++ b/makeBoundary.py
@@ -3,6 +3,7 @@
import matplotlib.pyplot as plt
import numpy as np
import bisect
+import ast
def read_definition(filename):
ddict = {}
@@ -10,7 +11,7 @@ def read_definition(filename):
for line in f:
items = line.split(': ', 1)
if len(items) == 2:
- ddict[items[0]] = eval(items[1])
+ ddict[items[0]] = ast.literal_eval(items[1])
return ddict
# read boundary definition file.