Skip to content

Commit 5d8f956

Browse files
authored
Merge pull request #42 from basf/41-fix-future-warning
wrapped json in StringIO object, updated row_stack to vstack.
2 parents 51f5d31 + 9aa7614 commit 5d8f956

4 files changed

Lines changed: 9 additions & 4 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ __pycache__
1010
.idea
1111
build
1212
dist
13+
14+
# uv
15+
.venv/
16+
uv.lock

opti/problem.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
import os
3+
from io import StringIO
34
from typing import Callable, Dict, List, Optional, Tuple, Union
45

56
import numpy as np
@@ -87,10 +88,10 @@ def __init__(
8788
self.f = f
8889

8990
if isinstance(data, dict):
90-
data = pd.read_json(json.dumps(data), orient="split")
91+
data = pd.read_json(StringIO(json.dumps(data)), orient="split")
9192

9293
if isinstance(optima, dict):
93-
optima = pd.read_json(json.dumps(optima), orient="split")
94+
optima = pd.read_json(StringIO(json.dumps(optima)), orient="split")
9495

9596
self.set_data(data)
9697
self.set_optima(optima)

opti/sampling/polytope.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def _get_AbNx(parameters, constraints):
116116
# add the inequality constraints corresponding to the box bounds
117117
lower = parameters.bounds.loc["min"]
118118
upper = parameters.bounds.loc["max"]
119-
A_ineq = np.row_stack([-np.eye(nD), np.eye(nD)])
119+
A_ineq = np.vstack([-np.eye(nD), np.eye(nD)])
120120
b_ineq = np.r_[-np.array(lower), np.array(upper)]
121121

122122
if sum(~is_eq) > 0:

test/test_sampling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_sphere_sampling():
4646

4747

4848
def test_polytope_chebyshev_center():
49-
A = np.row_stack([-np.eye(3), np.eye(3)])
49+
A = np.vstack([-np.eye(3), np.eye(3)])
5050
b = np.r_[-np.zeros(3), np.ones(3)]
5151
x0 = polytope._chebyshev_center(A, b)
5252
assert np.allclose(x0, [0.5, 0.5, 0.5])

0 commit comments

Comments
 (0)