Skip to content

Commit

Permalink
1121 updated dakota_interface
Browse files Browse the repository at this point in the history
  • Loading branch information
tian50 committed Nov 22, 2020
1 parent 0a6901a commit 5d61c04
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions dakota_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,21 @@ def interface(fn_json_args):
# Calculate actual responses
for k, v in interface_args['post_process'].items():
# print('')
# print('label:', v[0])
bp = ms.getBeamProperty(v[0])
# print('bp:', bp)
if v[1] == 'self':
r = bp
elif v[1] == 'abs_rel_diff':
r = np.abs((bp - v[2]) / v[2])
else:
r = eval('dpf.{0}'.format(v[1]))(bp, v[2])
# print('v[0]:', v[0])
# print(type(v[0]).__name__)
if type(v[0]).__name__ == 'str' or type(v[0]).__name__ == 'unicode':
bp = ms.getBeamProperty(v[0])
# print('bp:', bp)
if v[1] == 'self':
r = bp
elif v[1] == 'abs_rel_diff':
r = np.abs((bp - v[2]) / v[2])
else:
r = eval('dpf.{0}'.format(v[1]))(bp, v[2])
elif type(v[0]).__name__ == 'list':
bps = [ms.getBeamProperty(s) for s in v[0]]
r = eval('dpf.{0}'.format(v[1]))(bps, v[2])

results[k].function = r


Expand Down

0 comments on commit 5d61c04

Please sign in to comment.