diff --git a/examples/Analysis-of-Immune-Response-Pneumocci.ipynb b/examples/Analysis-of-Immune-Response-Pneumocci.ipynb index 89c535c..22ce4e4 100644 --- a/examples/Analysis-of-Immune-Response-Pneumocci.ipynb +++ b/examples/Analysis-of-Immune-Response-Pneumocci.ipynb @@ -449,6 +449,13 @@ "\"drawing\"\n" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The dynamics are preserved when we change the set point." + ] + }, { "cell_type": "code", "execution_count": 23, diff --git a/examples/Analysis-of-mTOR.ipynb b/examples/Analysis-of-mTOR.ipynb index 723abfa..10129e6 100644 --- a/examples/Analysis-of-mTOR.ipynb +++ b/examples/Analysis-of-mTOR.ipynb @@ -608,6 +608,49 @@ "source": [ "_ = CTLSB.plotDesign(kP_spec=CTLSB.kP, kI_spec=CTLSB.kI, setpoint=80)" ] + }, + { + "cell_type": "markdown", + "id": "3efeb9bb-77d1-4d62-8b87-b592de66bb25", + "metadata": {}, + "source": [ + "# Effect of Noise" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "7cdae250-12cb-42c1-b2b4-6757b2f5e85b", + "metadata": {}, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'ControlSBML' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[1], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m ctlsb \u001b[38;5;241m=\u001b[39m \u001b[43mControlSBML\u001b[49m(URL, figsize\u001b[38;5;241m=\u001b[39m(\u001b[38;5;241m5\u001b[39m, \u001b[38;5;241m5\u001b[39m), times\u001b[38;5;241m=\u001b[39mnp\u001b[38;5;241m.\u001b[39mlinspace(\u001b[38;5;241m0\u001b[39m, \u001b[38;5;241m3000\u001b[39m, \u001b[38;5;241m30000\u001b[39m),\n\u001b[1;32m 2\u001b[0m markers\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m, xlabel_angle\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m45\u001b[39m,\n\u001b[1;32m 3\u001b[0m input_name\u001b[38;5;241m=\u001b[39mINPUT_NAME, output_name\u001b[38;5;241m=\u001b[39mOUTPUT_NAME)\n", + "\u001b[0;31mNameError\u001b[0m: name 'ControlSBML' is not defined" + ] + } + ], + "source": [ + "%%time\n", + "noise_spec = ctl.NoiseSpec(random_mag=5, random_std=0.1, offset=1)\n", + "ctlsb = ControlSBML(URL, figsize=(5, 5), times=np.linspace(0, 3000, 30000),\n", + " markers=False, xlabel_angle=45,\n", + " input_name=INPUT_NAME, output_name=OUTPUT_NAME,\n", + " noise_spec=noise_spec)\n", + "grid = ctlsb.getGrid(kP_spec=True, kI_spec=True, num_coordinate=11)\n", + "axis = grid.getAxis(\"kP\", min)\n", + "axis.setMinValue(0.1)\n", + "axis.setMaxValue(2)\n", + "axis = GRID.getAxis(\"kI\")\n", + "axis.setMinValue(0.001)\n", + "axis.setMaxValue(0.01)\n", + "_ = ctlsb.plotGridDesign(GRID, setpoint=120, times=np.linspace(0, 3000, 30000))" + ] } ], "metadata": { diff --git a/src/controlSBML/sbml_system.py b/src/controlSBML/sbml_system.py index b3d981a..da47008 100644 --- a/src/controlSBML/sbml_system.py +++ b/src/controlSBML/sbml_system.py @@ -543,7 +543,8 @@ def plotSISOClosedLoop(self, timeseries:Timeseries, setpoint, selections=None, df = pd.DataFrame(timeseries[columns], columns=columns) # Plot the other left axis lines if cn.O_LEGEND in new_kwargs.keys(): - new_kwargs[cn.O_LEGEND].append(cn.O_SETPOINT) + if isinstance(new_kwargs[cn.O_LEGEND], list): + new_kwargs[cn.O_LEGEND].append(cn.O_SETPOINT) new_kwargs.setdefault(cn.O_AX2, 0) plot_result = util.plotOneTS(df, colors=colors, **new_kwargs) ax = plot_result.ax