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

Projects 3d array onto a sphere

  • arr (np.ndarray [float], (nx, ny, nz)) – Input function to be projected

  • x (list [np.ndarray [float]], of shapes [(nx,), (ny,), (nz,)]) – Vectors defining mesh of <arr>

  • dx (list [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

  • C (float) – Radius of sphere


out – 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.

Return type:

np.ndarray [float], (nx, ny)