From b73d913770cb06beee5ebb8deff244d68878c38c Mon Sep 17 00:00:00 2001
From: PeterMeisrimelModelon
<92585725+PeterMeisrimelModelon@users.noreply.github.com>
Date: Fri, 12 Jan 2024 17:22:53 +0100
Subject: [PATCH] Fixing DeprecationWarnings + various typos; fixed Radar
solver statistics
---
examples/cvode_basic.py | 2 +-
examples/cvode_basic_backward.py | 2 +-
examples/cvode_stability.py | 2 +-
examples/cvode_with_disc.py | 2 +-
examples/cvode_with_parameters.py | 2 +-
examples/cvode_with_parameters_fcn.py | 2 +-
examples/cvode_with_parameters_modified.py | 3 +-
examples/cvode_with_preconditioning.py | 4 +--
examples/dopri5_basic.py | 2 +-
examples/dopri5_with_disc.py | 5 +--
examples/euler_basic.py | 2 +-
examples/euler_vanderpol.py | 1 -
examples/euler_with_disc.py | 4 +--
examples/glimda_vanderpol.py | 2 +-
examples/ida_basic_backward.py | 2 +-
examples/ida_with_disc.py | 7 +---
examples/ida_with_initial_sensitivity.py | 2 +-
examples/ida_with_jac.py | 1 -
examples/ida_with_parameters.py | 1 -
.../ida_with_user_defined_handle_result.py | 2 --
examples/kinsol_basic.py | 2 --
examples/kinsol_ors.py | 8 ++---
examples/kinsol_with_jac.py | 1 -
examples/lsodar_bouncing_ball.py | 7 +---
examples/lsodar_vanderpol.py | 2 +-
examples/lsodar_with_disc.py | 2 +-
examples/mech_system_pendulum.py | 2 --
examples/radau5ode_with_disc.py | 4 +--
examples/radau5ode_with_disc_sparse.py | 7 ++--
examples/radau5ode_with_jac_sparse.py | 4 +--
examples/rodasode_vanderpol.py | 1 -
examples/rungekutta34_basic.py | 2 +-
examples/rungekutta34_with_disc.py | 2 +-
examples/rungekutta4_basic.py | 2 +-
src/explicit_ode.pyx | 2 +-
src/solvers/radar5.py | 36 +++++++++----------
tests/solvers/test_odepack.py | 2 +-
tests/solvers/test_radau5.py | 2 +-
38 files changed, 52 insertions(+), 86 deletions(-)
diff --git a/examples/cvode_basic.py b/examples/cvode_basic.py
index 02735626..c17cf024 100644
--- a/examples/cvode_basic.py
+++ b/examples/cvode_basic.py
@@ -66,7 +66,7 @@ def f(t,y):
P.show()
#Basic test
- nose.tools.assert_almost_equal(float(y2[-1]), 0.00347746, 5)
+ nose.tools.assert_almost_equal(y2[-1][0], 0.00347746, 5)
nose.tools.assert_almost_equal(exp_sim.get_last_step(), 0.0222169642893, 3)
return exp_mod, exp_sim
diff --git a/examples/cvode_basic_backward.py b/examples/cvode_basic_backward.py
index c033533d..c299a19c 100644
--- a/examples/cvode_basic_backward.py
+++ b/examples/cvode_basic_backward.py
@@ -62,7 +62,7 @@ def f(t,y):
P.show()
#Basic test
- nose.tools.assert_almost_equal(float(y[-1]), 4.00000000, 3)
+ nose.tools.assert_almost_equal(y[-1][0], 4.00000000, 3)
return exp_mod, exp_sim
diff --git a/examples/cvode_stability.py b/examples/cvode_stability.py
index 1386c275..3c12ca16 100644
--- a/examples/cvode_stability.py
+++ b/examples/cvode_stability.py
@@ -68,7 +68,7 @@ def f(t,y):
exp_sim = CVode(exp_mod) #Create a CVode solver
#Sets the parameters
- exp_sim.stablimdet = True
+ exp_sim.stablimit = True
exp_sim.report_continuously = True
#Simulate
diff --git a/examples/cvode_with_disc.py b/examples/cvode_with_disc.py
index d7233635..26f409ca 100644
--- a/examples/cvode_with_disc.py
+++ b/examples/cvode_with_disc.py
@@ -84,7 +84,7 @@ def handle_event(self, solver, event_info):
event_info = self.check_eIter(b_mode, a_mode)
- if not True in event_info: #Breaks the iteration loop
+ if True not in event_info: #Breaks the iteration loop
break
#Helper function for handle_event
diff --git a/examples/cvode_with_parameters.py b/examples/cvode_with_parameters.py
index 5fd06929..9388ce3e 100644
--- a/examples/cvode_with_parameters.py
+++ b/examples/cvode_with_parameters.py
@@ -70,7 +70,7 @@ def f(t, y, p):
exp_sim.discr = 'BDF'
exp_sim.rtol = 1.e-4
exp_sim.atol = N.array([1.0e-8, 1.0e-14, 1.0e-6])
- exp_sim.sensmethod = 'SIMULTANEOUS' #Defines the sensitvity method used
+ exp_sim.sensmethod = 'SIMULTANEOUS' #Defines the sensitivity method used
exp_sim.suppress_sens = False #Dont suppress the sensitivity variables in the error test.
exp_sim.report_continuously = True
diff --git a/examples/cvode_with_parameters_fcn.py b/examples/cvode_with_parameters_fcn.py
index 6ed376b2..8e1f95b5 100644
--- a/examples/cvode_with_parameters_fcn.py
+++ b/examples/cvode_with_parameters_fcn.py
@@ -87,7 +87,7 @@ def fsens(t, y, s, p):
exp_sim.discr = 'BDF'
exp_sim.rtol = 1.e-4
exp_sim.atol = N.array([1.0e-8, 1.0e-14, 1.0e-6])
- exp_sim.sensmethod = 'SIMULTANEOUS' #Defines the sensitvity method used
+ exp_sim.sensmethod = 'SIMULTANEOUS' #Defines the sensitivity method used
exp_sim.suppress_sens = False #Dont suppress the sensitivity variables in the error test.
exp_sim.report_continuously = True
diff --git a/examples/cvode_with_parameters_modified.py b/examples/cvode_with_parameters_modified.py
index ead720fd..2510c1ee 100644
--- a/examples/cvode_with_parameters_modified.py
+++ b/examples/cvode_with_parameters_modified.py
@@ -68,7 +68,7 @@ def f(t, y, p):
exp_sim.discr = 'BDF'
exp_sim.rtol = 1.e-4
exp_sim.atol = N.array([1.0e-8, 1.0e-14, 1.0e-6])
- exp_sim.sensmethod = 'SIMULTANEOUS' #Defines the sensitvity method used
+ exp_sim.sensmethod = 'SIMULTANEOUS' #Defines the sensitivity method used
exp_sim.suppress_sens = False #Dont suppress the sensitivity variables in the error test.
exp_sim.report_continuously = True
@@ -95,4 +95,3 @@ def f(t, y, p):
if __name__=='__main__':
mod,sim = run_example()
-
diff --git a/examples/cvode_with_preconditioning.py b/examples/cvode_with_preconditioning.py
index bcda7a34..e497a19a 100644
--- a/examples/cvode_with_preconditioning.py
+++ b/examples/cvode_with_preconditioning.py
@@ -53,7 +53,7 @@ def prec_setup(t, y, fy, jok, gamma, data):
A = np.array([[2.0, 1.0], [3.0, 2.0]])
#If jok is false the jacobian data needs to be recomputed
- if jok == False:
+ if jok is False:
#Extract the diagonal of the jacobian to form a Jacobi preconditioner
a0 = A[0, 0] * t * np.cos(y[0])
@@ -64,7 +64,7 @@ def prec_setup(t, y, fy, jok, gamma, data):
return [True, a]
#If jok is true the existing jacobian data can be reused
- if jok == True:
+ if jok is True:
#Return false (jacobian data was reused) and the old data
return [False, data]
diff --git a/examples/dopri5_basic.py b/examples/dopri5_basic.py
index 66ecbe55..35d50b7b 100644
--- a/examples/dopri5_basic.py
+++ b/examples/dopri5_basic.py
@@ -56,7 +56,7 @@ def f(t,y):
P.show()
#Basic test
- nose.tools.assert_almost_equal(float(y[-1]),0.02695199,5)
+ nose.tools.assert_almost_equal(y[-1][0],0.02695199,5)
return exp_mod, exp_sim
diff --git a/examples/dopri5_with_disc.py b/examples/dopri5_with_disc.py
index 8ce9eca0..3d50ed45 100644
--- a/examples/dopri5_with_disc.py
+++ b/examples/dopri5_with_disc.py
@@ -84,7 +84,7 @@ def handle_event(self, solver, event_info):
event_info = self.check_eIter(b_mode, a_mode)
- if not True in event_info: #Breaks the iteration loop
+ if True not in event_info: #Breaks the iteration loop
break
#Helper function for handle_event
@@ -163,6 +163,3 @@ def run_example(with_plots=True):
if __name__=="__main__":
mod,sim = run_example()
-
-
-
diff --git a/examples/euler_basic.py b/examples/euler_basic.py
index 5fece093..bb2b73aa 100644
--- a/examples/euler_basic.py
+++ b/examples/euler_basic.py
@@ -61,7 +61,7 @@ def f(t,y):
P.show()
#Basic test
- nose.tools.assert_almost_equal(float(y2[-1]), 0.02628193)
+ nose.tools.assert_almost_equal(y2[-1][0], 0.02628193)
return exp_mod, exp_sim
diff --git a/examples/euler_vanderpol.py b/examples/euler_vanderpol.py
index e5af0d89..a24c764b 100644
--- a/examples/euler_vanderpol.py
+++ b/examples/euler_vanderpol.py
@@ -92,4 +92,3 @@ def jac(t,y):
if __name__=='__main__':
mod,sim = run_example()
-
diff --git a/examples/euler_with_disc.py b/examples/euler_with_disc.py
index 76504004..9d64948e 100644
--- a/examples/euler_with_disc.py
+++ b/examples/euler_with_disc.py
@@ -84,7 +84,7 @@ def handle_event(self, solver, event_info):
event_info = self.check_eIter(b_mode, a_mode)
- if not True in event_info: #Breaks the iteration loop
+ if True not in event_info: #Breaks the iteration loop
break
#Helper function for handle_event
@@ -121,8 +121,6 @@ def init_mode(self, solver):
solver.y[1] = (-1.0 if solver.sw[1] else 3.0)
solver.y[2] = (0.0 if solver.sw[2] else 2.0)
-
-
def run_example(with_plots=True):
r"""
Example of the use of Euler's method for a differential equation
diff --git a/examples/glimda_vanderpol.py b/examples/glimda_vanderpol.py
index a7a1a531..3bf01976 100644
--- a/examples/glimda_vanderpol.py
+++ b/examples/glimda_vanderpol.py
@@ -17,7 +17,7 @@
import numpy as N
import nose
-from assimulo.solvers import GLIMDA,IDA
+from assimulo.solvers import GLIMDA
from assimulo.problem import Implicit_Problem
def run_example(with_plots=True):
diff --git a/examples/ida_basic_backward.py b/examples/ida_basic_backward.py
index 62feaad0..7a34bb15 100644
--- a/examples/ida_basic_backward.py
+++ b/examples/ida_basic_backward.py
@@ -62,7 +62,7 @@ def f(t,y,yd):
P.show()
#Basic test
- nose.tools.assert_almost_equal(float(y[-1]), 4.00000000, 3)
+ nose.tools.assert_almost_equal(y[-1][0], 4.00000000, 3)
return imp_mod, imp_sim
diff --git a/examples/ida_with_disc.py b/examples/ida_with_disc.py
index 39472750..152763a3 100644
--- a/examples/ida_with_disc.py
+++ b/examples/ida_with_disc.py
@@ -87,7 +87,7 @@ def handle_event(self, solver, event_info):
event_info = self.check_eIter(b_mode, a_mode)
- if not True in event_info: #Breaks the iteration loop
+ if True not in event_info: #Breaks the iteration loop
break
#Helper function for handle_event
@@ -125,8 +125,6 @@ def init_mode(self, solver):
#see SUNDIALS IDA documentation
#on the option 'IDA_YA_YDP_INIT'
-
-
def run_example(with_plots=True):
r"""
Example of the use of IDA for an implicit differential equation
@@ -168,6 +166,3 @@ def run_example(with_plots=True):
if __name__=="__main__":
mod,sim = run_example()
-
-
-
diff --git a/examples/ida_with_initial_sensitivity.py b/examples/ida_with_initial_sensitivity.py
index b8fbb3c9..bf3b3813 100644
--- a/examples/ida_with_initial_sensitivity.py
+++ b/examples/ida_with_initial_sensitivity.py
@@ -79,7 +79,7 @@ def f(t, y, yd,p):
imp_sim.atol = 1e-6
imp_sim.pbar = [1,1,1] #pbar is used to estimate the tolerances for the parameters
imp_sim.report_continuously = True #Need to be able to store the result using the interpolate methods
- imp_sim.sensmethod = 'SIMULTANEOUS' #Defines the sensitvity method used
+ imp_sim.sensmethod = 'SIMULTANEOUS' #Defines the sensitivity method used
imp_sim.suppress_sens = False #Dont suppress the sensitivity variables in the error test.
#Simulate
diff --git a/examples/ida_with_jac.py b/examples/ida_with_jac.py
index 74487e61..577e54b9 100644
--- a/examples/ida_with_jac.py
+++ b/examples/ida_with_jac.py
@@ -125,4 +125,3 @@ def jac(c,t,y,yd):
if __name__=='__main__':
mod,sim = run_example()
-
diff --git a/examples/ida_with_parameters.py b/examples/ida_with_parameters.py
index 454eea7a..4a7198be 100644
--- a/examples/ida_with_parameters.py
+++ b/examples/ida_with_parameters.py
@@ -98,4 +98,3 @@ def f(t, y, yd, p):
if __name__=='__main__':
mod,sim = run_example()
-
diff --git a/examples/ida_with_user_defined_handle_result.py b/examples/ida_with_user_defined_handle_result.py
index 2775b78e..09e76ad8 100644
--- a/examples/ida_with_user_defined_handle_result.py
+++ b/examples/ida_with_user_defined_handle_result.py
@@ -115,7 +115,5 @@ def handle_result(solver, t ,y, yd):
return imp_mod, imp_sim
-
if __name__=='__main__':
mod,sim = run_example()
-
diff --git a/examples/kinsol_basic.py b/examples/kinsol_basic.py
index 9bbb763b..9144d78a 100644
--- a/examples/kinsol_basic.py
+++ b/examples/kinsol_basic.py
@@ -15,7 +15,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see .
-import numpy as N
import nose
from assimulo.solvers import KINSOL
from assimulo.problem import Algebraic_Problem
@@ -53,4 +52,3 @@ def res(y):
if __name__=='__main__':
mod, solv = run_example()
-
diff --git a/examples/kinsol_ors.py b/examples/kinsol_ors.py
index 3cb2b6f7..61776049 100644
--- a/examples/kinsol_ors.py
+++ b/examples/kinsol_ors.py
@@ -16,7 +16,6 @@
# along with this program. If not, see .
import numpy as N
-import scipy as S
import scipy.linalg as LIN
import scipy.io as IO
import scipy.sparse as SPARSE
@@ -79,7 +78,7 @@ def prec_setup(u,f, uscale, fscale):
def prec_solve(r):
return solvePrec(r)
- y0 = S.rand(A.shape[0])
+ y0 = N.random.rand(A.shape[0])
#Define an Assimulo problem
alg_mod = Algebraic_Problem(res, y0=y0, jac=jac, jacv=jacv, name = 'ORS Example')
@@ -101,10 +100,10 @@ def setup_param(solver):
setup_param(alg_solver)
setup_param(alg_solver_prec)
- #Solve orignal system
+ #Solve original system
y = alg_solver.solve()
- #Solve Preconditionined system
+ #Solve Preconditioned system
y_prec = alg_solver_prec.solve()
print("Error , in y: ", LIN.norm(y-N.ones(len(y))))
@@ -137,4 +136,3 @@ def setup_param(solver):
if __name__=='__main__':
mod, solv = run_example()
-
diff --git a/examples/kinsol_with_jac.py b/examples/kinsol_with_jac.py
index d61ce76d..8171d447 100644
--- a/examples/kinsol_with_jac.py
+++ b/examples/kinsol_with_jac.py
@@ -58,4 +58,3 @@ def jac(y):
if __name__=='__main__':
mod, solv = run_example()
-
diff --git a/examples/lsodar_bouncing_ball.py b/examples/lsodar_bouncing_ball.py
index d1e4ed1e..d7d8a2e9 100644
--- a/examples/lsodar_bouncing_ball.py
+++ b/examples/lsodar_bouncing_ball.py
@@ -15,12 +15,10 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see .
-import numpy as N
import nose
+import numpy as N
from assimulo.solvers import LSODAR
from assimulo.problem import Explicit_Problem
-import sys
-import os
"""
The bouncing ball example for LSODAR
@@ -155,6 +153,3 @@ def run_example(with_plots=True):
if __name__=="__main__":
mod,sim = run_example()
-
-
-
diff --git a/examples/lsodar_vanderpol.py b/examples/lsodar_vanderpol.py
index 10b8e2ce..1b35386d 100644
--- a/examples/lsodar_vanderpol.py
+++ b/examples/lsodar_vanderpol.py
@@ -55,7 +55,7 @@ def f(t,y):
exp_mod = Explicit_Problem(f,y0, name = "LSODAR: Van der Pol's equation")
#Define an explicit solver
- exp_sim = LSODAR(exp_mod) #Create a Radau5 solver
+ exp_sim = LSODAR(exp_mod) #Create a LSODAR solver
#Sets the parameters
exp_sim.atol = 1e-4 #Default 1e-6
diff --git a/examples/lsodar_with_disc.py b/examples/lsodar_with_disc.py
index 0ce1b1b1..3a286af7 100644
--- a/examples/lsodar_with_disc.py
+++ b/examples/lsodar_with_disc.py
@@ -83,7 +83,7 @@ def handle_event(self, solver, event_info):
event_info = self.check_eIter(b_mode, a_mode)
- if not True in event_info: #Breaks the iteration loop
+ if True not in event_info: #Breaks the iteration loop
break
#Helper function for handle_event
diff --git a/examples/mech_system_pendulum.py b/examples/mech_system_pendulum.py
index ff994078..3a632f70 100644
--- a/examples/mech_system_pendulum.py
+++ b/examples/mech_system_pendulum.py
@@ -15,8 +15,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see .
-#import nose
-import assimulo.problem as ap
import assimulo.special_systems as ass
import numpy as N
import nose
diff --git a/examples/radau5ode_with_disc.py b/examples/radau5ode_with_disc.py
index d5b721de..af14b49e 100644
--- a/examples/radau5ode_with_disc.py
+++ b/examples/radau5ode_with_disc.py
@@ -34,7 +34,7 @@
#Extend Assimulos problem definition
class Extended_Problem(Explicit_Problem):
- #Sets the initial conditons directly into the problem
+ #Sets the initial conditions directly into the problem
y0 = [0.0, -1.0, 0.0]
sw0 = [False,True,True]
@@ -84,7 +84,7 @@ def handle_event(self, solver, event_info):
event_info = self.check_eIter(b_mode, a_mode)
- if not True in event_info: #Breaks the iteration loop
+ if True not in event_info: #Breaks the iteration loop
break
#Helper function for handle_event
diff --git a/examples/radau5ode_with_disc_sparse.py b/examples/radau5ode_with_disc_sparse.py
index e39957d6..3a994040 100644
--- a/examples/radau5ode_with_disc_sparse.py
+++ b/examples/radau5ode_with_disc_sparse.py
@@ -35,7 +35,7 @@
#Extend Assimulos problem definition
class Extended_Problem(Explicit_Problem):
- #Sets the initial conditons directly into the problem
+ #Sets the initial conditions directly into the problem
y0 = [0.0, -1.0, 0.0]
sw0 = [False,True,True]
@@ -90,7 +90,7 @@ def handle_event(self, solver, event_info):
event_info = self.check_eIter(b_mode, a_mode)
- if not True in event_info: #Breaks the iteration loop
+ if True not in event_info: #Breaks the iteration loop
break
#Helper function for handle_event
@@ -127,8 +127,6 @@ def init_mode(self, solver):
solver.y[1] = (-1.0 if solver.sw[1] else 3.0)
solver.y[2] = (0.0 if solver.sw[2] else 2.0)
-
-
def run_example(with_plots=True):
#Create an instance of the problem
exp_mod = Extended_Problem() #Create the problem
@@ -161,4 +159,3 @@ def run_example(with_plots=True):
if __name__=="__main__":
mod,sim = run_example()
-
diff --git a/examples/radau5ode_with_jac_sparse.py b/examples/radau5ode_with_jac_sparse.py
index 83382b42..3fece4d3 100644
--- a/examples/radau5ode_with_jac_sparse.py
+++ b/examples/radau5ode_with_jac_sparse.py
@@ -21,7 +21,6 @@
from assimulo.solvers import Radau5ODE
from assimulo.problem import Explicit_Problem
-
def run_example(with_plots=True):
r"""
Example for demonstrating the use of a user supplied Jacobian (sparse).
@@ -90,10 +89,9 @@ def jac(t,y):
P.show()
#Basic tests
- nose.tools.assert_almost_equal(y[-1][0],0.9851,3)
+ nose.tools.assert_almost_equal(y[-1][0], 0.9851, 3)
return exp_mod, exp_sim
-
if __name__=='__main__':
mod,sim = run_example()
diff --git a/examples/rodasode_vanderpol.py b/examples/rodasode_vanderpol.py
index 0ce7330b..ca0e37d5 100644
--- a/examples/rodasode_vanderpol.py
+++ b/examples/rodasode_vanderpol.py
@@ -93,4 +93,3 @@ def jac(t,y):
if __name__=='__main__':
mod,sim = run_example()
-
diff --git a/examples/rungekutta34_basic.py b/examples/rungekutta34_basic.py
index f04e160c..24167e63 100644
--- a/examples/rungekutta34_basic.py
+++ b/examples/rungekutta34_basic.py
@@ -49,7 +49,7 @@ def f(t,y):
t, y = exp_sim.simulate(5) #Simulate 5 seconds
#Basic test
- nose.tools.assert_almost_equal(float(y[-1]),0.02695199,5)
+ nose.tools.assert_almost_equal(y[-1][0], 0.02695199, 5)
#Plot
if with_plots:
diff --git a/examples/rungekutta34_with_disc.py b/examples/rungekutta34_with_disc.py
index 5e9e7ee3..21bae04f 100644
--- a/examples/rungekutta34_with_disc.py
+++ b/examples/rungekutta34_with_disc.py
@@ -84,7 +84,7 @@ def handle_event(self, solver, event_info):
event_info = self.check_eIter(b_mode, a_mode)
- if not True in event_info: #Breaks the iteration loop
+ if True not in event_info: #Breaks the iteration loop
break
#Helper function for handle_event
diff --git a/examples/rungekutta4_basic.py b/examples/rungekutta4_basic.py
index 9c2256e4..4a3a7473 100644
--- a/examples/rungekutta4_basic.py
+++ b/examples/rungekutta4_basic.py
@@ -49,7 +49,7 @@ def f(t,y):
t, y = exp_sim.simulate(5, 100) #Simulate 5 seconds
#Basic test
- nose.tools.assert_almost_equal(float(y[-1]),0.02695179)
+ nose.tools.assert_almost_equal(y[-1][0], 0.02695179)
#Plot
if with_plots:
diff --git a/src/explicit_ode.pyx b/src/explicit_ode.pyx
index b2c3c1c4..f91b8074 100644
--- a/src/explicit_ode.pyx
+++ b/src/explicit_ode.pyx
@@ -83,7 +83,7 @@ cdef class Explicit_ODE(ODE):
"""
ODE.__init__(self, problem) #Sets general attributes
- if isinstance(problem, cExplicit_Problem) or isinstance(problem, Delay_Explicit_Problem) or isinstance(problem, SingPerturbed_Problem):
+ if isinstance(problem, (cExplicit_Problem, Delay_Explicit_Problem, SingPerturbed_Problem)):
self.problem = problem
else:
raise Explicit_ODE_Exception('The problem needs to be a subclass of a Explicit_Problem.')
diff --git a/src/solvers/radar5.py b/src/solvers/radar5.py
index 1346d09f..dbc373f6 100644
--- a/src/solvers/radar5.py
+++ b/src/solvers/radar5.py
@@ -77,13 +77,13 @@ def __init__(self, problem):
self.C2M1 = C2-1.0
# - Statistic values
- self.statistics["nsteps"] = 0 #Number of steps
- self.statistics["nfcn"] = 0 #Number of function evaluations
- self.statistics["njac"] = 0 #Number of Jacobian evaluations
- self.statistics["njacfcn"] = 0 #Number of function evaluations when evaluating the jacobian
- self.statistics["errfail"] = 0 #Number of step rejections
- self.statistics["nlu"] = 0 #Number of LU decompositions
- self.statistics["nstepstotal"] = 0 #Number of total computed steps (may NOT be equal to nsteps+nerrfail)
+ self.statistics["nsteps"] = 0 #Number of steps
+ self.statistics["nfcns"] = 0 #Number of function evaluations
+ self.statistics["njacs"] = 0 #Number of Jacobian evaluations
+ self.statistics["nfcnjacs"] = 0 #Number of function evaluations when evaluating the jacobian
+ self.statistics["nerrfails"] = 0 #Number of step rejections
+ self.statistics["nlus"] = 0 #Number of LU decompositions
+ # self.statistics["nstepstotal"] = 0 #Number of total computed steps (may NOT be equal to nsteps+nerrfail)
#Internal values
self._leny = len(self.y) #Dimension of the problem
@@ -91,7 +91,7 @@ def __init__(self, problem):
self._yDelayTemp = []
self._ntimelags = len(self.problem.lagcompmap)
for i in range(self._ntimelags):
- self._yDelayTemp.append(range(len(self.problem.lagcompmap[i])))
+ self._yDelayTemp.append(list(range(len(self.problem.lagcompmap[i]))))
flat_lagcompmap = []
for comp in self.problem.lagcompmap:
flat_lagcompmap.extend(comp)
@@ -332,12 +332,12 @@ def integrate(self, t, y, tf, opts):
raise Exception("Radar5 failed with flag %d"%flag)
#Retrieving statistics
- self.statistics["nsteps"] += iwork[16]
- self.statistics["nfcn"] += iwork[13]
- self.statistics["njac"] += iwork[14]
- self.statistics["nstepstotal"] += iwork[15]
- self.statistics["errfail"] += iwork[17]
- self.statistics["nlu"] += iwork[18]
+ self.statistics["nsteps"] += iwork[16]
+ self.statistics["nfcns"] += iwork[13]
+ self.statistics["njacs"] += iwork[14]
+ # self.statistics["nstepstotal"] += iwork[15]
+ self.statistics["nerrfails"] += iwork[17]
+ self.statistics["nlus"] += iwork[18]
return flag, self._tlist, self._ylist
@@ -349,10 +349,10 @@ def print_statistics(self, verbose=NORMAL):
log_message_verbose('Final Run Statistics: %s \n' % self.problem.name)
log_message_verbose(' Number of steps : '+ str(self.statistics["nsteps"]))
- log_message_verbose(' Number of function evaluations : '+ str(self.statistics["nfcn"]))
- log_message_verbose(' Number of Jacobian evaluations : '+ str(self.statistics["njac"]))
- log_message_verbose(' Number of error test failures : '+ str(self.statistics["errfail"]))
- log_message_verbose(' Number of LU decompositions : '+ str(self.statistics["nlu"]))
+ log_message_verbose(' Number of function evaluations : '+ str(self.statistics["nfcns"]))
+ log_message_verbose(' Number of Jacobian evaluations : '+ str(self.statistics["njacs"]))
+ log_message_verbose(' Number of error test failures : '+ str(self.statistics["nerrfails"]))
+ log_message_verbose(' Number of LU decompositions : '+ str(self.statistics["nlus"]))
log_message_verbose('\nSolver options:\n')
log_message_verbose(' Solver : Radar5 ' + self._type)
diff --git a/tests/solvers/test_odepack.py b/tests/solvers/test_odepack.py
index 89f29ad0..68b2659a 100644
--- a/tests/solvers/test_odepack.py
+++ b/tests/solvers/test_odepack.py
@@ -80,7 +80,7 @@ def handle_event(self, solver, event_info):
event_info = self.check_eIter(b_mode, a_mode)
- if not True in event_info: #Breaks the iteration loop
+ if True not in event_info: #Breaks the iteration loop
break
#Helper function for handle_event
diff --git a/tests/solvers/test_radau5.py b/tests/solvers/test_radau5.py
index 000c0bf4..a681eb57 100644
--- a/tests/solvers/test_radau5.py
+++ b/tests/solvers/test_radau5.py
@@ -128,7 +128,7 @@ def handle_event(self, solver, event_info):
event_info = self.check_eIter(b_mode, a_mode)
- if not True in event_info: #Breaks the iteration loop
+ if True not in event_info: #Breaks the iteration loop
break
#Helper function for handle_event