<aside> 📘

Tutorial 13 of the Kalix tutorial series. You'll run the same Stringybark Creek calibration as Tutorial 12 — but driven from Python with kalix.optimise(), reading the result back as a dictionary, then simulating and plotting the calibrated model in a notebook. Expected time: about 20 minutes.

</aside>

What you'll build

A Jupyter notebook that calibrates the Stringybark catchment model in one call, inspects the optimised parameters as a pandas object, and overlays the calibrated simulation against the observed record. This is the analysis-friendly counterpart to Tutorial 12's command-line workflow — same optimisation, same config file, driven from Python.

image.png

image.png

Prerequisites

Project layout

013/
├── data/
│   ├── climate_data.csv
│   └── observed.csv
└── models/
    ├── stringybark.ini              # the starting model
    ├── optimisation_config.ini      # the calibration recipe (same as Tutorial 12)
    └── analysis.ipynb               # the notebook we'll write

The notebook sits next to the model and config files, so the relative paths inside the config (../data/observed.csv) and the notebook resolve cleanly. Launch Jupyter from 013/models/.

The CLI and Python, side by side

The kalix Python package mirrors the CLI. Tutorial 12's command:

kalix optimise optimisation_config.ini stringybark.ini -s stringybark_calibrated.ini

becomes, in Python:

result = kalix.optimise(
    "optimisation_config.ini",
    model_file="stringybark.ini",
    save_model="stringybark_calibrated.ini",
)

Same three pieces — the config, the model, and where to save the calibrated model. The difference: the CLI prints a summary to the terminal, while Python returns the results to you as a dictionary you can work with directly.

<aside> 💡

Everything from Tutorial 12 — Optimisation from the commandline still applies — the [optimisation], [term.*], and [parameters] sections of the config are read exactly the same way. If you want to change the algorithm, statistic, or parameter ranges, you edit optimisation_config.ini, not the Python.

</aside>

Step 1 — Open a notebook in the model folder