Skip to content

v492 XGB tests. - #178

Merged
GernotMaier merged 8 commits into
mainfrom
d202610_xgb
Nov 14, 2026
Merged

GernotMaier merged 8 commits into
mainfrom
d202610_xgb

Conversation

@GernotMaier

Copy link
Copy Markdown
Member

This pull request introduces significant improvements to the robustness and reliability of the Eventdisplay-ML (XGB) analysis and training scripts. The changes focus on consistent error handling, explicit exit statuses, improved logging, and the introduction of centralized utility functions for checking XGB job results. Additionally, there are some adjustments to how XGB output files are handled and to the logic for running XGB predictions in IRF scripts.

Error Handling and Robustness Improvements:

  • Added a new utility script UTILITY.xgb_checks.sh containing evndisp_ml_check_apply and evndisp_ml_check_train functions for standardized validation of XGB apply and train steps, including output file checks and error reporting.
  • Updated all XGB apply and train scripts (ANALYSIS.dispXGB_sub.sh, IRF.dispXGB_sub.sh, IRF.trainXGBforAngularReconstruction_sub.sh, IRF.trainXGBforGammaHadronSeparation_sub.sh) to source UTILITY.xgb_checks.sh and use these functions to check for errors and exit with status 1 on failure. [1] [2] [3] [4] [5] [6] [7] [8]
  • Changed all exit statements on error to exit 1 for explicit nonzero exit status. [1] [2] [3] [4] [5] [6] [7] [8] [9]

Refactoring and Code Cleanliness:

  • Removed unused/obsolete comments and clarified the rationale for not using set -e in the scripts, noting that ML exit statuses are now checked explicitly. [1] [2] [3] [4]

XGB Output Handling and IRF Logic:

  • In IRF.mscw_energy_MC_sub.sh, changed the naming and logic for XGB output files to remove the image selection suffix, ensuring that XGB predictions are calculated only once per MSCW file and used only for 4-telescope IRFs. Added logic to skip unsupported 3-telescope XGB IRFs and improved error checking for the XGB apply step. [1] [2] [3] [4] [5] [6]
  • Updated the main analysis script to only use the NTel2ModerateXGBPre cut for AP analysis types, removing redundant assignments.

Other Notable Changes:

  • Replaced the use of the compiled printRunParameter tool with eventdisplay-ml-print-run-info for extracting run information, making the scripts less dependent on compiled binaries. [1] [2]

These changes collectively improve the maintainability, clarity, and reliability of the analysis pipeline, especially for machine learning steps involving XGB models.

@GernotMaier GernotMaier self-assigned this Nov 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Approval is blocked by active critical and moderate issues that can publish failed outputs, silently produce partial IRFs, or point shared environment settings at the wrong checkout.

4 open issues
What changed in this PR

This pull request strengthens XGB training, application, and IRF production workflows with centralized validation, explicit failure handling, named variant support, and improved output management.

Changes:

  • Added shared XGB result checks and variant configuration utilities.
  • Updated training, prediction, and effective-area workflows with variant-aware paths, locking, output validation, and failure propagation.
  • Adjusted environment configuration, run-information extraction, XGB output naming, anasum discovery, and AP cut selection.
File Description
scripts/​set_environment.sh Updates project, data, EventDisplay, ML, and Apptainer environment configuration.
scripts/​IRF.trainXGBforAngularReconstruction.sh Adds variant validation and variant-specific training output configuration.
scripts/​IRF.production.sh Adds variant orchestration and improved XGB production job handling.
scripts/​IRF.generate_effective_area_parts.sh Adds variant-aware XGB effective-area inputs and validation.
scripts/​IRF.dispXGB.sh Passes variant, smearing, and model configuration into XGB prediction jobs.
scripts/​IRF.combine_effective_area_parts.sh Uses variant-specific effective-area inputs, directories, and output names.
scripts/​helper_scripts/​UTILITY.xgb_variant.sh Provides centralized variant validation, configuration freezing, and model-root handling.
scripts/​helper_scripts/​UTILITY.xgb_checks.sh Provides shared checks for XGB application and training results.
scripts/​helper_scripts/​IRF.trainXGBforGammaHadronSeparation_sub.sh Adds validation of gamma/hadron XGB training results.
scripts/​helper_scripts/​IRF.trainXGBforAngularReconstruction_sub.sh Adds smearing support, locking, variant handling, and training-result validation.
scripts/​helper_scripts/​IRF.mscw_energy_MC_sub.sh Runs XGB prediction once per MSCW file and skips unsupported three-telescope XGB IRFs.
scripts/​helper_scripts/​IRF.effective_area_parallel_sub.sh Adds variant output isolation, locking, and effective-area result handling.
scripts/​helper_scripts/​IRF.effective_area_combine_sub.sh Adds variant locking and effective-area combination input and output checks.
scripts/​helper_scripts/​IRF.dispXGB_sub.sh Adds variant model and smearing support, output locking, and apply-result validation.
scripts/​helper_scripts/​ANALYSIS.dispXGB_sub.sh Adds explicit XGB apply status handling and updated run-information extraction.
scripts/​ANALYSIS.anasum_combine.sh Searches additional preprocessing directory levels for anasum outputs.
scripts/​ANALYSIS.anasum_allcuts.sh Restricts AP analysis processing to the NTel2ModerateXGBPre cut.

Review effort: Lite

Comment thread scripts/set_environment.sh Resolved
Comment thread scripts/IRF.production.sh Resolved
Comment thread scripts/ANALYSIS.anasum_allcuts.sh Resolved
@GernotMaier
GernotMaier marked this pull request as ready for review November 14, 2026 16:24
@GernotMaier
GernotMaier merged commit 86aafa4 into main Nov 14, 2026
2 checks passed
@GernotMaier
GernotMaier deleted the d202610_xgb branch November 14, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants