Run

To calculate the model, execute the run.py script:

terminal
python run.py

Run a specific version

To run the model with a specific version from the runplan, use the --version flag. For instance, to run version 2, use the following command:

terminal
python run.py --version 2

This command will execute the model using data for the 2nd version specified in the runplan.

Here’s an example of a runplan in the model:

input.py
runplan = Runplan(data=pd.DataFrame({
    "version": [1, 2, 3],
    "shock": [0, 0.01, -0.01],
}))

To retrieve values from the runplan within the model’s variables, you can use the get method of the Runplan class:

model.py
from input import runplan

@variable()
def shocked_mortality_rate(t):
    return mortality_rate(t) * runplan.get("shock")

If you run the model with version 2, the shock value will be set to 0.01.

This approach allows you to easily specify and manage different versions of your model using the runplan and select a particular version when running the model.