Skip to content

Commit

Permalink
Fix use of deprecated numpy function
Browse files Browse the repository at this point in the history
  • Loading branch information
ZedThree committed Jun 25, 2024
1 parent 6e1c7d7 commit a468623
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/fusiondls/Iterate.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ def iterate(si, st):
st.cz = si.cz0
st.nu = st.cvar

st.qradial = (si.qpllu0 / si.Btot[si.Xpoint]) / np.trapz(
st.qradial = (si.qpllu0 / si.Btot[si.Xpoint]) / np.trapezoid(
1 / si.Btot[si.Xpoint :], x=si.S[si.Xpoint :]
)

if si.control_variable == "power":
st.cz = si.cz0
st.nu = si.nu0
# This is needed so that too high a cvar gives positive error
st.qradial = (1 / st.cvar / si.Btot[si.Xpoint]) / np.trapz(
st.qradial = (1 / st.cvar / si.Btot[si.Xpoint]) / np.trapezoid(
1 / si.Btot[si.Xpoint :], x=si.S[si.Xpoint :]
)

Expand Down
6 changes: 3 additions & 3 deletions src/fusiondls/LRBv21.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ def LRBv21(
# nu0 and cz0 guesses are from Lengyel which depends on an estimate of Tu using qpllu0
# This means we cannot make a more clever guess for qpllu0 based on cz0 or nu0
qpllu0_guess = si.qpllu0
# qradial_guess = qpllu0_guess / np.trapz(si.Btot[si.Xpoint:] / si.Btot[si.Xpoint], x = si.S[si.Xpoint:])
qradial_guess = (qpllu0_guess / si.Btot[si.Xpoint]) / np.trapz(
# qradial_guess = qpllu0_guess / np.trapezoid(si.Btot[si.Xpoint:] / si.Btot[si.Xpoint], x = si.S[si.Xpoint:])
qradial_guess = (qpllu0_guess / si.Btot[si.Xpoint]) / np.trapezoid(
1 / si.Btot[si.Xpoint :], x=si.S[si.Xpoint :]
)
st.cvar = 1 / qradial_guess
Expand All @@ -387,7 +387,7 @@ def LRBv21(
# Upstream conditions
st.nu = si.nu0
st.cz = si.cz0
st.qradial = (si.qpllu0 / si.Btot[si.Xpoint]) / np.trapz(
st.qradial = (si.qpllu0 / si.Btot[si.Xpoint]) / np.trapezoid(
1 / si.Btot[si.Xpoint :], x=si.S[si.Xpoint :]
)

Expand Down
4 changes: 2 additions & 2 deletions src/fusiondls/Profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def get_gradB_integral(self):
Return the integral of the fractional Btot gradient
below the X-point
"""
return np.trapz(
return np.trapezoid(
(np.gradient(self.Btot, self.Spol) / self.Btot)[: self.Xpoint],
self.Spol[: self.Xpoint],
)
Expand All @@ -88,7 +88,7 @@ def get_Bpitch_integral(self):
Return the integral of the pitch angle Bpol/Btot
below the X-point
"""
return np.trapz(
return np.trapezoid(
(self.Bpol / self.Btot)[: self.Xpoint], self.Spol[: self.Xpoint]
)

Expand Down

0 comments on commit a468623

Please sign in to comment.