Repository navigation
Add golden regression test for motor2 computation - #36
Conversation
haitao-ZCU
commented
Sep 9, 2026
- Add a regression test for motor2 (tests/test_motor2_golden.py), using the baseline from commit c438e18.
- Provenance and how to reproduce it are in tests/golden/motor2_baseline/readme.md.
- The baseline is precomputed once, not rerun on every test, and stored as CSV instead of pickle format.
|
@haitao-ZCU This PR is very strange.
|
|
Thanks for pointing this out. You are right about point 1. For point 4, my understanding is that you mean motor1's existing test ( |
|
@haitao-ZCU About 4, yes. Also tests for both motors should be as unified as possible. |
|
I have regenerated both baselines from the current main branch, not from a commit off a side branch like before, and pushed this to the PR. Currently, motor1 and motor2 golden tests share the same structure: one Design instance, one candidate rotor, compared against a precomputed CSV baseline. On "different structure than old tests", I think test_ansys_regression.py does two things ours doesn't.
On tolerance, The raw data from the 30 runs is attached. Column C (max_rel_err_pct) is the max relative error percentage for that run against the baseline. |
|
@haitao-ZCU If there are such big differences across multiple machines, I think that we need to go back to the old tests (test_ansys_regression) and generalise them for the second motor. This will mean twice the runtime, but it is still better than setting arbitrary thresholds for relative errors. If there are any problems with the second motor, we need to fix the code and not the tests. If the tests work for one seed, but not for both, we need to find what went wrong, it is possible that some artifacts stayed there and were not deleted (meshing?). Are we currently convinced that the computation for the second motor works fine? If not, there is no point, to use the current implementation as a baseline. |
|
On your second paragraph (point 2): As to this PR (golden baseline), I'm still working on it. |
|
I am reopening it because #38 addressed a different issue. |
|
Extend the legacy vs live regression test structure to motor2 (tests/test_ansys_regression_synrm_5f_40s.py), mirroring the existing test_ansys_regression.py for motor1. The legacy reference is an old pre-refactor implementation of motor2 (tests/legacy/design2.py). Currently, the tolerance for motor2 is rtol=1e-3 (relative tolerance), atol=2e-4 (absolute tolerance), tested across several different setpoints on both Windows and Linux (server). Testing setpoints: |