MCPcopy Create free account
hub / github.com/Kitware/VTK / np_encode

Function np_encode

Web/Python/vtkmodules/web/utils.py:65–77  ·  view source on GitHub ↗
(array, np_type=None)

Source from the content-addressed store, hash-verified

63
64
65def np_encode(array, np_type=None):
66 if np_type:
67 n_array = array.astype(np_type).ravel(order="C")
68 return {
69 "bvals": base64.b64encode(memoryview(n_array)).decode("utf-8"),
70 "dtype": str(n_array.dtype),
71 "shape": list(array.shape),
72 }
73 return {
74 "bvals": base64.b64encode(memoryview(array.ravel(order="C"))).decode("utf-8"),
75 "dtype": str(array.dtype),
76 "shape": list(array.shape),
77 }
78
79
80def mesh_array(array):

Callers 1

b64_encode_numpyFunction · 0.85

Calls 3

strFunction · 0.85
listClass · 0.50
astypeMethod · 0.45

Tested by

no test coverage detected