From 5c38d4f3f7a29fe5e8c0c5a42ff105f6361af71d Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Mon, 22 Jan 2024 20:54:52 +0100 Subject: [PATCH 1/3] escape latex labels --- examples/genswitch.py | 2 +- examples/kincar-flatsys.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/genswitch.py b/examples/genswitch.py index e65e40110..58040cb3a 100644 --- a/examples/genswitch.py +++ b/examples/genswitch.py @@ -60,7 +60,7 @@ def genswitch(y, t, mu=4, n=2): # set(pl, 'LineWidth', AM_data_linewidth) plt.axis([0, 25, 0, 5]) -plt.xlabel('Time {\itt} [scaled]') +plt.xlabel('Time {\\itt} [scaled]') plt.ylabel('Protein concentrations [scaled]') plt.legend(('z1 (A)', 'z2 (B)')) # 'Orientation', 'horizontal') # legend(legh, 'boxoff') diff --git a/examples/kincar-flatsys.py b/examples/kincar-flatsys.py index b61a9e1c5..56b5672ee 100644 --- a/examples/kincar-flatsys.py +++ b/examples/kincar-flatsys.py @@ -100,8 +100,8 @@ def plot_results(t, x, ud, rescale=True): plt.subplot(2, 4, 8) plt.plot(t, ud[1]) - plt.xlabel('Ttime t [sec]') - plt.ylabel('$\delta$ [rad]') + plt.xlabel('Time t [sec]') + plt.ylabel('$\\delta$ [rad]') plt.tight_layout() # From 99e56f8f0dfb4a33600a08a0689828b0610472ec Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Mon, 22 Jan 2024 20:55:22 +0100 Subject: [PATCH 2/3] Use Numpy API for pi instead of undocumented scipy.pi --- examples/type2_type3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/type2_type3.py b/examples/type2_type3.py index 250aa266c..52e0645e2 100644 --- a/examples/type2_type3.py +++ b/examples/type2_type3.py @@ -5,7 +5,7 @@ import os import matplotlib.pyplot as plt # Grab MATLAB plotting functions from control.matlab import * # MATLAB-like functions -from scipy import pi +from numpy import pi integrator = tf([0, 1], [1, 0]) # 1/s # Parameters defining the system From 2c32913bf38285f24e554fd3b9892ae070d13044 Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Mon, 22 Jan 2024 21:52:22 +0100 Subject: [PATCH 3/3] Update notebooks (no rerun, no output change) --- examples/bode-and-nyquist-plots.ipynb | 9 +++++---- examples/singular-values-plot.ipynb | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/bode-and-nyquist-plots.ipynb b/examples/bode-and-nyquist-plots.ipynb index 6ac74f34e..a38275a92 100644 --- a/examples/bode-and-nyquist-plots.ipynb +++ b/examples/bode-and-nyquist-plots.ipynb @@ -16,6 +16,7 @@ "metadata": {}, "outputs": [], "source": [ + "import numpy as np\n", "import scipy as sp\n", "import matplotlib.pyplot as plt\n", "import control as ct" @@ -109,9 +110,9 @@ "w001rad = 1. # 1 rad/s\n", "w010rad = 10. # 10 rad/s\n", "w100rad = 100. # 100 rad/s\n", - "w001hz = 2*sp.pi*1. # 1 Hz\n", - "w010hz = 2*sp.pi*10. # 10 Hz\n", - "w100hz = 2*sp.pi*100. # 100 Hz\n", + "w001hz = 2*np.pi*1. # 1 Hz\n", + "w010hz = 2*np.pi*10. # 10 Hz\n", + "w100hz = 2*np.pi*100. # 100 Hz\n", "# First order systems\n", "pt1_w001rad = ct.tf([1.], [1./w001rad, 1.], name='pt1_w001rad')\n", "display(pt1_w001rad)\n", @@ -153,7 +154,7 @@ ], "source": [ "sampleTime = 0.001\n", - "display('Nyquist frequency: {:.0f} Hz, {:.0f} rad/sec'.format(1./sampleTime /2., 2*sp.pi*1./sampleTime /2.))" + "display('Nyquist frequency: {:.0f} Hz, {:.0f} rad/sec'.format(1./sampleTime /2., 2*np.pi*1./sampleTime /2.))" ] }, { diff --git a/examples/singular-values-plot.ipynb b/examples/singular-values-plot.ipynb index f126c6c3f..676c76916 100644 --- a/examples/singular-values-plot.ipynb +++ b/examples/singular-values-plot.ipynb @@ -90,7 +90,7 @@ ], "source": [ "sampleTime = 10\n", - "display('Nyquist frequency: {:.4f} Hz, {:.4f} rad/sec'.format(1./sampleTime /2., 2*sp.pi*1./sampleTime /2.))" + "display('Nyquist frequency: {:.4f} Hz, {:.4f} rad/sec'.format(1./sampleTime /2., 2*np.pi*1./sampleTime /2.))" ] }, {