Skip to content

Commit

Permalink
revised results notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
jtwhite79 committed Dec 27, 2024
1 parent 14c47ea commit 1858cf8
Showing 1 changed file with 63 additions and 23 deletions.
86 changes: 63 additions & 23 deletions examples/exploring_results_handlers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"id": "0b2bb650-0924-49d2-9475-a6b688d9a73a",
"metadata": {},
"source": [
"# Exploring `pyemu.Pst.Results`\n",
"# Exploring pestpp-ies and pestpp-mou results with `pyemu.Pst`\n",
"\n",
"To make processing the insane amount of output generated by pestpp-ies and pestpp-mou, pyemu includes a results-handling helper class to hide all of the nastiness associated with finding specific iteration/generation results. Let see how this works... "
"To help with processing the insane amount of output generated by pestpp-ies and pestpp-mou, `pyemu.Pst` includes a results-handling helper class to hide all of the nastiness associated with finding specific iteration/generation results. Let see how this works... "
]
},
{
Expand All @@ -26,7 +26,7 @@
"id": "b3245573-a62b-41f6-8556-acbc09af0217",
"metadata": {},
"source": [
"The results handler is based on having a stand-alone directory that holds the results of a completed pestpp-ies/pestpp-mou run. We have added a few of these directories to the pyemu repo for testing and for this example - your welcome!"
"The result handlers are based on having a stand-alone directory that holds the results of a completed pestpp-ies/pestpp-mou run. We have added a few of these directories to the pyemu repo for testing and for this example - your welcome!"
]
},
{
Expand All @@ -53,9 +53,11 @@
"id": "e92e70bc-2ce4-4b4e-8035-05f4bc51610a",
"metadata": {},
"source": [
"## pestpp-ies\n",
"\n",
"We see the `m_d_ies11` contains a single control file, while `m_d_ies2` has many...\n",
"\n",
"Like usual, we need to load the control file into a `Pst` instance. We can assume that even tho `m_d_ies2` has lots of control files, they have the same numbers of pars and obs:"
"Like usual, we need to load the control file into a `Pst` instance. We can assume that even tho `m_d_ies2` has lots of control files, they have the same numbers of pars and obs (altho this is not required by the result handler), so maybe this collection of control files represents different experiments that have been run. Let's just use the single control in `m_d_ies1`:"
]
},
{
Expand All @@ -75,7 +77,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(pst)"
"pst"
]
},
{
Expand All @@ -93,15 +95,15 @@
"metadata": {},
"outputs": [],
"source": [
"pst.add_results(m_d_ies1)\n"
"pst.add_results(m_d_ies1)"
]
},
{
"cell_type": "markdown",
"id": "36b12c07-dc4a-4d1a-9750-2dce263de2ac",
"metadata": {},
"source": [
"Now for the fun part! with only a single a results directory registered, we can access the pestpp-ies results in that directory via the `.ies` attribute:"
"Now for the fun part! We can access the pestpp-ies results in that directory via the `.ies` attribute:"
]
},
{
Expand All @@ -119,7 +121,7 @@
"id": "a6159ae6-e2cb-4ac7-a697-6a63144f15ff",
"metadata": {},
"source": [
"Lets say we want to see the prior parameter ensemble:"
"Lets say we want to see the prior parameter ensemble. We do this via the `paren` (for parameter ensemble) with a '0' suffix for the 0th iteration (ie the prior):"
]
},
{
Expand Down Expand Up @@ -155,6 +157,7 @@
"id": "20fa7a08-f071-44f7-88de-f89f45430f8e",
"metadata": {},
"source": [
"This lazy evaluation means accessing the prior par ensemble next time is super cheap b/c its being held in memory..\n",
"How about the correspoding obs ensemble:\n",
"\n"
]
Expand Down Expand Up @@ -184,7 +187,7 @@
"id": "8f79fabf-aedd-4973-8292-cc2eff709374",
"metadata": {},
"source": [
"What if we want to see all of the par and obs ensembles across all iterations? "
"What if we want to see all of the par and obs ensembles across all iterations? All we need to do now is leave off an iteration suffix from the `paren` attribute, and we will get back a multi-index dataframe:"
]
},
{
Expand All @@ -202,7 +205,7 @@
"id": "45940042-a06b-4958-86bb-35b3138b6203",
"metadata": {},
"source": [
"How about noise and weight ensembles?"
"How about noise and weight ensembles you say? easy as..."
]
},
{
Expand Down Expand Up @@ -245,6 +248,24 @@
"pst.ies.pcs"
]
},
{
"cell_type": "markdown",
"id": "a7e6675a-ea32-48ce-b7d9-8ea9b8bee1dd",
"metadata": {},
"source": [
"And the prior-data-conflict information:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "56e7f2f4-b89e-4c91-9334-a31488518cb3",
"metadata": {},
"outputs": [],
"source": [
"pst.ies.pdc"
]
},
{
"cell_type": "markdown",
"id": "c89c7a98-3b6a-49a6-a73c-b0972f65a690",
Expand Down Expand Up @@ -278,6 +299,7 @@
"id": "dba94de9-71ce-444b-b18a-1649256de39c",
"metadata": {},
"source": [
"## pestpp-mou\n",
"Things work in a similar way for pestpp-mou:"
]
},
Expand Down Expand Up @@ -317,7 +339,7 @@
"id": "0b6b7b93-09fb-464c-be57-bc695620a1a6",
"metadata": {},
"source": [
"Like with the pestpp-ies handler, we can access the individual populations or the combined populations:"
"Like with the pestpp-ies handler, we can access the individual populations or the combined populations thru the `obspop` and `dvpop` attributes for the observation population and decision-variable population, respectively:"
]
},
{
Expand Down Expand Up @@ -345,7 +367,7 @@
"id": "b502c4e5-df26-4386-ac9e-bece6b023d59",
"metadata": {},
"source": [
"and the archives:"
"The archive versions of those are available as:"
]
},
{
Expand All @@ -368,14 +390,6 @@
"pst.mou.archivedvpop"
]
},
{
"cell_type": "markdown",
"id": "82a341b3-38cf-44d6-bc99-eaf8c9531aac",
"metadata": {},
"source": [
"The pareto summary and pareto archive summaries are accessible like this:"
]
},
{
"cell_type": "markdown",
"id": "b6b77234-f139-4a6b-9dba-257ea53d916c",
Expand All @@ -394,6 +408,14 @@
"pst.mou.chanceobspop"
]
},
{
"cell_type": "markdown",
"id": "a01dc812-09af-4c81-be64-02db0d6322fd",
"metadata": {},
"source": [
"The pareto summary and pareto archive summaries are accessible like this:"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -431,7 +453,7 @@
"source": [
"## Dealing with multiple results diretories\n",
"\n",
"This is getting deep!"
"This is getting deep! While not a common use-case yet, we are working toward being able to automatically/programmatically compared two or more pestpp-ies/pestpp-mou analyses, where each analysis is stored in a seperate directory..."
]
},
{
Expand Down Expand Up @@ -460,7 +482,7 @@
"id": "8f812287-4a50-4078-8ef7-d9255f76a12b",
"metadata": {},
"source": [
"When using multiple directories, you can pass an optional \"cases\" argument in the case where you have named the control file a different name in different results directories:"
"When using multiple directories, you can pass an optional \"cases\" argument in the case where you have named the control file a different name in different results directories. In this example, the first directory uses the case \"pest\" and we will use the case \"test\" in the second directory (note the \"test\" case run used binary output files - the results handler doesnt care!):"
]
},
{
Expand Down Expand Up @@ -509,6 +531,16 @@
"pst.master_ies2.ies.obsen"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "44a595c5-2340-430b-b476-2722a5b26000",
"metadata": {},
"outputs": [],
"source": [
"pst.master_ies2.ies.files_loaded"
]
},
{
"cell_type": "markdown",
"id": "9f3726c9-5aa7-4b48-92ca-2fa2415e310f",
Expand Down Expand Up @@ -547,10 +579,18 @@
"ies_all[0].phi_actual"
]
},
{
"cell_type": "markdown",
"id": "d7eca70c-040b-4861-aa5f-920d98663aab",
"metadata": {},
"source": [
"Enjoy!"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "303b233a-e66f-4798-9470-098b35c1e233",
"id": "bb8fcf52-3043-4ad5-b873-d58600333ab3",
"metadata": {},
"outputs": [],
"source": []
Expand Down

0 comments on commit 1858cf8

Please sign in to comment.