Skip to content

Config values not applied to loaded Reconstructor models in ApplyModels #2720

@Hckjs

Description

@Hckjs

Describe the bug
When using the ApplyModels tool, configuration values set via the command line (e.g., --EnergyRegressor.stereo_combiner.weights=intensity) or given as input in a config file are not applied to the loaded Reconstructor instances.

I think this issue is caused by the way the Reconstructor models are loaded using
Reconstructor.read(path, parent=self, subarray=self.loader.subarray).
Since these instances are deserialized from a joblib file, their attributes are not automatically updated with values from the ApplyModels configuration.

To Reproduce
Steps to reproduce the behavior:

pytest -s src/ctapipe/tools/tests/test_apply_models.py::test_apply_energy_regressor

which includes

"--StereoMeanCombiner.weights=konrad",

while checking combiner.weights here:
combiner = reconstructor.stereo_combiner

(weights are set to default value = "none" )

Expected behavior
Configuration values specified via CLI or config files should be properly applied to all components of a loaded Reconstructor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions