save problems with pycharm

This commit is contained in:
Joshua E. Jodesty 2018-11-08 16:14:25 -05:00
parent ee5f912908
commit 84963ae8c1
4 changed files with 14 additions and 17 deletions

View File

@ -62,6 +62,6 @@ def create_tensor_field(mechanisms, exo_proc, keys=['behaviors', 'states']):
dfs = [ create_matrix_field(mechanisms, k) for k in keys ] dfs = [ create_matrix_field(mechanisms, k) for k in keys ]
df = pd.concat(dfs, axis=1) df = pd.concat(dfs, axis=1)
for es, i in zip(exo_proc, range(len(exo_proc))): 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 df['m'] = df.index + 1
return df return df

View File

@ -27,17 +27,14 @@ def mech_step(m_step, sL, state_funcs, behavior_funcs, env_processes, t_step):
last_in_obj = sL[-1] last_in_obj = sL[-1]
_input = exception_handler(getBehaviorInput, m_step, sL, last_in_obj, behavior_funcs) _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 ]) 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']) # mutating last_in_copy
apply_env_proc(env_processes, last_in_copy, last_in_copy['timestamp'])
last_in_copy["mech_step"], last_in_copy["time_step"] = m_step, t_step last_in_copy["mech_step"], last_in_copy["time_step"] = m_step, t_step
sL.append(last_in_copy) sL.append(last_in_copy)
del last_in_copy del last_in_copy
return sL return sL

View File

@ -23,7 +23,7 @@ def main():
# Dimensions: N x r x mechs # Dimensions: N x r x mechs
s = simulation(states_list, configs, env_processes, T, N) s = simulation(states_list, configs, env_processes, T, N)
result = pd.DataFrame(flatten(s)) result = pd.DataFrame(flatten(s))
print('Test') # print('Test')
# print(tabulate(result, headers='keys', tablefmt='psql')) # print(tabulate(result, headers='keys', tablefmt='psql'))
# remove print and tabulate functions, so it returns a dataframe # remove print and tabulate functions, so it returns a dataframe
return result return result

View File

@ -114,32 +114,32 @@ behavior_ops = [foldr(_ + _), lambda x: x + 0]
mechanisms = { mechanisms = {
"m1": { "m1": {
"behaviors": { "behaviors": {
"b1": b1m1, # lambda step, sL, s: s['s1'] + 1, # "b1": b1m1, # lambda step, sL, s: s['s1'] + 1,
"b2": b2m1 # "b2": b2m1
}, },
"states": { # exclude only. TypeError: reduce() of empty sequence with no initial value "states": { # exclude only. TypeError: reduce() of empty sequence with no initial value
"s1": s1m1, "s1": s1m1,
"s2": s2m1 # "s2": s2m1
} }
}, },
"m2": { "m2": {
"behaviors": { "behaviors": {
"b1": b1m2, "b1": b1m2,
"b2": b2m2 # "b2": b2m2
}, },
"states": { "states": {
"s1": s1m2, # "s1": s1m2,
"s2": s2m2 # "s2": s2m2
} }
}, },
"m3": { "m3": {
"behaviors": { "behaviors": {
"b1": b1m3, # "b1": b1m3,
"b2": b2m3 #toggle for error # "b2": b2m3 #toggle for error
}, },
"states": { "states": {
"s1": s1m3, # "s1": s1m3,
"s2": s2m3 # "s2": s2m3
} }
} }
} }