From 1a00bb7064d0f8c128e15f22bed17adc6ce08153 Mon Sep 17 00:00:00 2001 From: "Frank T. Bergmann" Date: Thu, 2 Feb 2023 15:26:38 +0100 Subject: [PATCH] - add example for steady state --- docs/notebooks/Working_with_Reports.ipynb | 78 ++++++++++++++++++++--- 1 file changed, 69 insertions(+), 9 deletions(-) diff --git a/docs/notebooks/Working_with_Reports.ipynb b/docs/notebooks/Working_with_Reports.ipynb index 1102f93..7d38ccb 100644 --- a/docs/notebooks/Working_with_Reports.ipynb +++ b/docs/notebooks/Working_with_Reports.ipynb @@ -254,6 +254,66 @@ "the value in `print_headers` indicates, whether the name of the elements will be printed in the header column. " ] }, + { + "cell_type": "markdown", + "id": "609f5f04", + "metadata": {}, + "source": [ + "using the `table` element directly, does only work for tasks that generate output *during* the execution of the task, as in the time course example above. Other tasks, such as steady state computation only provide results *after* the task has completed. In the following we add a report for the steady state concentration (and rate of X). We use the function `wrap_copasi_string`, to indicate that we want to have the literal string `[X]` in the header, rather than the initial concentration: " + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "18b5399b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "add_report('X Steady-State', task=T.STEADY_STATE, \n", + " header=[wrap_copasi_string('[X]'), wrap_copasi_string('X.Rate')], \n", + " footer=['[X]', 'X.Rate'])" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "69b29e21", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'name': 'X Steady-State',\n", + " 'separator': '\\t',\n", + " 'precision': 6,\n", + " 'task': 'Steady-State',\n", + " 'comment': '',\n", + " 'is_table': False,\n", + " 'header': ['String=\\\\[X\\\\]', 'String=X.Rate'],\n", + " 'body': [],\n", + " 'footer': ['[X]', 'X.Rate']}" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "get_report_dict('X Steady-State')" + ] + }, { "cell_type": "markdown", "id": "6742259a", @@ -265,7 +325,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 10, "id": "8dbe7023", "metadata": {}, "outputs": [], @@ -275,7 +335,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 11, "id": "cbb20d4c", "metadata": {}, "outputs": [ @@ -292,7 +352,7 @@ " 'table': ['Time', '[X]', 'X.Rate']}" ] }, - "execution_count": 9, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -320,7 +380,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 12, "id": "3d916516", "metadata": {}, "outputs": [], @@ -338,7 +398,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 13, "id": "251fdf2a", "metadata": {}, "outputs": [], @@ -358,7 +418,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 14, "id": "1b37f539", "metadata": {}, "outputs": [ @@ -368,7 +428,7 @@ "'X Time-Course'" ] }, - "execution_count": 12, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -380,7 +440,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -394,7 +454,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.5" + "version": "3.10.4" } }, "nbformat": 4,