Conversation
he script analyzes GPU optical photon simulation output to debug where photons went and why: which were detected, which were absorbed, which got trapped bouncing forever, and whether the physics (wavelength shifting, energy conservation) worked correctly. Without it, the simulation is a black box that only reports a hit count.
Update with photon history summary script
|
@codex review |
There was a problem hiding this comment.
Pull request overview
Adds a new analysis utility in ana/ to summarize Opticks GPU photon outcomes and histories from saved .npy event outputs, and documents how to enable and use the output-saving event mode.
Changes:
- Added
ana/photon_history_summary.pyto loadphoton.npy/hit.npy/inphoton.npy/record.npy/seq.npyand print outcome/history/sequence/step-count summary tables plus optional per-photon traces. - Added README documentation describing output file locations, photon/seq layouts, and example invocation commands for the analysis script.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| ana/photon_history_summary.py | New CLI script that loads event arrays and prints tables/traces to help debug photon terminal flags, cumulative histories, sequence histories, and record step counts. |
| README.md | New documentation section explaining prerequisites, output folder structure, and how to run the photon history analysis. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ana/photon_history_summary.py
Outdated
|
|
||
| Usage:: | ||
|
|
||
| python ana/photon_table.py /tmp/MISSING_USER/opticks/GEOM/GEOM/GPUPhotonSourceMinimal/ALL0_no_opticks_event_name/A000 |
There was a problem hiding this comment.
ana/photon_table.py does not exist
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1ecc176ba7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
Please move this script to optiphy/ or optiphy/ana because that is the python package we support and install. |
Moved from ana to optiphy/ana
Move photon summary script from ana to optiphy/ana
Sure, done |
|
@plexoos good from my side to merge |
|
Thanks! I’ll take a closer look later. Does this script generate plots? If so, do you have any example plots for at least one of our test geometries? |
|
No plots, this script is strictly for photon history debugging. Creates summarizes of what happened to photons so the developer can see if photons escaped or died etc. Example output: ======================================================================
|
Added new script that creates a histogram of photon histories so users can understand what happened to the photons besides getting the hits. The GPU code saves photon state as NumPy arrays where each photon is a
(4, 4) float32 matrix: four quads of four floats.photon.npyholds the final state of every photon,hit.npyis the subset that triggered detectors,inphoton.npyis the initial state before simulation, andrecord.npystores the full step-by-step history (up to 32 bounces per photon).seq.npyis a compressed version of the step history using 4-bit nibbles packed into uint64 pairs.