Repository navigation
Allow build_ic_set with RandomSineWaves1d - #109
Merged
Merged
Conversation
SineWaves1d validated its offset with a Python comparison, which fails with a TracerBoolConversionError when the IC function is generated inside build_ic_set's lax.scan, where the sampled offset is a tracer. Only check the offset when it is concrete; RandomSineWaves1d already validates offset_range against std_one when it is constructed. Fixes Ceyron#58
Owner
|
Thanks for the contribution @barrosyan! Looks good to me 😊. Apologies for the late reply. I will close and reopen the PR to trigger the CI, and then merge it if they pass. |
Owner
|
FYI: I had to update the CI setup in #111, hence merging the updated main into your branch. |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #58.
build_ic_setgenerates each IC inside ajax.lax.scan, so the offset sampled byRandomSineWaves1d.gen_ic_funis a tracer.SineWaves1d.__init__then evaluatedif offset != 0.0 and std_one:, which raises aTracerBoolConversionError. (The failure is in this validation, not in the continuous-function discretization.)The check now runs only when the offset is concrete, and
std_oneis tested first.RandomSineWaves1dalready validatesoffset_rangeagainststd_onewhen it is constructed, so no invalid combination can reach the traced path. ConstructingSineWaves1ddirectly with a non-zero offset andstd_one=Truestill raises as before.Tests
TestRandomSineWaves1d.test_build_ic_set, parametrized over the default,std_one,max_oneand a non-zerooffset_range. All 4 cases fail onmainand pass with this change.pytest tests/test_ic.py: 117 passed.ruff0.9.4 check and format (the pre-commit version) pass.