Skip to content

Commit

Permalink
Issue with near axis interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
odstrcilt authored Nov 29, 2023
1 parent 7420d65 commit 360ec27
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions aurora/interp.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ def interp_quad(x, y, d, rLCFS, r):
"""Function 'interp' used for kinetic profiles."""
f = interp1d(x, np.log(y), kind="quadratic", assume_sorted=True, copy=False)
idx = np.searchsorted(r, rLCFS)
core = np.exp(f(np.clip(r[:idx] / rLCFS, 0, x[-1])))
core = np.exp(f(np.clip(r[:idx] / rLCFS, x[0], x[-1])))
edge = core[..., [idx - 1]] * np.exp(
-np.outer(1.0 / np.asarray(d), r[idx:] - r[idx - 1])
)


return np.concatenate([core, edge], axis=-1)

Expand All @@ -122,12 +123,12 @@ def interpa_quad(x, y, rLCFS, r):
f = interp1d(
x,
np.log(y),
bounds_error=False,
kind="quadratic",
assume_sorted=True,
copy=False,
)
return np.exp(f(np.minimum(r / rLCFS, x[-1])))

return np.exp(f(np.clip(r / rLCFS, x[0], x[-1])))


def interp(x, y, rLCFS, r):
Expand Down

0 comments on commit 360ec27

Please sign in to comment.