(array, np_type=None)
| 63 | |
| 64 | |
| 65 | def 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 | |
| 80 | def mesh_array(array): |
no test coverage detected