Skip to content

Commit

Permalink
Unified pylab imports
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterMeisrimelModelon committed Jan 24, 2024
1 parent e8f9624 commit f9fa119
Show file tree
Hide file tree
Showing 45 changed files with 352 additions and 352 deletions.
14 changes: 7 additions & 7 deletions examples/cvode_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ def f(t,y):

#Plot
if with_plots:
import pylab as P
P.plot(t1, y1, color="b")
P.plot(t2, y2, color="r")
P.title(exp_mod.name)
P.ylabel('y')
P.xlabel('Time')
P.show()
import pylab as pl
pl.plot(t1, y1, color="b")
pl.plot(t2, y2, color="r")
pl.title(exp_mod.name)
pl.ylabel('y')
pl.xlabel('Time')
pl.show()

#Basic test
nose.tools.assert_almost_equal(y2[-1][0], 0.00347746, 5)
Expand Down
12 changes: 6 additions & 6 deletions examples/cvode_basic_backward.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ def f(t,y):

#Plot
if with_plots:
import pylab as P
P.plot(t, y, color="b")
P.title(exp_mod.name)
P.ylabel('y')
P.xlabel('Time')
P.show()
import pylab as pl
pl.plot(t, y, color="b")
pl.title(exp_mod.name)
pl.ylabel('y')
pl.xlabel('Time')
pl.show()

#Basic test
nose.tools.assert_almost_equal(y[-1][0], 4.00000000, 3)
Expand Down
12 changes: 6 additions & 6 deletions examples/cvode_gyro.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ def f(t, u):

# Plot
if with_plots:
import pylab as P
P.plot(t, y/10000.)
P.xlabel('Time')
P.ylabel('States, scaled by $10^4$')
P.title(exp_mod.name)
P.show()
import pylab as pl
pl.plot(t, y/10000.)
pl.xlabel('Time')
pl.ylabel('States, scaled by $10^4$')
pl.title(exp_mod.name)
pl.show()

#Basic tests
nose.tools.assert_almost_equal(y[-1][0], 692.800241862)
Expand Down
20 changes: 10 additions & 10 deletions examples/cvode_stability.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@ def f(t,y):

#Plot
if with_plots:
import pylab as P
P.subplot(211)
P.plot(t,y[:,2])
P.ylabel("State: $y_1$")
P.subplot(212)
P.plot(t,exp_mod.order)
P.ylabel("Order")
P.suptitle(exp_mod.name)
P.xlabel("Time")
P.show()
import pylab as pl
pl.subplot(211)
pl.plot(t,y[:,2])
pl.ylabel("State: $y_1$")
pl.subplot(212)
pl.plot(t,exp_mod.order)
pl.ylabel("Order")
pl.suptitle(exp_mod.name)
pl.xlabel("Time")
pl.show()

#Basic test
x1 = y[:,0]
Expand Down
12 changes: 6 additions & 6 deletions examples/cvode_with_disc.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ def run_example(with_plots=True):

#Plot
if with_plots:
import pylab as P
P.plot(t,y)
P.title(exp_mod.name)
P.ylabel('States')
P.xlabel('Time')
P.show()
import pylab as pl
pl.plot(t,y)
pl.title(exp_mod.name)
pl.ylabel('States')
pl.xlabel('Time')
pl.show()

#Basic test
nose.tools.assert_almost_equal(y[-1][0],8.0)
Expand Down
38 changes: 19 additions & 19 deletions examples/cvode_with_initial_sensitivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,39 +88,39 @@ def f(t, y, p):

#Plot
if with_plots:
import pylab as P
import pylab as pl
title_text=r"Sensitivity w.r.t. ${}$"
legend_text=r"$\mathrm{{d}}{}/\mathrm{{d}}{}$"
P.figure(1)
P.subplot(221)
P.plot(t, np.array(exp_sim.p_sol[0])[:,0],
pl.figure(1)
pl.subplot(221)
pl.plot(t, np.array(exp_sim.p_sol[0])[:,0],
t, np.array(exp_sim.p_sol[0])[:,1],
t, np.array(exp_sim.p_sol[0])[:,2])
P.title(title_text.format('p_1'))
P.legend((legend_text.format('y_1','p_1'),
pl.title(title_text.format('p_1'))
pl.legend((legend_text.format('y_1','p_1'),
legend_text.format('y_1','p_2'),
legend_text.format('y_1','p_3')))
P.subplot(222)
P.plot(t, np.array(exp_sim.p_sol[1])[:,0],
pl.subplot(222)
pl.plot(t, np.array(exp_sim.p_sol[1])[:,0],
t, np.array(exp_sim.p_sol[1])[:,1],
t, np.array(exp_sim.p_sol[1])[:,2])
P.title(title_text.format('p_2'))
P.legend((legend_text.format('y_2','p_1'),
pl.title(title_text.format('p_2'))
pl.legend((legend_text.format('y_2','p_1'),
legend_text.format('y_2','p_2'),
legend_text.format('y_2','p_3')))
P.subplot(223)
P.plot(t, np.array(exp_sim.p_sol[2])[:,0],
pl.subplot(223)
pl.plot(t, np.array(exp_sim.p_sol[2])[:,0],
t, np.array(exp_sim.p_sol[2])[:,1],
t, np.array(exp_sim.p_sol[2])[:,2])
P.title(title_text.format('p_3'))
P.legend((legend_text.format('y_3','p_1'),
pl.title(title_text.format('p_3'))
pl.legend((legend_text.format('y_3','p_1'),
legend_text.format('y_3','p_2'),
legend_text.format('y_3','p_3')))
P.subplot(224)
P.title('ODE Solution')
P.plot(t, y)
P.suptitle(exp_mod.name)
P.show()
pl.subplot(224)
pl.title('ODE Solution')
pl.plot(t, y)
pl.suptitle(exp_mod.name)
pl.show()

#Basic test
nose.tools.assert_almost_equal(y[-1][0], 1577.6552477, 5)
Expand Down
12 changes: 6 additions & 6 deletions examples/cvode_with_jac.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ def jac(t,y):

#Plot
if with_plots:
import pylab as P
P.plot(t,y,linestyle="dashed",marker="o") #Plot the solution
P.xlabel('Time')
P.ylabel('State')
P.title(exp_mod.name)
P.show()
import pylab as pl
pl.plot(t,y,linestyle="dashed",marker="o") #Plot the solution
pl.xlabel('Time')
pl.ylabel('State')
pl.title(exp_mod.name)
pl.show()

#Basic tests
nose.tools.assert_almost_equal(y[-1][0],-121.75000000,4)
Expand Down
12 changes: 6 additions & 6 deletions examples/cvode_with_jac_sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ def jac(t,y):

#Plot
if with_plots:
import pylab as P
P.plot(t,y[:,1],linestyle="dashed",marker="o") #Plot the solution
P.xlabel('Time')
P.ylabel('State')
P.title(exp_mod.name)
P.show()
import pylab as pl
pl.plot(t,y[:,1],linestyle="dashed",marker="o") #Plot the solution
pl.xlabel('Time')
pl.ylabel('State')
pl.title(exp_mod.name)
pl.show()

#Basic tests
nose.tools.assert_almost_equal(y[-1][0],0.9851,3)
Expand Down
12 changes: 6 additions & 6 deletions examples/cvode_with_jac_spgmr.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ def jacv(t,y,fy,v):

#Plot
if with_plots:
import pylab as P
P.plot(t,y)
P.xlabel('Time')
P.ylabel('State')
P.title(exp_mod.name)
P.show()
import pylab as pl
pl.plot(t,y)
pl.xlabel('Time')
pl.ylabel('State')
pl.title(exp_mod.name)
pl.show()

#Basic tests
nose.tools.assert_almost_equal(y[-1][0],-121.75000000,4)
Expand Down
12 changes: 6 additions & 6 deletions examples/cvode_with_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ def f(t, y, p):

#Plot
if with_plots:
import pylab as P
P.plot(t, y)
P.title(exp_mod.name)
P.xlabel('Time')
P.ylabel('State')
P.show()
import pylab as pl
pl.plot(t, y)
pl.title(exp_mod.name)
pl.xlabel('Time')
pl.ylabel('State')
pl.show()

#Basic test
nose.tools.assert_almost_equal(y[-1][0], 9.05518032e-01, 4)
Expand Down
12 changes: 6 additions & 6 deletions examples/cvode_with_parameters_fcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ def fsens(t, y, s, p):

#Plot
if with_plots:
import pylab as P
P.plot(t, y)
P.title(exp_mod.name)
P.xlabel('Time')
P.ylabel('State')
P.show()
import pylab as pl
pl.plot(t, y)
pl.title(exp_mod.name)
pl.xlabel('Time')
pl.ylabel('State')
pl.show()

#Basic test
nose.tools.assert_almost_equal(y[-1][0], 9.05518032e-01, 4)
Expand Down
12 changes: 6 additions & 6 deletions examples/cvode_with_parameters_modified.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ def f(t, y, p):

#Plot
if with_plots:
import pylab as P
P.plot(t, y)
P.xlabel('Time')
P.ylabel('State')
P.title(exp_mod.name)
P.show()
import pylab as pl
pl.plot(t, y)
pl.xlabel('Time')
pl.ylabel('State')
pl.title(exp_mod.name)
pl.show()

#Basic test
nose.tools.assert_almost_equal(y[-1][0], 9.05518032e-01, 4)
Expand Down
14 changes: 7 additions & 7 deletions examples/dasp3_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ def dzdt(t,y,z):

#Plot
if with_plots:
import pylab as P
P.semilogy(t, y, color="b")
P.grid()
P.title(exp_mod.name+r' $\varepsilon = \frac{1}{3} 10^{-3}$')
P.xlabel('Time')
P.ylabel('y')
P.show()
import pylab as pl
pl.semilogy(t, y, color="b")
pl.grid()
pl.title(exp_mod.name+r' $\varepsilon = \frac{1}{3} 10^{-3}$')
pl.xlabel('Time')
pl.ylabel('y')
pl.show()

#Basic test
nose.tools.assert_almost_equal(y[-1,0], 10.860063849896818, 3)
Expand Down
12 changes: 6 additions & 6 deletions examples/dopri5_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ def f(t,y):

#Plot
if with_plots:
import pylab as P
P.plot(t,y)
P.title(exp_mod.name)
P.xlabel('Time')
P.ylabel('State')
P.show()
import pylab as pl
pl.plot(t,y)
pl.title(exp_mod.name)
pl.xlabel('Time')
pl.ylabel('State')
pl.show()

#Basic test
nose.tools.assert_almost_equal(y[-1][0],0.02695199,5)
Expand Down
12 changes: 6 additions & 6 deletions examples/dopri5_with_disc.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ def run_example(with_plots=True):

#Plot
if with_plots:
import pylab as P
P.plot(t,y)
P.title(exp_mod.name)
P.ylabel('States')
P.xlabel('Time')
P.show()
import pylab as pl
pl.plot(t,y)
pl.title(exp_mod.name)
pl.ylabel('States')
pl.xlabel('Time')
pl.show()

#Basic test
nose.tools.assert_almost_equal(y[-1][0],8.0)
Expand Down
14 changes: 7 additions & 7 deletions examples/euler_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ def f(t,y):

#Plot
if with_plots:
import pylab as P
P.plot(t1, y1, color="b")
P.plot(t2, y2, color="r")
P.title(exp_mod.name)
P.ylabel('y')
P.xlabel('Time')
P.show()
import pylab as pl
pl.plot(t1, y1, color="b")
pl.plot(t2, y2, color="r")
pl.title(exp_mod.name)
pl.ylabel('y')
pl.xlabel('Time')
pl.show()

#Basic test
nose.tools.assert_almost_equal(y2[-1][0], 0.02628193)
Expand Down
12 changes: 6 additions & 6 deletions examples/euler_vanderpol.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ def jac(t,y):

#Plot
if with_plots:
import pylab as P
P.plot(t,y[:,0], marker='o')
P.title(exp_mod.name)
P.ylabel("State: $y_1$")
P.xlabel("Time")
P.show()
import pylab as pl
pl.plot(t,y[:,0], marker='o')
pl.title(exp_mod.name)
pl.ylabel("State: $y_1$")
pl.xlabel("Time")
pl.show()

#Basic test
x1 = y[:,0]
Expand Down
12 changes: 6 additions & 6 deletions examples/euler_with_disc.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ def run_example(with_plots=True):

#Plot
if with_plots:
import pylab as P
P.plot(t,y)
P.title("Solution of a differential equation with discontinuities")
P.ylabel('States')
P.xlabel('Time')
P.show()
import pylab as pl
pl.plot(t,y)
pl.title("Solution of a differential equation with discontinuities")
pl.ylabel('States')
pl.xlabel('Time')
pl.show()

#Basic test
nose.tools.assert_almost_equal(y[-1][0],8.0)
Expand Down
Loading

0 comments on commit f9fa119

Please sign in to comment.