spacepy.pybats.batsmath¶
Functions for common math problems such as derivatives, etc. These should typically be called via other interfaces, but are made available to all users.
Functions
|
Given a 2D array of U values that is regularly spaced and is ordered using 'C' or 'matplotlib' ordering (such that $x$ progresses along the last index, $y$ along the next-to-last, etc.), take spatial the derivative with respect to $x$. |
|
Given a 2D array of U values that is regularly spaced and is ordered using 'C' or 'matplotlib' ordering (such that $x$ progresses along the last index, $y$ along the next-to-last, etc.), take spatial the derivative with respect to $y$. |
|
For a set of points (x, y) that lie inside of the 2D arrays of x and y locations, xgrid, ygrid, interpolate 2D array of values, val to those points using simple bilinear interpolation. |
|
Fast, simple bilinear interpolation from 2d regular grid with starting points xMin, yMin and normalized spacing dx, dy of values on grid (z) to new location, x, y. |
- spacepy.pybats.batsmath.d_dx(U, dx)[source]¶
Given a 2D array of U values that is regularly spaced and is ordered using ‘C’ or ‘matplotlib’ ordering (such that $x$ progresses along the last index, $y$ along the next-to-last, etc.), take spatial the derivative with respect to $x$. A 2D array of dU/dx values are returned. Uses second order central differences (non-edge values) and second order forward/backward differences (edge values) to obtain first derivative without ghost cells.
- spacepy.pybats.batsmath.d_dy(U, dy)[source]¶
Given a 2D array of U values that is regularly spaced and is ordered using ‘C’ or ‘matplotlib’ ordering (such that $x$ progresses along the last index, $y$ along the next-to-last, etc.), take spatial the derivative with respect to $y$. A 2D array of dU/dx values are returned. Uses second order central differences (non-edge values) and second order forward/backward differences (edge values) to obtain first derivative without ghost cells.
- spacepy.pybats.batsmath.interp_2d_reg(x, y, xgrid, ygrid, val, dx=None, dy=None)[source]¶
For a set of points (x, y) that lie inside of the 2D arrays of x and y locations, xgrid, ygrid, interpolate 2D array of values, val to those points using simple bilinear interpolation. This function will extrapolate outside of xgrid, ygrid, so use with caution.
- spacepy.pybats.batsmath.interp_bilin_scalar(x, y, z, xMin=0.0, yMin=0.0, dx=1.0, dy=1.0)[source]¶
Fast, simple bilinear interpolation from 2d regular grid with starting points xMin, yMin and normalized spacing dx, dy of values on grid (z) to new location, x, y. Used to quickly set up ghost cells for advanced tracing.