Source code for emodpy_measles.interventions.targeted_outbreak
from emod_api import schema_to_class as s2c
from emod_api import campaign as camp
from emod_api.interventions import utils
[docs]def seed(camp, timestep, coverage=0.01, node_ids=None ):
"""
Seed an outbreak at a particular time, in selected nodes, based on coverage.
This infects existing individuals.
Args:
camp: emod_api.campaign 'module object'. Provides centralized source of schema.
timestep: time(step) at which outbreak should be seeded.
coverage: Percentage of individuals to be infected.
node_ids: Nodes to target with outbreak. Leave empty to hit all nodes.
Returns:
Configured campaign event ready to be added to campaign.
"""
intervention = s2c.get_class_with_defaults( "OutbreakIndividual", camp.schema_path )
coordinator = s2c.get_class_with_defaults( "StandardEventCoordinator", camp.schema_path )
if coordinator is None:
print( "s2c.get_class_with_defaults returned None. Maybe no schema.json was provided." )
return ""
coordinator.Intervention_Config = intervention
coordinator.Demographic_Coverage = coverage
event = s2c.get_class_with_defaults( "CampaignEvent", camp.schema_path )
event.Event_Coordinator_Config = coordinator
event.Start_Day = float(timestep)
if node_ids is not None:
event.Nodeset_Config = utils.do_nodes( camp.schema_path, node_ids )
return event