Skip to content

Conversation

@orelgueta
Copy link
Contributor

This PR is just a working example for overwriting parameters also when using model_utils to setup a model, in particular in the context of validate optics. It is clearly not complete, but I needed these changes to get it to work. Adding a couple of tests should be enough I think.

In addition to that change, also the propagation of the model version into the plot of incidence angle snuck in to this PR. That is not a necessity, it was needed just to make the plot comparison easier in a different study. If you don't find it useful, please feel free to remove it.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@GernotMaier
Copy link
Contributor

Following updates:

  • added overwrite_model_parameters to all calls of initialize_simulation_models
  • fixed unit tests
  • added an integration test: scale camera_transmission parameter for validate_camera_efficiency application by a factor of 10
  • added a 'scaling' factor in integration tests to allow to compare against a reference file (meaning for this example scaling=10

@GernotMaier
Copy link
Contributor

Note that this type of repetitive changes is what we want do avoid in future using the general settings configuration. I will implement this in a follow-up PR - should remove the many passed on parameters.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (2)

src/simtools/model/model_utils.py:40

  • The docstring for initialize_simulation_models is missing documentation for the new overwrite_model_parameters parameter. Please add a description of this parameter to the Parameters section of the docstring, including its type and purpose.
def initialize_simulation_models(
    label,
    model_version,
    site,
    telescope_name,
    calibration_device_name=None,
    overwrite_model_parameters=None,
):
    """
    Initialize simulation models for a single telescope, site, and calibration device model.

    Parameters
    ----------
    label: str
        Label for the simulation.
    model_version: str
        Version of the simulation model
    site: str
        Name of the site.
    telescope_name: str
        Name of the telescope.
    calibration_device_name: str, optional
        Name of the calibration device.

    Returns
    -------
    Tuple
        Tuple containing the telescope site, (optional) calibration device model.
    """

src/simtools/applications/validate_cumulative_psf.py:140

  • This call to overwrite_parameters_from_file appears to be redundant. The ModelParameter base class (which TelescopeModel inherits from) automatically calls overwrite_parameters_from_file in _load_parameters_from_db if overwrite_model_parameters is provided during initialization. Since tel_model is initialized with overwrite_model_parameters at line 136, the parameters should already be overwritten.
    if app_context.args.get("overwrite_model_parameters"):
        tel_model.overwrite_parameters_from_file(app_context.args["overwrite_model_parameters"])

GernotMaier and others added 3 commits January 21, 2026 13:51
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ctao-sonarqube
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
66.7% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube

@GernotMaier GernotMaier marked this pull request as ready for review January 21, 2026 15:00
Copy link
Contributor

@GernotMaier GernotMaier left a comment

Choose a reason for hiding this comment

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

Not worried about the missing coverage in the plotting routines.

@GernotMaier
Copy link
Contributor

@orelgueta - I cannot add you as a reviewer (as you opened the PR) - please have a look.

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.

3 participants