Skip to content

Commit cd9b1fe

Browse files
committed
small fixes
- add warning ignore to self.m.sqrt MathFunction due to unnecessary warnings when executing models using solve_ivp - add np.e constant by default - remove not yet implemented solver_kwargs argument to setup function
1 parent 6d9e591 commit cd9b1fe

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

src/xso/backendcomps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def time_flux(self, **kwargs):
198198
"""Simple linear flux, that represents time within model.
199199
Necessary for external solvers like odeint.
200200
"""
201-
dtdt = 1
201+
dtdt = 1.
202202
return dtdt
203203

204204

src/xso/solvers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,14 @@ class MathFunctionWrappers:
7373

7474
# Constants:
7575
pi = np.pi # pi constant
76+
e = np.e # e constant
7677

7778
def exp(x):
7879
"""Exponential function"""
7980
return np.exp(x)
8081

82+
# add np.errstate to ignore superfluous warnings, caused by solve_ivp solver
83+
@np.errstate(all='ignore')
8184
def sqrt(x):
8285
"""Square root function"""
8386
return np.sqrt(x)

src/xso/xsimlabwrappers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def create(components, time_unit='d'):
3333
return xs.Model(components)
3434

3535

36-
def setup(solver, model, input_vars, output_vars=None, time=None, solver_kwargs=None):
36+
def setup(solver, model, input_vars, output_vars=None, time=None):
3737
"""Create a specific setup for model runs.
3838
3939
This function wraps xsimlab's create_setup and adds a dummy clock parameter

0 commit comments

Comments
 (0)