Use elements in a frame
Add additional config elements
To add a new hyperparameter to the config, add a new ParameterizedCall to config.py in the chosen frame.
For example, to add a hyperparameter named Base_Infectivity that allows modification to the same-named EMOD-HIV config parameter in a frame named baseline:
-
Add the following new function to frames/baseline/config.py:
-
In the same frames/baseline/config.py file, modify the function get_config_parameterized_calls by adding lines similar to line 5 and 6 below. Line 5 will create a ParameterizedCall object using the new function and line 6 will add it to the list of config ParameterizedCalls.
The hyperparameter named Base_Infectivity will now be available for use.
Add additional campaign elements
To add a new campaign element (often an intervention), create and add an appropriate intervention object in a function and then add a new ParameterizedCall using it in the campaign.py of the chosen frame.
For example:
-
Assume you created a new frame using the extend_frame command and called it hiv_vaccine.
-
Add the following new function creating a vaccine intervention to frames/hiv_vaccine/campaign.py:
-
In the same frames/hiv_vaccine/campaign.py file, modify the function get_campaign_parameterized_calls by adding lines similar to line 5 and 6 below. Line 5 will create a ParameterizedCall object using the new function and line 6 will add it to the list of campaign ParameterizedCalls.
The hyperparameter named vaccine_efficacy will now be available for use.
Replace a campaign or demographics element of a frame
To override an element of an EMOD-HIV campaign or demographics, create a Python subclass of the country model you want to use and add overriding function(s) of the same name(s) to the country model functions you want to replace.
For example, creating a Python country model subclass named ZambiaModified using an alternate add_state_TestingOnChild6w function for the Zambia model campaign in frame zambia_modified.
-
Use the new_frame command to create a fresh Zambia country model starting point (see Create a new frame):
-
Update the original Zambia country model import near the top:
Replace the following line:
with
-
Add the following new Zambia country model Python subclass in frames/zambia_modified/campaign.py containing the desired override/replacement. The additional naming line at the end updates the rest of the file to use the new country model.
In this example, we are copy/pasting the original Zambia add_state_TestingOnChild6w function and modifying the internal child_testing_time_value_map values to be two years earlier than the original:
The frame zambia_modified now is identical to a Zambia country model frame but with the targeted section of the campaign replaced.
The process for replacing demographics elements is identical, but frames/zambia_modified/demographics.py is edited instead.
Specify an ingest form for a frame
The way to specify the ingest form to use for all frames in a project is by editing the ingest_filename attribute in its manifest.py file.
For example:
... sets the ingest file to use to be the file at path:
<project_directory>/calibration/ingest_forms/Zambia_calibration_ingest_form_2022-05-19__source__edited_for_calibration_testing--ALL_NODE.xlsm
To override this ingest_filename path for a specific frame only requires an edit to the chosen frame's EMOD_HIV object specification in its __init__.py file. Change "manifest.ingest_filename" below in your chosen frame to the desired path: