Skip to content

Conversation

@akshat3410
Copy link

Summary

Moves hardcoded sawtooth crash reference values from sawtooth_model_test.py into a local sawtooth_references.json file, along with a regeneration script. This makes the test references maintainable and auto-regeneratable when the sawtooth model changes.

References were regenerated against the latest main to ensure they match current simulation output.

Fixes #1762

Changes

Files added:

  • regenerate_sawtooth_refs.py - Script to regenerate sawtooth crash references
  • sawtooth_references.json - Stores post-crash T_e, n_e, and psi reference values

Files modified:

  • sawtooth_model_test.py - Load references from JSON; share config with regeneration script

Files NOT changed:

  • torax/_src/test_utils/references.json
  • torax/_src/test_utils/torax_refs.py
  • Any .nc test data files

Notes for Reviewers

  • Test tolerances unchanged (rtol=1e-6)
  • Regeneration script and test share config for consistency
  • All 3 sawtooth tests pass

…eepmind#1762)

- Add regenerate_sawtooth_refs.py for auto-regeneration of references
- Add sawtooth_references.json with post-crash T_e, n_e, psi values
- Update sawtooth_model_test.py to load references from JSON
- Share test config between test and regeneration script (DRY)

References regenerated against latest main. All 3 tests pass.

Fixes google-deepmind#1762
@jcitrin
Copy link
Collaborator

jcitrin commented Jan 6, 2026

Duplication of #1770

@jcitrin jcitrin closed this Jan 6, 2026
@akshat3410 akshat3410 deleted the fix/sawtooth-refs-1762-clean branch January 7, 2026 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move sawtooth_model_test reference values to test_utils/references.json

2 participants