Load name and parameters from a dict. Args: json_dict (dict): A dict comes from self.to_dict().
(self, json_dict: dict)
| 313 | self.load_from_dict(dumped_dict) |
| 314 | |
| 315 | def load_from_dict(self, json_dict: dict) -> None: |
| 316 | """Load name and parameters from a dict. |
| 317 | |
| 318 | Args: |
| 319 | json_dict (dict): |
| 320 | A dict comes from self.to_dict(). |
| 321 | """ |
| 322 | for key in json_dict.keys(): |
| 323 | if key == 'name': |
| 324 | self.name = json_dict[key] |
| 325 | elif key == 'rotation': |
| 326 | self.parameters_dict['rotation_mat'] = np.array( |
| 327 | json_dict[key]).reshape(3, 3).tolist() |
| 328 | elif key == 'translation': |
| 329 | self.parameters_dict[key] = np.array(json_dict[key]).reshape( |
| 330 | (3)).tolist() |
| 331 | else: |
| 332 | self.parameters_dict[key] = json_dict[key] |
| 333 | if '_mat' in key: |
| 334 | self.parameters_dict[key] = np.array( |
| 335 | self.parameters_dict[key]).reshape(3, 3).tolist() |
| 336 | |
| 337 | def load_from_chessboard(self, |
| 338 | chessboard_dict: dict, |
no test coverage detected