freegsnke.bilinear_interpolation module
Bilinear interpolation on uniformly spaced two-dimensional grids.
Copyright 2024-2026 Nicola C. Amorisco Copyright 2025 Timothy Nunn
Adapted from FreeGS4E.
This file is part of FreeGSNKE.
FreeGSNKE is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
FreeGSNKE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with FreeGSNKE. If not, see <http://www.gnu.org/licenses/>.
- freegsnke.bilinear_interpolation.biliint(R: np.ndarray, Z: np.ndarray, psi: np.ndarray, points: np.ndarray) np.ndarray[source]
Bilinearly interpolate a function defined on a uniform 2D grid.
Points outside the grid are extrapolated using the nearest edge cell.
- Parameters:
R (np.ndarray) – R coordinates on the 2d grid (meshgrid with
indexing="ij"), shape (nx, ny).Z (np.ndarray) – Z coordinates on the 2d grid, shape (nx, ny).
psi (np.ndarray) – Function values on the 2d grid, shape (nx, ny).
points (np.ndarray) – (R, Z) coordinates at which to interpolate, shape (2, …).
- Returns:
Interpolated values, with the shape of
pointswithout its first axis.- Return type:
np.ndarray