save problems with pycharm
This commit is contained in:
parent
ee5f912908
commit
84963ae8c1
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
20
ui/config.py
20
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue