Skip to content

Commit 60ed3a4

Browse files
committed
scipy cumtrapz > cumulative_trapezoid
1 parent a38e467 commit 60ed3a4

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

stagpy/processing.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import typing
1111

1212
import numpy as np
13-
from scipy import integrate
13+
from scipy.integrate import cumulative_trapezoid
1414

1515
from .datatypes import Field, Rprof, Tseries, Varf, Varr, Vart
1616
from .error import NotAvailableError
@@ -341,22 +341,22 @@ def stream_function(step: Step) -> Field:
341341
vz0 = ((r_nw[1] - r_nc[0]) * v_z[:, 0] + (r_nc[0] - r_nw[0]) * v_z[:, 1]) / (
342342
r_nw[1] - r_nw[0]
343343
)
344-
psi[1:, 0] = -integrate.cumtrapz(r_pc[0] ** 2 * vz0, x=x_coord)
344+
psi[1:, 0] = -cumulative_trapezoid(r_pc[0] ** 2 * vz0, x=x_coord)
345345
# vx at center
346346
vxc = (v_x + np.roll(v_x, -1, axis=0)) / 2
347347
for i_x in range(len(x_coord)):
348-
psi[i_x, 1:] = psi[i_x, 0] + integrate.cumtrapz(r_pc * vxc[i_x], x=r_nc)
348+
psi[i_x, 1:] = psi[i_x, 0] + cumulative_trapezoid(r_pc * vxc[i_x], x=r_nc)
349349
else: # assume cartesian geometry
350350
z_nc = step.geom.r_centers
351351
z_nw = step.rprofs.walls[:2]
352352
vz0 = ((z_nw[1] - z_nc[0]) * v_z[:, 0] + (z_nc[0] - z_nw[0]) * v_z[:, 1]) / (
353353
z_nw[1] - z_nw[0]
354354
)
355-
psi[1:, 0] = -integrate.cumtrapz(vz0, x=x_coord)
355+
psi[1:, 0] = -cumulative_trapezoid(vz0, x=x_coord)
356356
# vx at center
357357
vxc = (v_x + np.roll(v_x, -1, axis=0)) / 2
358358
for i_x in range(len(x_coord)):
359-
psi[i_x, 1:] = psi[i_x, 0] + integrate.cumtrapz(vxc[i_x], x=z_nc)
359+
psi[i_x, 1:] = psi[i_x, 0] + cumulative_trapezoid(vxc[i_x], x=z_nc)
360360
if step.geom.twod_xz:
361361
psi = -psi
362362
psi = np.reshape(psi, shape)

stagpy/stagyyparsers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def time_series(timefile: Path, colnames: List[str]) -> Optional[DataFrame]:
7171
return None
7272
data = pd.read_csv(
7373
timefile,
74-
sep="\s+",
74+
sep=r"\s+",
7575
dtype=str,
7676
header=None,
7777
skiprows=1,
@@ -189,7 +189,7 @@ def rprof(
189189
return {}, None
190190
data = pd.read_csv(
191191
rproffile,
192-
sep="\s+",
192+
sep=r"\s+",
193193
dtype=str,
194194
header=None,
195195
comment="*",
@@ -289,7 +289,7 @@ def refstate(
289289
return None
290290
data = pd.read_csv(
291291
reffile,
292-
sep="\s+",
292+
sep=r"\s+",
293293
dtype=str,
294294
header=None,
295295
names=range(ncols),

0 commit comments

Comments
 (0)