{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Loads example" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2026-03-24T13:42:10.873425Z", "iopub.status.busy": "2026-03-24T13:42:10.872810Z", "iopub.status.idle": "2026-03-24T13:42:10.884287Z", "shell.execute_reply": "2026-03-24T13:42:10.882485Z" } }, "outputs": [], "source": [ "import os\n", "from pyltmapi import LtmSession\n", "from pathlib import Path\n", "\n", "ltm_core_path = os.environ.get(\"LTM_CORE_PATH\", str(Path(\"~\").expanduser().joinpath(\"ltm/release/bin/\")))\n", "license_file = os.environ.get(\"LTM_CORE_LICENSE_FILE\", str(Path(\"~\").expanduser().joinpath(\"ltm/ltm-license.dat\")))\n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2026-03-24T13:42:10.888951Z", "iopub.status.busy": "2026-03-24T13:42:10.888675Z", "iopub.status.idle": "2026-03-24T13:42:13.380279Z", "shell.execute_reply": "2026-03-24T13:42:13.378222Z" } }, "outputs": [], "source": [ "with LtmSession(\n", " \"ikernel\", overwrite_session=True, ltm_core_path=ltm_core_path\n", ") as session:\n", " session.load(filename=\"load-2d.json\")\n", "\n", " session.model.global_settings.ltm_license_file_path = license_file\n", "\n", " discrepancies = session.validate_model()\n", " if discrepancies:\n", " print(discrepancies)\n", " raise ValueError(\"Validation failed: Invalid model.json\")\n", "\n", " write_model = session.write_model()\n", " status, res = session.execute_model()\n" ] } ], "metadata": { "kernelspec": { "display_name": "ltmio-venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.12" } }, "nbformat": 4, "nbformat_minor": 2 }