(file)
| 19 | |
| 20 | @staticmethod |
| 21 | def read(file): |
| 22 | # https://stackoverflow.com/a/44906777/7443104 |
| 23 | with open(file, 'rb') as f: |
| 24 | magic = np.fromfile(f, np.float32, count=1) |
| 25 | if 202021.25 != magic: |
| 26 | raise Exception('Magic number incorrect. Invalid .flo file') |
| 27 | else: |
| 28 | w = np.fromfile(f, np.int32, count=1)[0] |
| 29 | h = np.fromfile(f, np.int32, count=1)[0] |
| 30 | data = np.fromfile(f, np.float32, count=2 * w * h) |
| 31 | return np.resize(data, (h, w, 2)) |
| 32 | |
| 33 | def _construct_wheel(self): |
| 34 | k = 0 |
no outgoing calls
no test coverage detected