Skip to content

Commit

Permalink
Fix sp.Matrix errors with numpy==1.25 (#2124)
Browse files Browse the repository at this point in the history
and DeprecationWarnings with older numpy (`venv/lib/python3.11/site-packages/sympy/matrices/matrices.py:995: DeprecationWarning: elementwise comparison failed; this will raise an error in the future.
    if dat in ([], [[]]):`)
  • Loading branch information
dweindl authored Jun 19, 2023
1 parent da3a9ef commit 0010985
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions python/tests/splines_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def integrate_spline(
params: Union[Dict, None],
tt: Sequence[float],
initial_value: float = 0,
**kwargs,
):
"""
Integrate the `AbstractSpline` `spline` at timepoints `tt`
Expand All @@ -56,7 +55,7 @@ def integrate_spline(
ispline = [initial_value + spline.integrate(0, t) for t in tt]
if params is not None:
ispline = [x.subs(params) for x in ispline]
return np.asarray(ispline, **kwargs)
return ispline


def create_condition_table() -> pd.DataFrame:
Expand Down Expand Up @@ -213,10 +212,13 @@ def create_petab_problem(
dt /= measure_upsample
n_obs = math.ceil(T / dt) + 1
tt_obs = np.linspace(0, float(T), n_obs)
zz_true = [
integrate_spline(spline, params_true, tt_obs, iv, dtype=float)
for (spline, iv) in zip(splines, initial_values)
]
zz_true = np.array(
[
integrate_spline(spline, params_true, tt_obs, iv)
for (spline, iv) in zip(splines, initial_values)
],
dtype=float,
)
zz_obs = [zz + sigma * np.random.randn(len(zz)) for zz in zz_true]

# Create PEtab tables
Expand Down

0 comments on commit 0010985

Please sign in to comment.