Skip to content

Commit

Permalink
Merge pull request #212 from pph-collective/develop
Browse files Browse the repository at this point in the history
v3.0.0 (take 2)
  • Loading branch information
s-bessey authored Dec 22, 2021
2 parents 0ad0245 + 778849f commit 31543d0
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion tests/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
20 changes: 10 additions & 10 deletions tests/model_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tests/params/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -359,7 +359,7 @@ location:
external_exposure:
convert_prob: 1.0

enter_exit:
exit_enter:
death:
exit_class: death
entry_class: replace
Expand Down
2 changes: 1 addition & 1 deletion tests/params/basic_seeded.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/params/basic_seeded_error.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/params/multi_location.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ features:
static_network: false
incar: false
partner_tracing: false
enter_and_exit: false
exit_enter: false

model:
num_pop: 100
Expand Down
2 changes: 1 addition & 1 deletion tests/params/simple_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ features:
static_network: false
incar: false
partner_tracing: false
enter_and_exit: false
exit_enter: false

model:
num_pop: 300
Expand Down
8 changes: 4 additions & 4 deletions titan/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion titan/params/enter_exit.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion titan/params/features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion titan/settings/atlanta/model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion titan/settings/chicago/chicago_baseCase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ features:
incar: false
prep: true
haart: false
enter_and_exit: false
exit_enter: false
static_network: true
random_trial: true

Expand Down
2 changes: 1 addition & 1 deletion titan/settings/mississippi/model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ features:
prep: true
high_risk: false
haart: true
enter_and_exit: true
exit_enter: true

classes:
drug_types:
Expand Down
2 changes: 1 addition & 1 deletion titan/settings/missouri/model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ model:
features:
prep: true
haart: true
enter_and_exit: true
exit_enter: true
assort_mix: true

classes:
Expand Down
2 changes: 1 addition & 1 deletion titan/settings/nyc-msm/model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ classes:
features:
prep: true
haart: true
enter_and_exit: true
exit_enter: true
assort_mix: true

outputs:
Expand Down
2 changes: 1 addition & 1 deletion titan/settings/rhode-island/model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ model:
features:
prep: true
haart: true
enter_and_exit: true
exit_enter: true
assort_mix: true

classes:
Expand Down
2 changes: 1 addition & 1 deletion titan/settings/scott/model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ model:

features:
haart: true
enter_and_exit: true
exit_enter: true
syringe_services: true
agent_zero: true
partner_tracing: true
Expand Down

0 comments on commit 31543d0

Please sign in to comment.