From deb5d9e67c41795aa20a2524bc9d58d6ba37ae7c Mon Sep 17 00:00:00 2001 From: Sam Bessey Date: Wed, 22 Dec 2021 13:50:53 -0500 Subject: [PATCH] refactor: rename enter_exit/enter_and_exit to exit_enter --- tests/integration_test.py | 2 +- tests/model_test.py | 20 ++++++++++---------- tests/params/basic.yml | 4 ++-- tests/params/basic_seeded.yml | 2 +- tests/params/basic_seeded_error.yml | 2 +- tests/params/multi_location.yml | 2 +- tests/params/simple_integration.yml | 2 +- titan/model.py | 8 ++++---- titan/params/enter_exit.yml | 2 +- titan/params/features.yml | 2 +- titan/settings/atlanta/model.yml | 2 +- titan/settings/chicago/chicago_baseCase.yml | 2 +- titan/settings/mississippi/model.yml | 2 +- titan/settings/missouri/model.yml | 2 +- titan/settings/nyc-msm/model.yml | 2 +- titan/settings/rhode-island/model.yml | 2 +- titan/settings/scott/model.yml | 2 +- 17 files changed, 30 insertions(+), 30 deletions(-) diff --git a/tests/integration_test.py b/tests/integration_test.py index 197f69a0..edf54a39 100644 --- a/tests/integration_test.py +++ b/tests/integration_test.py @@ -531,7 +531,7 @@ def test_treatment_cascade(params_integration, tmpdir): path_b = tmpdir.mkdir("b") path_b.mkdir("network") - params_integration.features.enter_and_exit = True + params_integration.features.exit_enter = True params_integration.model.num_pop = 1000 params_integration.model.time.num_steps = 20 diff --git a/tests/model_test.py b/tests/model_test.py index c788b9d0..febfcd9a 100644 --- a/tests/model_test.py +++ b/tests/model_test.py @@ -35,7 +35,7 @@ def test_update_all_agents(make_model, make_agent): model = make_model() assert model.params.agent_zero.interaction_type == "injection" model.time = 1 - model.params.features.enter_and_exit = False + model.params.features.exit_enter = False # update all agents passes with agent 0 model.update_all_agents() @@ -103,7 +103,7 @@ def test_death_all(make_model, params): @pytest.mark.unit def test_dropout_none(make_model, params): - params.enter_exit = ObjMap( + params.exit_enter = ObjMap( {"dropout": {"exit_class": "migrate", "entry_class": "none"}} ) model = make_model(params) @@ -118,7 +118,7 @@ def test_dropout_none(make_model, params): @pytest.mark.unit def test_dropout_all(make_model, params): - params.enter_exit = ObjMap( + params.exit_enter = ObjMap( {"dropout": {"exit_class": "migrate", "entry_class": "none"}} ) model = make_model(params) @@ -135,7 +135,7 @@ def test_dropout_all(make_model, params): @pytest.mark.unit def test_ageout(make_model, params): - params.enter_exit = ObjMap( + params.exit_enter = ObjMap( {"dropout": {"exit_class": "age_out", "entry_class": "none"}} ) model = make_model(params) @@ -160,7 +160,7 @@ def test_ageout(make_model, params): @pytest.mark.unit def test_exit_none(make_model, params): - params.enter_exit.death.exit_class = "none" + params.exit_enter.death.exit_class = "none" params.features.incar = False model = make_model(params) init_ppl = copy(model.pop.all_agents.members) @@ -172,8 +172,8 @@ def test_exit_none(make_model, params): @pytest.mark.unit def test_new_agent_no_exit(make_model, params): - params.enter_exit.death.exit_class = "none" - params.enter_exit.death.entry_class = "new_ag" + params.exit_enter.death.exit_class = "none" + params.exit_enter.death.entry_class = "new_ag" model = make_model(params) model.run_random = FakeRandom(0.5) init_ppl = copy(model.pop.all_agents.members) @@ -202,8 +202,8 @@ def test_new_agent_no_exit(make_model, params): @pytest.mark.unit def test_new_agent(make_model, params): - params.enter_exit.death.exit_class = "death" - params.enter_exit.death.entry_class = "new_ag" + params.exit_enter.death.exit_class = "death" + params.exit_enter.death.entry_class = "new_ag" model = make_model(params) model.run_random = FakeRandom(0.0000000001) init_ppl = copy(model.pop.all_agents.members) @@ -248,7 +248,7 @@ def test_replace(make_model, params): @pytest.mark.unit def test_agein(make_model, params): - params.enter_exit.death.entry_class = "age_in" + params.exit_enter.death.entry_class = "age_in" params.features.incar = False model = make_model(params) init_ppl = copy(model.pop.all_agents.members) diff --git a/tests/params/basic.yml b/tests/params/basic.yml index 3d551864..537e2cd1 100644 --- a/tests/params/basic.yml +++ b/tests/params/basic.yml @@ -333,7 +333,7 @@ features: prep: true high_risk: true haart: true - enter_and_exit: true + exit_enter: true static_network: false agent_zero: true assort_mix: false @@ -359,7 +359,7 @@ location: external_exposure: convert_prob: 1.0 -enter_exit: +exit_enter: death: exit_class: death entry_class: replace diff --git a/tests/params/basic_seeded.yml b/tests/params/basic_seeded.yml index 6447a7ca..ff1c4066 100644 --- a/tests/params/basic_seeded.yml +++ b/tests/params/basic_seeded.yml @@ -303,7 +303,7 @@ features: prep: true high_risk: true haart: true - enter_and_exit: true + exit_enter: true static_network: false agent_zero: true assort_mix: false diff --git a/tests/params/basic_seeded_error.yml b/tests/params/basic_seeded_error.yml index 6dcdd008..bdbbaac4 100644 --- a/tests/params/basic_seeded_error.yml +++ b/tests/params/basic_seeded_error.yml @@ -303,7 +303,7 @@ features: prep: true high_risk: true haart: true - enter_and_exit: true + exit_enter: true static_network: false agent_zero: true assort_mix: false diff --git a/tests/params/multi_location.yml b/tests/params/multi_location.yml index 723fa8f5..79de5e9b 100644 --- a/tests/params/multi_location.yml +++ b/tests/params/multi_location.yml @@ -207,7 +207,7 @@ features: static_network: false incar: false partner_tracing: false - enter_and_exit: false + exit_enter: false model: num_pop: 100 diff --git a/tests/params/simple_integration.yml b/tests/params/simple_integration.yml index f276bae4..b515de5a 100644 --- a/tests/params/simple_integration.yml +++ b/tests/params/simple_integration.yml @@ -201,7 +201,7 @@ features: static_network: false incar: false partner_tracing: false - enter_and_exit: false + exit_enter: false model: num_pop: 300 diff --git a/titan/model.py b/titan/model.py index efcbcfae..7f7aeac7 100644 --- a/titan/model.py +++ b/titan/model.py @@ -238,7 +238,7 @@ def update_all_agents(self): if rel.progress(): self.pop.remove_relationship(rel) - if self.params.features.enter_and_exit: + if self.params.features.exit_enter: self.exit() self.enter() @@ -375,7 +375,7 @@ def exit(self): return for agent in self.pop.all_agents: - for strategy in self.params.enter_exit.values(): + for strategy in self.params.exit_enter.values(): # Get parameters of the exit class exit = self.params.classes.exit[strategy.exit_class] if exit.ignore_incar and agent.incar.active: @@ -426,13 +426,13 @@ def enter(self): """ Create new agents and/or replace exited agents. - Based on enter/exit pairs [params.enter_exit], create new agents through the following strategies: + Based on enter/exit pairs [params.exit_enter], create new agents through the following strategies: * new_agent: draw agent characteristics from model params * replace: use exited agent's characteristics to get new characteristics """ - for strategy in self.params.enter_exit.values(): + for strategy in self.params.exit_enter.values(): entrance = self.params.classes.enter[strategy.entry_class] if entrance.enter_type == "new_agent": # determine new agent locations and characteristics diff --git a/titan/params/enter_exit.yml b/titan/params/enter_exit.yml index 1d8f64e6..5173d732 100644 --- a/titan/params/enter_exit.yml +++ b/titan/params/enter_exit.yml @@ -1,4 +1,4 @@ -enter_exit: +exit_enter: type: definition description: pairing of entry information based on exit class. Each exit type can only be represented once. fields: diff --git a/titan/params/features.yml b/titan/params/features.yml index 84a40e16..999c09e9 100644 --- a/titan/params/features.yml +++ b/titan/params/features.yml @@ -19,7 +19,7 @@ features: default: false description: Whether haart will be used in the model type: boolean - enter_and_exit: + exit_enter: default: false description: Whether agents can exit and/or enter during model run type: boolean diff --git a/titan/settings/atlanta/model.yml b/titan/settings/atlanta/model.yml index ac5c224a..07735cfe 100644 --- a/titan/settings/atlanta/model.yml +++ b/titan/settings/atlanta/model.yml @@ -15,7 +15,7 @@ features: prep: false high_risk: false haart: true - enter_and_exit: true + exit_enter: true static_network: false agent_zero: false assort_mix: true diff --git a/titan/settings/chicago/chicago_baseCase.yml b/titan/settings/chicago/chicago_baseCase.yml index e04664e7..97754f76 100644 --- a/titan/settings/chicago/chicago_baseCase.yml +++ b/titan/settings/chicago/chicago_baseCase.yml @@ -29,7 +29,7 @@ features: incar: false prep: true haart: false - enter_and_exit: false + exit_enter: false static_network: true random_trial: true diff --git a/titan/settings/mississippi/model.yml b/titan/settings/mississippi/model.yml index d9ef4dfb..498d7339 100644 --- a/titan/settings/mississippi/model.yml +++ b/titan/settings/mississippi/model.yml @@ -12,7 +12,7 @@ features: prep: true high_risk: false haart: true - enter_and_exit: true + exit_enter: true classes: drug_types: diff --git a/titan/settings/missouri/model.yml b/titan/settings/missouri/model.yml index 262d5eff..449d3244 100644 --- a/titan/settings/missouri/model.yml +++ b/titan/settings/missouri/model.yml @@ -8,7 +8,7 @@ model: features: prep: true haart: true - enter_and_exit: true + exit_enter: true assort_mix: true classes: diff --git a/titan/settings/nyc-msm/model.yml b/titan/settings/nyc-msm/model.yml index 105f4fa1..ff405b27 100644 --- a/titan/settings/nyc-msm/model.yml +++ b/titan/settings/nyc-msm/model.yml @@ -54,7 +54,7 @@ classes: features: prep: true haart: true - enter_and_exit: true + exit_enter: true assort_mix: true outputs: diff --git a/titan/settings/rhode-island/model.yml b/titan/settings/rhode-island/model.yml index 38d7d864..e18dc260 100644 --- a/titan/settings/rhode-island/model.yml +++ b/titan/settings/rhode-island/model.yml @@ -8,7 +8,7 @@ model: features: prep: true haart: true - enter_and_exit: true + exit_enter: true assort_mix: true classes: diff --git a/titan/settings/scott/model.yml b/titan/settings/scott/model.yml index ca4319c5..b23d9c90 100644 --- a/titan/settings/scott/model.yml +++ b/titan/settings/scott/model.yml @@ -12,7 +12,7 @@ model: features: haart: true - enter_and_exit: true + exit_enter: true syringe_services: true agent_zero: true partner_tracing: true