-
Notifications
You must be signed in to change notification settings - Fork 3
fix: align post-boundary optical timing with Geant4 11.4+ #260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1be3081
fix: align post-boundary optical timing with Geant4 11.4+
plexoos acbadc0
test(simg4ox): make residual diff baseline depend on Geant4 version
plexoos 7b14dea
test(gpuraytrace): support Geant4-specific hit count baselines
plexoos 1191fed
Apply suggestions from code review
plexoos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,37 @@ | ||
| import numpy as np | ||
|
|
||
| from optiphy.geant4_version import detect_geant4_version, geant4_series | ||
|
|
||
|
|
||
| EXPECTED_DIFF = { | ||
| "11.3": [14, 22, 32, 34, 40, 81, 85], | ||
| "11.4+": [0, 30, 32, 34, 42, 69, 78, 85, 86], | ||
| } | ||
|
|
||
|
|
||
| def expected_diff_for_version(version): | ||
| return EXPECTED_DIFF[geant4_series(version)] | ||
|
|
||
|
|
||
| geant4_version = detect_geant4_version() | ||
| expected_diff = expected_diff_for_version(geant4_version) | ||
|
|
||
| a = np.load("/tmp/fakeuser/opticks/GEOM/fakegeom/simg4ox/ALL0_no_opticks_event_name/A000/record.npy") | ||
| b = np.load("/tmp/fakeuser/opticks/GEOM/fakegeom/simg4ox/ALL0_no_opticks_event_name/B000/f000/record.npy") | ||
|
|
||
| print(a.shape) | ||
| print(b.shape) | ||
| print(f"GEANT4_VERSION={geant4_version}") | ||
| print(f"EXPECTED_DIFF={expected_diff}") | ||
|
|
||
| assert a.shape == b.shape | ||
|
|
||
| diff = [i for i, (a, b) in enumerate(zip(a[:, 1:], b[:, 0:-1])) if not np.allclose(a, b, rtol=0, atol=1e-5)] | ||
| # Geant4 and Opticks record one-step-shifted sequences for this test geometry, | ||
| # so compare the aligned slices directly, including time. | ||
| a_cmp = a[:, 1:] | ||
| b_cmp = b[:, 0:-1] | ||
|
|
||
| diff = [i for i, (ac, bc) in enumerate(zip(a_cmp, b_cmp)) if not np.allclose(ac, bc, rtol=0, atol=1e-5)] | ||
| print(diff) | ||
|
|
||
| assert diff == [14, 22, 32, 34, 40, 81, 85] | ||
| assert diff == expected_diff |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.