From 2e9ba11786919d2cb6fba9e4ccc03d7cf685afa8 Mon Sep 17 00:00:00 2001 From: Christopher Teubert Date: Wed, 23 Aug 2023 13:05:38 -0700 Subject: [PATCH] add mention of seeds --- examples/01_Simulation.ipynb | 37 ++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/examples/01_Simulation.ipynb b/examples/01_Simulation.ipynb index 03ba6d6..8a1fedb 100644 --- a/examples/01_Simulation.ipynb +++ b/examples/01_Simulation.ipynb @@ -656,7 +656,7 @@ "metadata": {}, "outputs": [], "source": [ - "loading = GaussianNoiseLoadWrapper(loading, 0.2)" + "loading_with_noise = GaussianNoiseLoadWrapper(loading, 0.2)" ] }, { @@ -674,7 +674,7 @@ "metadata": {}, "outputs": [], "source": [ - "results = m.simulate_to_threshold(loading, save_freq=100)\n", + "results = m.simulate_to_threshold(loading_with_noise, save_freq=100)\n", "fig = results.inputs.plot()" ] }, @@ -691,7 +691,7 @@ "metadata": {}, "outputs": [], "source": [ - "results = m.simulate_to_threshold(loading, save_freq=100)\n", + "results = m.simulate_to_threshold(loading_with_noise, save_freq=100)\n", "fig = results.inputs.plot()" ] }, @@ -717,6 +717,30 @@ "source": [ "Note that the noise in input can be seen in the resulting output plots.\n", "\n", + "The seed can be set in creation of the GaussianNoiseLoadWrapper to ensure repeatable results, for example." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "loading_with_noise = GaussianNoiseLoadWrapper(loading, 0.2, seed=2000)\n", + "results = m.simulate_to_threshold(loading_with_noise, save_freq=100)\n", + "fig = results.inputs.plot()\n", + "\n", + "loading_with_noise = GaussianNoiseLoadWrapper(loading, 0.2, seed=2000)\n", + "results = m.simulate_to_threshold(loading_with_noise, save_freq=100)\n", + "fig = results.inputs.plot()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The load profiles in the two examples above are identical because they share the same random seed.\n", + "\n", "In this section we introduced the concept of NoiseWrappers and how they are used to represent uncertainty in future loading. This concept is expecially important when used with prediction (see 9. Prediction). A GuassianNoiseLoadWrapper was used with a Piecewise loading profile to demonstrate it, but NoiseWrappers can be applied to any loading object or function, including the advanced profiles introduced in the next section." ] }, @@ -900,7 +924,12 @@ "## Conclusions\n", "...\n", "\n", - "simulate_to_event(), events" + "simulate_to_event(), events\n", + "loading.plot()\n", + "guassian std dev for each event.\n", + "Guassian std dev as function of t\n", + "Switch to use generator so you can set seed\n", + "remove x=None requirement\n" ] } ],