Compare two potentially converted forward solutions.
(f1, f2, rtol=1e-7)
| 51 | |
| 52 | |
| 53 | def assert_forward_allclose(f1, f2, rtol=1e-7): |
| 54 | """Compare two potentially converted forward solutions.""" |
| 55 | assert_allclose(f1["sol"]["data"], f2["sol"]["data"], rtol=rtol) |
| 56 | assert f1["sol"]["ncol"] == f2["sol"]["ncol"] |
| 57 | assert f1["sol"]["ncol"] == f1["sol"]["data"].shape[1] |
| 58 | assert_allclose(f1["source_nn"], f2["source_nn"], rtol=rtol) |
| 59 | if f1["sol_grad"] is not None: |
| 60 | assert f2["sol_grad"] is not None |
| 61 | assert_allclose(f1["sol_grad"]["data"], f2["sol_grad"]["data"]) |
| 62 | assert f1["sol_grad"]["ncol"] == f2["sol_grad"]["ncol"] |
| 63 | assert f1["sol_grad"]["ncol"] == f1["sol_grad"]["data"].shape[1] |
| 64 | else: |
| 65 | assert f2["sol_grad"] is None |
| 66 | assert f1["source_ori"] == f2["source_ori"] |
| 67 | assert f1["surf_ori"] == f2["surf_ori"] |
| 68 | assert f1["src"][0]["coord_frame"] == f1["src"][0]["coord_frame"] |
| 69 | |
| 70 | |
| 71 | @testing.requires_testing_data |
no outgoing calls
no test coverage detected