grid2sphere#

diffsims.utils.kinematic_simulation_utils.grid2sphere(arr, x, dx, C)[source]#

Projects 3d array onto a sphere.

Parameters:
arrnp.ndarray [float], (nx, ny, nz)

Input function to be projected

xlist [np.ndarray [float]], of shapes [(nx,), (ny,), (nz,)]

Vectors defining mesh of <arr>

dxlist [np.ndarray [float]], of shapes [(3,), (3,), (3,)]

Basis in which to orient sphere. Centre of sphere will be at C*dx[2] and mesh of output array will be defined by the first two vectors.

Cfloat

Radius of sphere.

Returns:
outnp.ndarray [float], (nx, ny)

If y is the point on the line between i*dx[0]+j*dx[1] and C*dx[2] which also lies on the sphere of radius C from C*dx[2] then: out[i,j] = arr(y). Interpolation on arr is linear.