From 7c448921fef46618af53f035e6592204330027db Mon Sep 17 00:00:00 2001 From: Alan Lujan Date: Tue, 21 Mar 2023 11:34:43 -0400 Subject: [PATCH] assert number of agents --- sharkfin/tests/test_simulation.py | 2 ++ simulate/parameters.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sharkfin/tests/test_simulation.py b/sharkfin/tests/test_simulation.py index b6a9207..3ba59fe 100644 --- a/sharkfin/tests/test_simulation.py +++ b/sharkfin/tests/test_simulation.py @@ -205,6 +205,8 @@ def test_lucas0_simulation(): rng=np.random.default_rng(1), ) + assert len(pop.agent_database.index) == LUCAS0["num_per_type"] + # arguments to attention simulation # a = 0.2 diff --git a/simulate/parameters.py b/simulate/parameters.py index b97f88b..d2eaaa1 100644 --- a/simulate/parameters.py +++ b/simulate/parameters.py @@ -9,7 +9,7 @@ def build_population(agent_type, parameters, rng=None, dphm=1500): - num_per_type = parameters.pop("num_per_type", 1) + num_per_type = parameters.get("num_per_type", 1) pop = AgentPopulation( agent_type(), parameters, rng=rng, dollars_per_hark_money_unit=dphm @@ -104,6 +104,6 @@ def build_population(agent_type, parameters, rng=None, dphm=1500): lucas0_parameter_dict = lucas0_agent_population_params lucas0_parameter_dict["AgentCount"] = 10 # TODO: What should this be? -lucas0_agent_population_params["num_per_type"] = 10 +lucas0_parameter_dict["num_per_type"] = 10 LUCAS0 = lucas0_parameter_dict