-
Notifications
You must be signed in to change notification settings - Fork 3
Overwrite model parameters: fix warning #2003
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR improves the overwrite_parameters method in the model parameter handling code by adding an explicit flat_dict parameter to distinguish between flat parameter dictionaries and nested telescope-specific dictionaries. This prevents incorrect warnings when overwriting parameters from file-based configurations that contain parameters for multiple telescopes.
Changes:
- Added
flat_dictparameter tooverwrite_parameters()method to properly handle both flat and nested dictionary formats - Updated all direct calls to
overwrite_parameters()withflat_dict=Truewhere flat dictionaries are used - Changed parameter values in test data from string format to list format for clarity
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/simtools/model/model_parameter.py | Added flat_dict parameter to overwrite_parameters() method to distinguish between flat and nested dictionary structures; added debug logging |
| src/simtools/visualization/plot_psf.py | Updated call to overwrite_parameters() to include flat_dict=True |
| src/simtools/ray_tracing/psf_parameter_optimisation.py | Updated call to overwrite_parameters() to include flat_dict=True |
| tests/unit_tests/visualization/test_plot_psf.py | Updated mock assertion to expect flat_dict=True parameter |
| tests/unit_tests/ray_tracing/test_psf_parameter_optimisation.py | Updated mock assertion to expect flat_dict=True parameter |
| tests/unit_tests/model/test_model_parameter.py | Updated test calls to include flat_dict=True where appropriate |
| tests/resources/info_test_model_parameter_changes.yml | Changed parameter values from string format to list format for better clarity |
| docs/changes/2003.maintenance.md | Added changelog entry describing the improvement |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
EshitaJoshi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
|
Thanks - @EshitaJoshi could you do me a favor and solve the conflict in test_plot_psf? That one is new. |
|




Improve model parameter overwrite function with an explicit
flat_dictstatement to avoid being flooded by warnings likeWARNING::model_parameter(l519)::overwrite_parameters::Parameter MSTS-05 not found in model MSTS-12, cannot overwrite it.(note the error in the warning).
Changes also test values for 'changes' to lists, as discussed here