Replace jnp.interp with interpax.interp1d in thermo.py #24
+29
−28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #16 as suggested by @cgiovanetti. This PR replaces
jnp.interpwithinterpax.interp1dinthermo.pyfor consistency withabundances.pyand better performance.Changes:
jnp.interpcalls withinterpax.interp1d(0.0, 1.0)for collision factor tables (matching original behavior)Functions updated:
rho_EM_std: QED correctionsp_EM_std: QED correctionrho_plus_p_EM_std: QED correctionG_nue_with_me: Collision factor interpolationG_numt_with_me: Collision factor interpolationCaveat
For the collision factor interpolations (
G_nue_with_me,G_numt_with_me), the original code usedleft=f_tab[0,1], right=f_tab[-1,1]to extrapolate with boundary values. Sinceinterpax.interp1drequires theextrapparameter to be concrete values (not traced JAX arrays), I hardcodedextrap=(0.0, 1.0)based on the current data files:If these data files are ever updated with different boundary values, the hardcoded extrapolation values would need to be updated accordingly.
Test plan
pytest pytest/test_abundances.pypasses🤖 Generated with Claude Code