Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/simtools/applications/calculate_incident_angles.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ def main():
output_dir,
label_with_telescope,
debug_plots=app_context.args.get("debug_plots", False),
model_version=app_context.args.get("model_version", None),
)
total = sum(len(t) for t in results_by_offset.values())
summary_msg = (
Expand Down
1 change: 1 addition & 0 deletions src/simtools/applications/validate_optics.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def main():
site=app_context.args["site"],
telescope_name=app_context.args["telescope"],
model_version=app_context.args["model_version"],
overwrite_model_parameters=app_context.args.get("overwrite_model_parameters"),
)

app_context.logger.info(
Expand Down
10 changes: 9 additions & 1 deletion src/simtools/model/model_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@


def initialize_simulation_models(
label, model_version, site, telescope_name, calibration_device_name=None
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.
Expand Down Expand Up @@ -38,18 +43,21 @@ def initialize_simulation_models(
telescope_name=telescope_name,
model_version=model_version,
label=label,
overwrite_model_parameters=overwrite_model_parameters,
)
site_model = SiteModel(
site=site,
model_version=model_version,
label=label,
overwrite_model_parameters=overwrite_model_parameters,
)
if calibration_device_name is not None:
calibration_model = CalibrationModel(
site=site,
calibration_device_model_name=calibration_device_name,
model_version=model_version,
label=label,
overwrite_model_parameters=overwrite_model_parameters,
)
else:
calibration_model = None
Expand Down
26 changes: 26 additions & 0 deletions src/simtools/visualization/plot_incident_angles.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ def _plot_component_angles(
out_path,
bin_width_deg,
log,
model_version=None,
):
arrays = _gather_angle_arrays(results_by_offset, column, log)
if not arrays:
Expand All @@ -365,6 +366,17 @@ def _plot_component_angles(
ax.set_title(f"Incident angle {title_suffix} vs off-axis angle")
ax.grid(True, alpha=0.3)
ax.legend()
if model_version:
ax.text(
0.03,
0.97,
f"Model version: {model_version}",
transform=ax.transAxes,
fontsize=8,
verticalalignment="top",
horizontalalignment="left",
bbox={"boxstyle": "round", "facecolor": "white", "alpha": 0.5},
)
plt.tight_layout()
plt.savefig(out_path, dpi=300)
plt.close(fig)
Expand All @@ -378,6 +390,7 @@ def plot_incident_angles(
radius_bin_width_m=0.01,
debug_plots=False,
logger=None,
model_version=None,
):
"""Plot overlaid histograms of focal, primary, secondary angles, and primary hit radius."""
log = logger or logging.getLogger(__name__)
Expand All @@ -402,6 +415,17 @@ def plot_incident_angles(
ax.set_title("Incident angle distribution vs off-axis angle")
ax.grid(True, alpha=0.3)
ax.legend()
if model_version:
ax.text(
0.03,
0.97,
f"Model version: {model_version}",
transform=ax.transAxes,
fontsize=8,
verticalalignment="top",
horizontalalignment="left",
bbox={"boxstyle": "round", "facecolor": "white", "alpha": 0.5},
)
plt.tight_layout()
plt.savefig(out_dir / f"incident_angles_multi_{label}.png", dpi=300)
plt.close(fig)
Expand All @@ -414,6 +438,7 @@ def plot_incident_angles(
out_path=out_dir / f"incident_angles_primary_multi_{label}.png",
bin_width_deg=bin_width_deg,
log=log,
model_version=model_version,
)
_plot_component_angles(
results_by_offset=results_by_offset,
Expand All @@ -422,6 +447,7 @@ def plot_incident_angles(
out_path=out_dir / f"incident_angles_secondary_multi_{label}.png",
bin_width_deg=bin_width_deg,
log=log,
model_version=model_version,
)

# Debug plots
Expand Down
Loading