From 1d5d961e8597a76136a2f290e227e3809ed53d10 Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 7 Feb 2024 11:23:08 -0500 Subject: [PATCH] updating RNG and income process for double agents in exploded Sharkfin population --- sharkfin/population.py | 2 ++ sharkfin/tests/test_population_seed_issue.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sharkfin/population.py b/sharkfin/population.py index c609fc8..9f66d47 100644 --- a/sharkfin/population.py +++ b/sharkfin/population.py @@ -117,6 +117,8 @@ def explode_agents(self, num): for j in range(num): double_agent = deepcopy(agent) double_agent.seed = rng.integers(0, 2**31 - 1) + double_agent.reset_rng() + double_agent.update_income_process() exploded_agents.append(double_agent) exploded_dicts.append(deepcopy(self.population_parameters[i])) diff --git a/sharkfin/tests/test_population_seed_issue.py b/sharkfin/tests/test_population_seed_issue.py index 5531d01..6464ac6 100644 --- a/sharkfin/tests/test_population_seed_issue.py +++ b/sharkfin/tests/test_population_seed_issue.py @@ -47,7 +47,7 @@ def test_random_seeds(): p2a0 = pop1.agent_database["agents"][0] ### Different income seeds within one population - assert(p1a0.PermShkStd.seed != p1a1.PermShkStd.seed) + assert(p1a0.PermShkDstn.seed != p1a1.PermShkDstn.seed) ### Different income seeds across two populations with different seeds - assert(p1a0.PermShkStd.seed != p2a0.PermShkStd.seed) + assert(p1a0.PermShkDstn.seed != p2a0.PermShkDstn.seed)