From eb20e7fe64c40182d68676b7f7b731fca22385a3 Mon Sep 17 00:00:00 2001 From: Paul Garlick Date: Mon, 30 Sep 2019 18:04:55 +0100 Subject: add function to read definition file. --- makeBoundary.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/makeBoundary.py b/makeBoundary.py index e3d30cb..e1ca2de 100755 --- a/makeBoundary.py +++ b/makeBoundary.py @@ -4,6 +4,19 @@ import matplotlib.pyplot as plt import numpy as np import bisect +def read_definition(filename): + ddict = {} + with open(filename, "r") as f: + for line in f: + items = line.split(': ', 1) + if len(items) == 2: + ddict[items[0]] = eval(items[1]) + return ddict + +definition_dict = read_definition('boundaryDefinition.txt') +for dd in definition_dict: + print(definition_dict[dd]) + with open('./1D_top.txt', "r") as data: xch, ych, zch = np.loadtxt(data, delimiter=' ', unpack=True) -- cgit