69 photon recon improvements - #70
Merged
Merged
Conversation
…alk calibration script
…clude Hermes prefix
13 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the TPX3/SPIDR photon reconstruction configuration and results models to use new Hermes*-prefixed types and a structured clustering configuration object, and updates runners/tests/examples/docs accordingly.
Changes:
- Renames/refactors reconstruction and clustering models (including moving
save_photon_pixelsunder a newHermesTpx3PhotonClusteringwrapper). - Updates photon reconstruction runner logic to serialize the new clustering config shape for the clusterer binary.
- Updates workflow dispatch behavior and broad test/example YAML usage to match the new schema.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tests/unit/hermes/workflows/test_workflow.py |
Adds coverage for Workflow.run() dispatch and empty-record rejection; adjusts unimplemented acquisition test. |
tests/unit/hermes/state/models/test_hermes_tpx3_spidr.py |
Updates state-model tests to new HermesTpx3* names and new clustering wrapper shape. |
tests/unit/hermes/runner/analysis/hermes/test_timewalk_calibration.py |
Renames clustering settings type in calibration tests. |
tests/unit/hermes/runner/analysis/hermes/test_photon_reconstruction.py |
Updates photon reconstruction tests for new exception names and clustering config wrapper. |
tests/unit/hermes/runner/analysis/hermes/test_event_reconstruction.py |
Updates event reconstruction tests for new HermesTpx3* model names and new photon clustering wrapper. |
tests/unit/examples/analysis/test_two_stage.py |
Updates example tests and YAML snippet to new config shape and renamed result/count models. |
tests/unit/examples/analysis/test_timewalk_calibration_example.py |
Updates example test to renamed clustering settings model. |
src/hermes/workflows/workflow.py |
Implements Workflow.run() dispatch behavior and return value. |
src/hermes/state/models/analysis/hermes_tpx3_spidr.py |
Introduces HermesTpx3PhotonClustering wrapper and renames/refactors reconstruction, settings, summaries, and results models. |
src/hermes/runner/analysis/hermes/timewalk_calibration.py |
Updates calibration code to renamed clustering settings model. |
src/hermes/runner/analysis/hermes/run.py |
Updates runner to renamed photon reconstruction error/result types. |
src/hermes/runner/analysis/hermes/photon_reconstruction.py |
Updates reconstruction execution to use clustering wrapper and renamed error/result/summary types. |
src/hermes/runner/analysis/hermes/event_reconstruction.py |
Updates event reconstruction types to renamed models. |
examples/analysis/two_stage/two_stage_config.yaml |
Updates example config to new pixel_files + structured clustering_algorithm object. |
examples/analysis/timewalk_calibration/run_timewalk_calibration.py |
Updates example script to renamed clustering settings model. |
examples/analysis/timewalk_calibration/README.md |
Updates documentation references for the renamed clustering settings model. |
examples/analysis/end_to_end/raw-to-events.yaml |
Updates end-to-end example YAML to new clustering configuration structure. |
docs/architecture/state-model.md |
Updates architecture doc naming, but still contains mismatches vs the actual implemented model names/fields. |
Suppressed comments (2)
docs/architecture/state-model.md:641
- This documented reconstruction model block uses type names (HermesTpx3PhotonReconstructionConfiguration, PhotonReconstructorProgram) that do not exist in the code; the runtime model is HermesTpx3PhotonReconstruction with a BinaryProgram. Consider aligning these names with src/hermes/state/models/analysis/hermes_tpx3_spidr.py so the architecture doc matches the actual configuration schema.
HermesTpx3PhotonReconstructionConfiguration
program: PhotonReconstructorProgram
pixel_files: auto | list[FileReference]
clustering_algorithm: HermesTpx3PhotonClustering
docs/architecture/state-model.md:676
- The documented fields for HermesTpx3PhotonReconstructionResult (photon_count/rejected_count/warnings/errors) do not match the actual model, which stores input_file/output_file/status and optional counts. Update this section so it reflects src/hermes/state/models/analysis/hermes_tpx3_spidr.py and the runner’s usage.
HermesTpx3PhotonReconstructionResult
status: completed | skipped | failed
photon_count: int
rejected_count: int
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+44
to
+48
| """Run the operations the record asks for: acquisition, analysis, or both. | ||
|
|
||
| Acquisition runs before analysis when both are present. Returns the | ||
| record after the requested operations have updated it. | ||
| """ |
| tpx3_files: list[FileReference] | ||
| resource_limit_percent: int = 90 # integer from 1 through 100 | ||
| photon_reconstruction: Tpx3PhotonReconstructionConfiguration | None | ||
| photon_reconstruction: HermesTpx3PhotonReconstructionConfiguration | None |
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.
This pull request introduces a major refactor of the photon reconstruction and clustering configuration models and their usage across the codebase, aligning naming conventions, improving clarity, and supporting more flexible clustering settings. The changes affect both the YAML configuration files and Python code, and include updates to error handling, model validation, and the internal structure of clustering configuration.
Key changes:
1. Model and Type Renaming and Refactoring
Tpx3PhotonReconstructionConfiguration,Tpx3PhotonClusteringSettings, and related types with newHermesTpx3PhotonReconstructionConfiguration,HermesTpx3PhotonClustering, andHermesTpx3PhotonClusteringSettingsmodels, updating field names and structure for clarity and extensibility. This includes renaming result and summary types toHermesTpx3PhotonReconstructionResultandHermesTpx3PhotonReconstructionSummary. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]2. Clustering Algorithm Configuration Overhaul
clustering_algorithmfield is now an object (HermesTpx3PhotonClustering) withname,save_photon_pixels, andsettingssubfields, instead of a flat string or simple settings dict. The YAML configuration files are updated accordingly, and logic is added to correctly serialize and pass these settings to the clusterer binary. [1] [2] [3] [4] [5]3. Field and Parameter Renaming
pixel_parquet_filestopixel_filesthroughout the codebase and configuration files for consistency. [1] [2] [3] [4]4. Error Handling and Exception Renaming
HermesPhotonReconstructionErrornaming pattern, clarifying their association and improving error reporting. [1] [2] [3] [4] [5]5. Documentation and Example Updates
These changes modernize and clarify the photon reconstruction configuration, making it easier to extend and maintain in the future.