From 84963ae8c165fe7ff76406ca7fe24a4fa6328657 Mon Sep 17 00:00:00 2001 From: "Joshua E. Jodesty" Date: Thu, 8 Nov 2018 16:14:25 -0500 Subject: [PATCH] save problems with pycharm --- engine/configProcessor.py | 2 +- engine/mechanismExecutor.py | 7 ++----- engine/run.py | 2 +- ui/config.py | 20 ++++++++++---------- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/engine/configProcessor.py b/engine/configProcessor.py index 71f0048..c528298 100644 --- a/engine/configProcessor.py +++ b/engine/configProcessor.py @@ -62,6 +62,6 @@ def create_tensor_field(mechanisms, exo_proc, keys=['behaviors', 'states']): dfs = [ create_matrix_field(mechanisms, k) for k in keys ] df = pd.concat(dfs, axis=1) for es, i in zip(exo_proc, range(len(exo_proc))): - df['es'+str(i)] = es + df['es'+str(i+1)] = es df['m'] = df.index + 1 return df \ No newline at end of file diff --git a/engine/mechanismExecutor.py b/engine/mechanismExecutor.py index 5ceccf7..b275567 100644 --- a/engine/mechanismExecutor.py +++ b/engine/mechanismExecutor.py @@ -27,17 +27,14 @@ def mech_step(m_step, sL, state_funcs, behavior_funcs, env_processes, t_step): last_in_obj = sL[-1] _input = exception_handler(getBehaviorInput, m_step, sL, last_in_obj, behavior_funcs) - # del last_in_obj last_in_copy = dict([ exception_handler(f, m_step, sL, last_in_obj, _input) for f in state_funcs ]) - # print(str(m_step) + ': ' + str(last_in_copy)) + del last_in_obj # print(str(m_step) + ': ' + str(last_in_copy)) - # mutating last_in_copy - apply_env_proc(env_processes, last_in_copy, last_in_copy['timestamp']) + apply_env_proc(env_processes, last_in_copy, last_in_copy['timestamp']) # mutating last_in_copy last_in_copy["mech_step"], last_in_copy["time_step"] = m_step, t_step sL.append(last_in_copy) - del last_in_copy return sL diff --git a/engine/run.py b/engine/run.py index 8a019bc..25e26d4 100644 --- a/engine/run.py +++ b/engine/run.py @@ -23,7 +23,7 @@ def main(): # Dimensions: N x r x mechs s = simulation(states_list, configs, env_processes, T, N) result = pd.DataFrame(flatten(s)) - print('Test') + # print('Test') # print(tabulate(result, headers='keys', tablefmt='psql')) # remove print and tabulate functions, so it returns a dataframe return result \ No newline at end of file diff --git a/ui/config.py b/ui/config.py index a21e126..d6a37c7 100644 --- a/ui/config.py +++ b/ui/config.py @@ -114,32 +114,32 @@ behavior_ops = [foldr(_ + _), lambda x: x + 0] mechanisms = { "m1": { "behaviors": { - "b1": b1m1, # lambda step, sL, s: s['s1'] + 1, - "b2": b2m1 + # "b1": b1m1, # lambda step, sL, s: s['s1'] + 1, + # "b2": b2m1 }, "states": { # exclude only. TypeError: reduce() of empty sequence with no initial value "s1": s1m1, - "s2": s2m1 + # "s2": s2m1 } }, "m2": { "behaviors": { "b1": b1m2, - "b2": b2m2 + # "b2": b2m2 }, "states": { - "s1": s1m2, - "s2": s2m2 + # "s1": s1m2, + # "s2": s2m2 } }, "m3": { "behaviors": { - "b1": b1m3, - "b2": b2m3 #toggle for error + # "b1": b1m3, + # "b2": b2m3 #toggle for error }, "states": { - "s1": s1m3, - "s2": s2m3 + # "s1": s1m3, + # "s2": s2m3 } } }