Skip to content

Commit

Permalink
refactor: let TimeSeriesParam return array
Browse files Browse the repository at this point in the history
  • Loading branch information
rzyu45 committed Jan 12, 2025
1 parent 9fe0317 commit 79c132f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Solverz/equation/param.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ def get_v_t(self, t):
# input of interp1d is zero-dimensional, we need to reshape
# [0] is to eliminate the numpy DeprecationWarning in m3b9 test: Conversion of an array with ndim > 0 to a scalar is
# deprecated, and will error in the future, which should be resolved.
vt = self.vt(t).reshape((-1,))[0]
vt = self.vt(t).reshape((-1,))
else:
vt = self.v_series[-1]
vt = self.v_series[-1:]

if self.index is not None:
temp = self.v.copy()
Expand Down
2 changes: 1 addition & 1 deletion Solverz/equation/test/test_Param.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_Param():
v_series=[0, 10, 100],
time_series=[0, 10, 20],
value=0)
assert Pb.get_v_t(5).__str__() == '5.0'
assert Pb.get_v_t(5).__str__() == '[5.]'

try:
Pb = TimeSeriesParam(name='Pb',
Expand Down

0 comments on commit 79c132f

Please sign in to comment.