Triage our reconstruction trans.
(destination, info, coord_frame)
| 1039 | |
| 1040 | |
| 1041 | def _check_destination(destination, info, coord_frame): |
| 1042 | """Triage our reconstruction trans.""" |
| 1043 | if destination is None: |
| 1044 | return info["dev_head_t"] |
| 1045 | if coord_frame != "head": |
| 1046 | raise RuntimeError( |
| 1047 | "destination can only be set if using the head coordinate frame" |
| 1048 | ) |
| 1049 | if isinstance(destination, str | Path): |
| 1050 | recon_trans = _get_trans(destination, "meg", "head")[0] |
| 1051 | elif isinstance(destination, Transform): |
| 1052 | recon_trans = destination |
| 1053 | else: |
| 1054 | destination = np.array(destination, float) |
| 1055 | if destination.shape != (3,): |
| 1056 | raise ValueError("destination must be a 3-element vector, str, or None") |
| 1057 | recon_trans = np.eye(4) |
| 1058 | recon_trans[:3, 3] = destination |
| 1059 | recon_trans = Transform("meg", "head", recon_trans) |
| 1060 | if recon_trans.to_str != "head" or recon_trans.from_str != "MEG device": |
| 1061 | raise RuntimeError( |
| 1062 | "Destination transform is not MEG device -> head, " |
| 1063 | f"got {recon_trans.from_str} -> {recon_trans.to_str}" |
| 1064 | ) |
| 1065 | return recon_trans |
| 1066 | |
| 1067 | |
| 1068 | @verbose |
no test coverage detected