diff --git a/cadCAD/configuration/__init__.py b/cadCAD/configuration/__init__.py index ed6e6ce..1c8cd75 100644 --- a/cadCAD/configuration/__init__.py +++ b/cadCAD/configuration/__init__.py @@ -10,17 +10,17 @@ from cadCAD.configuration.utils import exo_update_per_ts class Configuration(object): def __init__(self, sim_config={}, initial_state={}, seeds={}, env_processes={}, - exogenous_states={}, partial_state_updates={}, policy_ops=[foldr(dict_elemwise_sum())], **kwargs): + exogenous_states={}, partial_state_update_blocks={}, policy_ops=[foldr(dict_elemwise_sum())], **kwargs): self.sim_config = sim_config self.initial_state = initial_state self.seeds = seeds self.env_processes = env_processes self.exogenous_states = exogenous_states - self.partial_state_updates = partial_state_updates + self.partial_state_updates = partial_state_update_blocks self.policy_ops = policy_ops -def append_configs(sim_configs, initial_state, seeds, raw_exogenous_states, env_processes, partial_state_updates, _exo_update_per_ts=True): +def append_configs(sim_configs, initial_state, seeds, raw_exogenous_states, env_processes, partial_state_update_blocks, _exo_update_per_ts=True): if _exo_update_per_ts is True: exogenous_states = exo_update_per_ts(raw_exogenous_states) else: @@ -35,7 +35,7 @@ def append_configs(sim_configs, initial_state, seeds, raw_exogenous_states, env_ seeds=seeds, exogenous_states=exogenous_states, env_processes=env_processes, - partial_state_updates=partial_state_updates + partial_state_updates=partial_state_update_blocks ) ) elif isinstance(sim_configs, dict): @@ -46,7 +46,7 @@ def append_configs(sim_configs, initial_state, seeds, raw_exogenous_states, env_ seeds=seeds, exogenous_states=exogenous_states, env_processes=env_processes, - partial_state_updates=partial_state_updates + partial_state_updates=partial_state_update_blocks ) ) @@ -84,7 +84,7 @@ class Processor: self.apply_identity_funcs = id.apply_identity_funcs def create_matrix_field(self, partial_state_updates, key): - if key == 'states': + if key == 'variables': identity = self.state_identity elif key == 'policies': identity = self.policy_identity @@ -121,7 +121,7 @@ class Processor: if len(partial_state_updates) != 0: bdf = self.create_matrix_field(partial_state_updates, 'policies') - sdf = self.create_matrix_field(partial_state_updates, 'states') + sdf = self.create_matrix_field(partial_state_updates, 'variables') sdf_values, bdf_values = no_update_handler(bdf, sdf) zipped_list = list(zip(sdf_values, bdf_values)) else: diff --git a/cadCAD/configuration/utils/__init__.py b/cadCAD/configuration/utils/__init__.py index 084f7ae..229a738 100644 --- a/cadCAD/configuration/utils/__init__.py +++ b/cadCAD/configuration/utils/__init__.py @@ -11,7 +11,7 @@ class TensorFieldReport: def __init__(self, config_proc): self.config_proc = config_proc - def create_tensor_field(self, partial_state_updates, exo_proc, keys=['policies', 'states']): + def create_tensor_field(self, partial_state_updates, exo_proc, keys=['policies', 'variables']): dfs = [self.config_proc.create_matrix_field(partial_state_updates, k) for k in keys] df = pd.concat(dfs, axis=1) for es, i in zip(exo_proc, range(len(exo_proc))): @@ -52,7 +52,7 @@ def time_step(dt_str, dt_format='%Y-%m-%d %H:%M:%S', _timedelta = tstep_delta): ep_t_delta = timedelta(days=0, minutes=0, seconds=1) def ep_time_step(s, dt_str, fromat_str='%Y-%m-%d %H:%M:%S', _timedelta = ep_t_delta): - if s['sub_step'] == 0: + if s['substep'] == 0: return time_step(dt_str, fromat_str, _timedelta) else: return dt_str @@ -114,7 +114,7 @@ def sweep_states(state_type, states, in_config): def exo_update_per_ts(ep): @curried def ep_decorator(f, y, var_dict, sub_step, sL, s, _input): - if s['sub_step'] + 1 == 1: + if s['substep'] + 1 == 1: return f(var_dict, sub_step, sL, s, _input) else: return y, s[y] diff --git a/cadCAD/engine/simulation.py b/cadCAD/engine/simulation.py index 9e3a153..96f43e9 100644 --- a/cadCAD/engine/simulation.py +++ b/cadCAD/engine/simulation.py @@ -51,7 +51,7 @@ class Executor: self.apply_env_proc(env_processes, last_in_copy, last_in_copy['timestep']) # not time_step - last_in_copy["sub_step"], last_in_copy["time_step"], last_in_copy['run'] = sub_step, time_step, run + last_in_copy['substep'], last_in_copy['timestep'], last_in_copy['run'] = sub_step, time_step, run sL.append(last_in_copy) del last_in_copy @@ -62,7 +62,7 @@ class Executor: sub_step = 0 states_list_copy = deepcopy(states_list) genesis_states = states_list_copy[-1] - genesis_states['sub_step'], genesis_states['time_step'] = sub_step, time_step + genesis_states['substep'], genesis_states['timestep'] = sub_step, time_step states_list = [genesis_states] sub_step += 1 @@ -93,7 +93,7 @@ class Executor: states_list_copy = deepcopy(states_list) head, *tail = self.run_pipeline(var_dict, states_list_copy, configs, env_processes, time_seq, run) genesis = head.pop() - genesis['sub_step'], genesis['time_step'], genesis['run'] = 0, 0, run + genesis['substep'], genesis['timestep'], genesis['run'] = 0, 0, run first_timestep_per_run = [genesis] + tail.pop(0) pipe_run += [first_timestep_per_run] + tail del states_list_copy