Skip to content

Frames

A frame is a standard input to emodpy-workflow commands that functions as an interface to model input definition, discovery, and execution.

In particular, a frame defines:

  • The model to be used (EMOD-HIV)
  • Functions that initialize the model inputs
  • Functions that define how to build inputs after initialization
  • Available hyperparameters and how they modify model input building
  • Reference observational data (for calibration)

Frames are designed to make it simple to extend them via code reuse similar to class inheritance in object oriented design. This enables a project to contain a "family tree" of frames, automatically propagating updates from "parent" frames to their descendants for frame and scenario consistency.

The built-in commands new_frame and extend_frame are convenience methods for generating new frames for use. They are not strictly necessary to create a frame (they can be "handmade"). A frame simply needs to have one attribute, model, in its __init__.py file, where the value of model is an object of a descendent class of IModel.

init.py

A sample EMOD HIV frame __init__.py generated by the new_frame command:

# This frame built via command:
# python -m emodpy_workflow.scripts.new_frame

from emodpy_workflow.lib.models.emod_hiv import EMOD_HIV
from emodpy_workflow.lib.utils.runtime import load_manifest

# The manifest contains input file pathing information for the project
manifest = load_manifest()

# EMOD contains three main configuration objects: config, demographics, and
# campaign. The related information for generating these input objects is
# placed into concern-specific files in this directory.
from . import config
from . import demographics
from . import campaign

# 'model' is a required attribute of this file. All commands access frames
# by loading the 'model' attribute.  The model attribute is assigned a
# model- and disease-specific object that contains all information regarding 
# how to build the inputs for the model and generating its command line for
# execution.
model = EMOD_HIV(
    manifest=manifest,
    config_initializer=config.initialize_config,
    config_parameterizer=config.get_config_parameterized_calls,
    demographics_initializer=demographics.initialize_demographics,
    demographics_parameterizer=demographics.get_demographics_parameterized_calls,
    campaign_initializer=campaign.initialize_campaign,
    campaign_parameterizer=campaign.get_campaign_parameterized_calls,
    ingest_form_path=manifest.ingest_filename,
    build_reports=config.build_reports
)