(data)
| 127 | |
| 128 | |
| 129 | def convert_uint16_to_float(data): |
| 130 | new_data = np.vectorize( |
| 131 | lambda x: struct.unpack('<f', struct.pack('<I', x << 16))[0], |
| 132 | otypes=[np.float32], |
| 133 | )(data.flat) |
| 134 | return np.reshape(new_data, data.shape) |
| 135 | |
| 136 | |
| 137 | def convert_dtype(dtype: DTypeLike) -> _DTypeLiteral: |