(fid, kind, mat, data_type)
| 195 | |
| 196 | |
| 197 | def _write_matrix_data(fid, kind, mat, data_type): |
| 198 | dtype = { |
| 199 | FIFF.FIFFT_FLOAT: ">f4", |
| 200 | FIFF.FIFFT_DOUBLE: ">f8", |
| 201 | FIFF.FIFFT_COMPLEX_FLOAT: ">c8", |
| 202 | FIFF.FIFFT_COMPLEX_DOUBLE: ">c16", |
| 203 | FIFF.FIFFT_INT: ">i4", |
| 204 | }[data_type] |
| 205 | dtype = np.dtype(dtype) |
| 206 | data_size = dtype.itemsize * mat.size + 4 * (mat.ndim + 1) |
| 207 | matrix_type = data_type | FIFF.FIFFT_MATRIX |
| 208 | fid.write(np.array(kind, dtype=">i4").tobytes()) |
| 209 | fid.write(np.array(matrix_type, dtype=">i4").tobytes()) |
| 210 | fid.write(np.array(data_size, dtype=">i4").tobytes()) |
| 211 | fid.write(np.array(FIFF.FIFFV_NEXT_SEQ, dtype=">i4").tobytes()) |
| 212 | fid.write(np.array(mat, dtype=dtype).tobytes()) |
| 213 | dims = np.empty(mat.ndim + 1, dtype=np.int32) |
| 214 | dims[: mat.ndim] = mat.shape[::-1] |
| 215 | dims[-1] = mat.ndim |
| 216 | fid.write(np.array(dims, dtype=">i4").tobytes()) |
| 217 | check_fiff_length(fid) |
| 218 | |
| 219 | |
| 220 | def get_machid(): |
no test coverage detected