From 999fcbaf0dce1f71cb494814524396502023d3f0 Mon Sep 17 00:00:00 2001 From: Bryan Rumsey Date: Mon, 22 Aug 2022 09:04:12 -0400 Subject: [PATCH 1/5] Fixed UI in the model mode section for well mixed models. --- client/model-view/model-view.js | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/client/model-view/model-view.js b/client/model-view/model-view.js index 13f8c11a02..81efcb7c7e 100644 --- a/client/model-view/model-view.js +++ b/client/model-view/model-view.js @@ -79,27 +79,24 @@ module.exports = View.extend({ this.setReadOnlyMode("model-mode"); this.setReadOnlyMode("system-volume"); }else { - if(this.model.defaultMode === "" && !this.model.is_spatial){ - if(this.model.is_spatial) { - this.model.defaultMode = "discrete"; - $(this.queryByHook("spatial-discrete")).prop('checked', true); - }else{ + if(this.model.is_spatial) { + this.model.defaultMode = "discrete"; + $(this.queryByHook("spatial-discrete")).prop('checked', true); + let dataHooks = { + 'continuous':'spatial-continuous', + 'discrete':'spatial-discrete', + 'discrete-concentration':'spatial-discrete-concentration' + }; + $(this.queryByHook(dataHooks[this.model.defaultMode])).prop('checked', true); + $(this.queryByHook("model-mode-container")).css("display", "none"); + $(this.queryByHook("system-volume-container")).css("display", "none"); + }else{ + let dataHooks = {'continuous':'all-continuous', 'discrete':'all-discrete', 'dynamic':'advanced'}; + $(this.queryByHook("spatial-model-mode-container")).css("display", "none"); + if (this.model.defaultMode === ""){ this.getInitialDefaultMode(); - } - }else { - if(this.model.is_spatial) { - let dataHooks = { - 'continuous':'spatial-continuous', - 'discrete':'spatial-discrete', - 'discrete-concentration':'spatial-discrete-concentration' - }; - $(this.queryByHook(dataHooks[this.model.defaultMode])).prop('checked', true); - $(this.queryByHook("model-mode-container")).css("display", "none"); - $(this.queryByHook("system-volume-container")).css("display", "none"); }else{ - let dataHooks = {'continuous':'all-continuous', 'discrete':'all-discrete', 'dynamic':'advanced'}; $(this.queryByHook(dataHooks[this.model.defaultMode])).prop('checked', true); - $(this.queryByHook("spatial-model-mode-container")).css("display", "none"); } } this.model.reactions.on("change", (reactions) => { From cc2f8b1fe77aae62770fbf5b6af47a08577d5cb5 Mon Sep 17 00:00:00 2001 From: Bryan Rumsey Date: Mon, 22 Aug 2022 09:08:47 -0400 Subject: [PATCH 2/5] Fixed issue with timespan creation in parameter sweeps. --- stochss/handlers/util/ensemble_simulation.py | 2 +- stochss/handlers/util/parameter_sweep.py | 2 +- stochss/handlers/util/stochss_model.py | 2 +- stochss/handlers/util/stochss_spatial_model.py | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/stochss/handlers/util/ensemble_simulation.py b/stochss/handlers/util/ensemble_simulation.py index b960f546a6..bc6bd61f74 100644 --- a/stochss/handlers/util/ensemble_simulation.py +++ b/stochss/handlers/util/ensemble_simulation.py @@ -89,7 +89,7 @@ def __update_timespan(self): end = self.settings['timespanSettings']['endSim'] step_size = self.settings['timespanSettings']['timeStep'] self.g_model.timespan( - TimeSpan(numpy.arange(0, end + step_size, step_size)) + TimeSpan.arange(step_size, t=end + step_size) ) diff --git a/stochss/handlers/util/parameter_sweep.py b/stochss/handlers/util/parameter_sweep.py index b8e68a9332..e6b733cce6 100644 --- a/stochss/handlers/util/parameter_sweep.py +++ b/stochss/handlers/util/parameter_sweep.py @@ -121,7 +121,7 @@ def configure(self): end = self.settings['timespanSettings']['endSim'] step_size = self.settings['timespanSettings']['timeStep'] self.g_model.timespan( - TimeSpan(numpy(0, end + step_size, step_size)) + TimeSpan.arange(step_size, t=end + step_size) ) kwargs = {"model":self.g_model, "settings":run_settings} parameters = [] diff --git a/stochss/handlers/util/stochss_model.py b/stochss/handlers/util/stochss_model.py index 4a96cc541c..9063a8d150 100644 --- a/stochss/handlers/util/stochss_model.py +++ b/stochss/handlers/util/stochss_model.py @@ -139,7 +139,7 @@ def __convert_model_settings(self): try: end = self.model['modelSettings']['endSim'] step_size = self.model['modelSettings']['timeStep'] - return TimeSpan(numpy.arange(0, end + step_size, step_size)) + return TimeSpan.arange(step_size, t=end + step_size) except KeyError as err: message = "Model settings are not properly formatted or " message += f"are referenced incorrectly: {str(err)}" diff --git a/stochss/handlers/util/stochss_spatial_model.py b/stochss/handlers/util/stochss_spatial_model.py index d50ef15cc2..3058dd5ac1 100644 --- a/stochss/handlers/util/stochss_spatial_model.py +++ b/stochss/handlers/util/stochss_spatial_model.py @@ -29,7 +29,7 @@ from escapism import escape from spatialpy import Model, Species, Parameter, Reaction, Domain, DomainError, BoundaryCondition, \ PlaceInitialCondition, UniformInitialCondition, ScatterInitialCondition, \ - Geometry, ModelError + Geometry, ModelError, TimeSpan from .stochss_base import StochSSBase from .stochss_errors import StochSSFileNotFoundError, FileNotJSONFormatError, DomainFormatError, \ @@ -235,8 +235,8 @@ def __convert_model_settings(self, model): end = self.model['modelSettings']['endSim'] output_freq = self.model['modelSettings']['timeStep'] step_size = self.model['modelSettings']['timestepSize'] - tspan = numpy.arange(0, end + step_size, output_freq) - model.timespan(tspan, timestep_size=step_size) + tspan = TimeSpan.arange(output_freq, t=end + step_size, timestep_size=step_size) + model.timespan(tspan) except KeyError as err: message = "Spatial model settings are not properly formatted or " message += f"are referenced incorrectly: {str(err)}" From 767a776038175f02af6f386ed4b5c3ebf4833056 Mon Sep 17 00:00:00 2001 From: Bryan Rumsey Date: Mon, 22 Aug 2022 09:36:29 -0400 Subject: [PATCH 3/5] Fixed vilar oscillator inference example. --- .../Vilar_Oscillator_SCIOPE_Model_Inference.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public_models/Vilar-Oscillator.proj/Vilar_Oscillator.wkgp/Vilar_Oscillator_SCIOPE_Model_Inference.ipynb b/public_models/Vilar-Oscillator.proj/Vilar_Oscillator.wkgp/Vilar_Oscillator_SCIOPE_Model_Inference.ipynb index 66cf194f3f..2f321f3b77 100644 --- a/public_models/Vilar-Oscillator.proj/Vilar_Oscillator.wkgp/Vilar_Oscillator_SCIOPE_Model_Inference.ipynb +++ b/public_models/Vilar-Oscillator.proj/Vilar_Oscillator.wkgp/Vilar_Oscillator_SCIOPE_Model_Inference.ipynb @@ -183,7 +183,7 @@ "metadata": {}, "outputs": [], "source": [ - "model = VilarOscillator1()" + "model = create_vilar_oscillator()" ] }, { From 2b4d21d845cd5c9bf4d9e0de2b90cea7a90bed38 Mon Sep 17 00:00:00 2001 From: Bryan Rumsey Date: Mon, 22 Aug 2022 22:01:31 -0400 Subject: [PATCH 4/5] Fixed file cleanup. --- stochss/handlers/util/stochss_notebook.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stochss/handlers/util/stochss_notebook.py b/stochss/handlers/util/stochss_notebook.py index 36cd304ded..c65a42675a 100644 --- a/stochss/handlers/util/stochss_notebook.py +++ b/stochss/handlers/util/stochss_notebook.py @@ -121,7 +121,11 @@ def __create_configuration_cell(self): else: commented = False start = f"{pad}# " if commented else pad - config.append(f"{start}solver = {self.settings['solver']}(model=model)") + if self.nb_type > self.PARAMETER_SWEEP_2D: + del_dir = ", delete_directory=False" + else: + del_dir = "" + config.append(f"{start}solver = {self.settings['solver']}(model=model{del_dir})") config.append(pad + "kwargs = {") if self.s_model['is_spatial']: settings = self.__get_spatialpy_run_setting() From ca7909b58469c8f56ad9e19b3f72dbbc01f68b26 Mon Sep 17 00:00:00 2001 From: Bryan Rumsey Date: Mon, 22 Aug 2022 22:08:59 -0400 Subject: [PATCH 5/5] Fixed file cleanup take two. --- stochss/handlers/util/stochss_notebook.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stochss/handlers/util/stochss_notebook.py b/stochss/handlers/util/stochss_notebook.py index c65a42675a..3bc1486976 100644 --- a/stochss/handlers/util/stochss_notebook.py +++ b/stochss/handlers/util/stochss_notebook.py @@ -121,7 +121,7 @@ def __create_configuration_cell(self): else: commented = False start = f"{pad}# " if commented else pad - if self.nb_type > self.PARAMETER_SWEEP_2D: + if self.nb_type in (self.MODEL_EXPLORATION, self.MODEL_INFERENCE): del_dir = ", delete_directory=False" else: del_dir = ""