def _get_displacement_function(self, f):
"""
Getter function for calculating the displacement.
:param f: field that is used for the displacement, mainly velocity components
:returns: function of the Taylor expanded field to first order
"""
dx = self._distance
f_x, f_y = np.gradient(f , dx)
f_xx, f_xy = np.gradient(f_x, dx)
f_yx, f_yy = np.gradient(f_y, dx)
return lambda i, j, x, y : (f[i, j] + x*f_x[i, j] + y*f_y[i, j]
+ 0.5*(f_xx[i, j]*x**2 + 2*f_xy[i, j]*x*y + f_yy[i, j]*y**2))
#For the bilinear method the build in scipy method `map_coordinates <https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.ndimage.interpolation.map_coordinates.html>`_ is used with *order* set to 1.
评论列表
文章目录