Skip to content

Add optional feature mask for image parameters. - #87

Merged
GernotMaier merged 5 commits into
mainfrom
d202610_xgb
Nov 9, 2026
Merged

GernotMaier merged 5 commits into
mainfrom
d202610_xgb

Conversation

@GernotMaier

Copy link
Copy Markdown
Member

This pull request adds an optional feature to mask (set to NaN) the image parameters of telescopes not used by the DispBDT reconstruction in stereo analysis. This behavior is controlled by a new --mask_unused_images option, which is stored in the model and respected during both training and application. The codebase is updated to propagate this setting throughout the relevant data processing and model application functions, and new tests have been added to verify the correct masking behavior.

Feature addition and configuration:

  • Added the --mask_unused_images command-line option to stereo training in configure_training, which sets image parameters of unused telescopes to NaN. The setting is stored in the model configuration and logged for transparency. [1] [2] [3] [4]
  • When applying a model, the mask_unused_images setting is loaded from the model's training parameters, ensuring consistency between training and inference. An error is raised if primary and high-multiplicity models have conflicting settings. [1] [2]

Data processing pipeline changes:

  • Updated flatten_telescope_data_vectorized, flatten_feature_data, and related internal functions to accept and apply the mask_unused_images flag, masking unused image parameters as needed. This affects both training and application workflows. [1] [2] [3] [4] [5] [6] [7] [8] [9]

Testing:

  • Added tests/test_stereo_inactive_telescope_mask.py to verify that the masking behavior works as expected, both with the option enabled (masking unused images) and with the default (historical) behavior.

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 three active issues: an invalid CLI example, missing documentation for the new mask mode, and a moderate masking bug for negative telescope-ID sentinels.

3 open issues
What changed in this PR

Adds optional --mask_unused_images support for stereo regression, masking image parameters from unused telescopes while preserving historical behavior by default. The setting is persisted in model metadata and restored during inference.

Changes:

  • Adds masking configuration and model metadata persistence.
  • Propagates masking through telescope data flattening and model application.
  • Validates compatibility between primary and high-multiplicity models.
  • Adds masking behavior tests and reorganizes usage documentation.
  • Documents the feature in the changelog.

This pull request requires changes.

File Description
tests/​test_stereo_inactive_telescope_mask.py Tests enabled masking and historical default behavior.
src/​eventdisplay_ml/​models.py Stores the masking option in regression metadata and applies it during inference.
src/​eventdisplay_ml/​data_processing.py Propagates the masking option through telescope flattening and applies NaN masking.
src/​eventdisplay_ml/​config.py Adds stereo training configuration, logging, and model-setting compatibility checks.
README.md Provides a concise project overview, installation instructions, and documentation links.
docs/​usage.md Contains the relocated training, application, and diagnostic usage guide.
docs/​changes/​87.feature.md Documents the new stereo masking feature.

Review effort: Lite

Comment thread src/eventdisplay_ml/data_processing.py Resolved
Comment thread docs/usage.md Resolved
Comment thread docs/usage.md Resolved
@GernotMaier
GernotMaier merged commit 3ad6f34 into main Nov 9, 2026
@GernotMaier
GernotMaier deleted the d202610_xgb branch November 9, 2026 13:57
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