cherab.phix.tools.laplacian_matrix#
- cherab.phix.tools.laplacian_matrix(voxel_map, dir=4)#
generate Laplacian matrix.
- Parameters:
voxel_map (NDArray[int32]) – (N, M) voxel map matrix (negative value must be input into masked voxels) If the additional dimension size of the matrix is 1, then it is squeezed to a 2-D matrix.
dir ({4, 8}) – the number of laplacian kernel’s neighbor, by default 4.
- Returns:
(N, N) laplacian matrix (if N > M)
- Return type:
NDArray[int32]
Examples
from raysect.core import World from cherab.phix.plasma import import_equilibrium from cherab.phix.tools import laplacian_matrix, import_phix_rtm world = World() eq = import_equilibrium() rtm = import_phix_rtm(world, equilibrium=eq) laplacian = laplacian_matrix(rtm.voxel_map, dir=8) laplacian array([[-8, 1, 0, ..., 0, 0, 0], [ 1, -8, 1, ..., 0, 0, 0], [ 0, 1, -8, ..., 0, 0, 0], ..., [ 0, 0, 0, ..., -8, 1, 0], [ 0, 0, 0, ..., 1, -8, 1], [ 0, 0, 0, ..., 0, 1, -8]], dtype=int32)