From 8d7d2a7cd8ffa8efae0838af0b6a2e7717e45e77 Mon Sep 17 00:00:00 2001 From: 0u812 <0u812@users.noreply.github.com> Date: Sat, 16 Sep 2017 09:19:25 -0700 Subject: [PATCH 1/5] add resetToOrigin/resetAll, fix #406 --- wrappers/Python/roadrunner/roadrunner.i | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/wrappers/Python/roadrunner/roadrunner.i b/wrappers/Python/roadrunner/roadrunner.i index 28eeffbbf6..fba87b4d9d 100644 --- a/wrappers/Python/roadrunner/roadrunner.i +++ b/wrappers/Python/roadrunner/roadrunner.i @@ -1460,6 +1460,32 @@ namespace std { class ostream{}; } return result + # --------------------------------------------------------------------- + # Reset Methods + # --------------------------------------------------------------------- + def resetToOrigin(self): + """ Reset model to state when first loaded. + + This resets the model back to the state when it was FIRST loaded, + this includes all init() and parameters such as k1 etc. + + identical to: + r.reset(_roadrunner.SelectionRecord.ALL) + """ + self.reset(_roadrunner.SelectionRecord.ALL) + + def resetAll(self): + """ Reset all model variables to CURRENT init(X) values. + + This resets all variables, S1, S2 etc to the CURRENT init(X) values. It also resets all + parameters back to the values they had when the model was first loaded. + """ + self.reset(_roadrunner.SelectionRecord.TIME | + _roadrunner.SelectionRecord.RATE | + _roadrunner.SelectionRecord.FLOATING | + _roadrunner.SelectionRecord.GLOBAL_PARAMETER) + + def getAvailableIntegrators(self): """ get a list of available integrator names. From 907477a8f387b4a5176798e8467c7511dfc4560c Mon Sep 17 00:00:00 2001 From: 0u812 <0u812@users.noreply.github.com> Date: Mon, 18 Sep 2017 11:04:38 -0700 Subject: [PATCH 2/5] remove plot=True arg, fix #403 --- wrappers/Python/doc/using_roadrunner.rst | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/wrappers/Python/doc/using_roadrunner.rst b/wrappers/Python/doc/using_roadrunner.rst index 2641b2a796..1073b63348 100644 --- a/wrappers/Python/doc/using_roadrunner.rst +++ b/wrappers/Python/doc/using_roadrunner.rst @@ -130,7 +130,7 @@ detailed information on selections, see the :ref:`selecting-values` section. The simulate method, by default returns an `structured array `_, which are arrays that also contain column names. These can be plotted directly using the -built in :meth:`~RoadRunner.plot()` function, or by adding the ``plot=True`` keyword argument to :meth:`~RoadRunner.simulate()`. +built in :meth:`~RoadRunner.plot()` function. The output selections default to time and the set of floating species. It is possible to change the simulation result values by changing the selection list. @@ -168,11 +168,7 @@ Simply call:: result = rr.simulate(0, 10, 100) rr.plot() -or:: - - rr.simulate(0, 10, 100, plot=True) - -If one wants more control over the data plots, one may use matplotlib directly. Assuming the +If one wants more control over the data plots, one may use matplotlib (e.g. via pylab) directly. Assuming the simulate returns an array called result, and that the first column represents the x axis and the remaining columns the y axis, we type:: @@ -184,7 +180,8 @@ This will bring up a new window showing the plot. To clear the plot for next tim pylab.clf() -One may also override the built in :meth:`~RoadRunner.plot()` method with a more more capable plotting routine +One may also override the built in :meth:`~RoadRunner.plot()` method with a more more capable plotting routine. +In fact, this approach is used by the `Tellurium project `_, which supports matplotlib and Plotly plotting engines. Below is a simplified version of the :meth:`~RoadRunner.plot()` method. You may copy and write a customized version and even attach it to the RoadRunner object. The first argument is a RoadRunner From cb27a666c34ab764eaff03eaa9a180f55308830b Mon Sep 17 00:00:00 2001 From: 0u812 <0u812@users.noreply.github.com> Date: Mon, 18 Sep 2017 12:08:00 -0700 Subject: [PATCH 3/5] Revert "remove plot=True arg, fix #403" This reverts commit 907477a8f387b4a5176798e8467c7511dfc4560c. --- wrappers/Python/doc/using_roadrunner.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/wrappers/Python/doc/using_roadrunner.rst b/wrappers/Python/doc/using_roadrunner.rst index 1073b63348..2641b2a796 100644 --- a/wrappers/Python/doc/using_roadrunner.rst +++ b/wrappers/Python/doc/using_roadrunner.rst @@ -130,7 +130,7 @@ detailed information on selections, see the :ref:`selecting-values` section. The simulate method, by default returns an `structured array `_, which are arrays that also contain column names. These can be plotted directly using the -built in :meth:`~RoadRunner.plot()` function. +built in :meth:`~RoadRunner.plot()` function, or by adding the ``plot=True`` keyword argument to :meth:`~RoadRunner.simulate()`. The output selections default to time and the set of floating species. It is possible to change the simulation result values by changing the selection list. @@ -168,7 +168,11 @@ Simply call:: result = rr.simulate(0, 10, 100) rr.plot() -If one wants more control over the data plots, one may use matplotlib (e.g. via pylab) directly. Assuming the +or:: + + rr.simulate(0, 10, 100, plot=True) + +If one wants more control over the data plots, one may use matplotlib directly. Assuming the simulate returns an array called result, and that the first column represents the x axis and the remaining columns the y axis, we type:: @@ -180,8 +184,7 @@ This will bring up a new window showing the plot. To clear the plot for next tim pylab.clf() -One may also override the built in :meth:`~RoadRunner.plot()` method with a more more capable plotting routine. -In fact, this approach is used by the `Tellurium project `_, which supports matplotlib and Plotly plotting engines. +One may also override the built in :meth:`~RoadRunner.plot()` method with a more more capable plotting routine Below is a simplified version of the :meth:`~RoadRunner.plot()` method. You may copy and write a customized version and even attach it to the RoadRunner object. The first argument is a RoadRunner From 066b982db7647e0b6fe73a287f3c8984562e1fe0 Mon Sep 17 00:00:00 2001 From: 0u812 <0u812@users.noreply.github.com> Date: Mon, 18 Sep 2017 21:17:45 -0700 Subject: [PATCH 4/5] try disabling 966 --- wrappers/C/Testing/Suite_SBML_Tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wrappers/C/Testing/Suite_SBML_Tests.cpp b/wrappers/C/Testing/Suite_SBML_Tests.cpp index c889cb9ba7..5120e37299 100644 --- a/wrappers/C/Testing/Suite_SBML_Tests.cpp +++ b/wrappers/C/Testing/Suite_SBML_Tests.cpp @@ -983,7 +983,7 @@ TEST(962) { CHECK(RunTest("l3v1", 962)); } TEST(963) { CHECK(RunTest("l3v1", 963)); } TEST(964) { CHECK(RunTest("l3v1", 964)); } TEST(965) { CHECK(RunTest("l3v1", 965)); } -TEST(966) { CHECK(RunTest("l3v1", 966)); } +// TEST(966) { CHECK(RunTest("l3v1", 966)); } TEST(967) { CHECK(RunTest("l3v1", 967)); } TEST(968) { CHECK(RunTest("l2v4", 968)); } TEST(969) { CHECK(RunTest("l3v1", 969)); } From 57f0dd2c6b94a1f89b471d99884dcb7236880966 Mon Sep 17 00:00:00 2001 From: 0u812 <0u812@users.noreply.github.com> Date: Mon, 18 Sep 2017 21:32:30 -0700 Subject: [PATCH 5/5] Revert "try disabling 966" This reverts commit 066b982db7647e0b6fe73a287f3c8984562e1fe0. --- wrappers/C/Testing/Suite_SBML_Tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wrappers/C/Testing/Suite_SBML_Tests.cpp b/wrappers/C/Testing/Suite_SBML_Tests.cpp index 5120e37299..c889cb9ba7 100644 --- a/wrappers/C/Testing/Suite_SBML_Tests.cpp +++ b/wrappers/C/Testing/Suite_SBML_Tests.cpp @@ -983,7 +983,7 @@ TEST(962) { CHECK(RunTest("l3v1", 962)); } TEST(963) { CHECK(RunTest("l3v1", 963)); } TEST(964) { CHECK(RunTest("l3v1", 964)); } TEST(965) { CHECK(RunTest("l3v1", 965)); } -// TEST(966) { CHECK(RunTest("l3v1", 966)); } +TEST(966) { CHECK(RunTest("l3v1", 966)); } TEST(967) { CHECK(RunTest("l3v1", 967)); } TEST(968) { CHECK(RunTest("l2v4", 968)); } TEST(969) { CHECK(RunTest("l3v1", 969)); }