read_shocks to the shocks dict; track shocks from the shocks dict
@@ -592,7 +592,7 @@ class AgentType(HARKobject):
None
'''
for var_name in self.shock_vars:
- setattr(self, var_name, self.shock_history[var_name][self.t_sim, :])
+ self.shocks[var_name] = self.shock_history[var_name][self.t_sim, :]
def getStates(self):
'''
@@ -681,6 +681,9 @@ class AgentType(HARKobject):
for t in range(sim_periods):
self.simOnePeriod()
for var_name in self.track_vars:
+ if var_name in self.shock_vars:
+ self.history[var_name][self.t_sim,:] = self.shocks[var_name]
+ else:
self.history[var_name][self.t_sim,:] = getattr(self,var_name)
self.t_sim += 1
