simtools-derive-psf-parameters#

Derives the mirror alignment parameters using cumulative PSF measurement.

This includes parameters mirror_reflection_random_angle, mirror_align_random_horizontal and mirror_align_random_vertical.

The measured cumulative PSF should be provided by using the command line argument data. A file name is expected, in which the file should contain 3 columns: radial distance in mm, differential value of photon intensity and its integral value.

The derivation is performed through gradient descent optimization that minimizes either the Root Mean Squared Deviation (RMSD) between measured and simulated PSF curves (default) or the Kolmogorov-Smirnov (KS) statistic when the –ks_statistic flag is used.

The optimization workflow includes:

  • Loading and preprocessing PSF data from measurement files

  • Running gradient descent optimization to minimize RMSD

  • Generating cumulative PSF plots for each iteration showing optimization progression

  • Logging parameter evolution through gradient descent steps

  • Creating convergence plots showing RMSD and D80 evolution

  • Automatically generating D80 vs off-axis angle analysis for best parameters

  • Optionally exporting optimized parameters as simulation model files

The assumption are:

  1. mirror_align_random_horizontal and mirror_align_random_vertical are the same.

  2. mirror_align_random_horizontal/vertical have no dependence on the zenith angle.

One example of the plot generated by this applications are shown below.

../../_images/gradient_descent.png

Command line arguments#

site (str, required)

North or South.

telescope (str, required)

Telescope model name (e.g. LST-1, SST-D, …).

model_version (str, optional)

Model version.

parameter_version (str, optional)

Parameter version for model parameter file export.

src_distance (float, optional)

Source distance in km.

zenith (float, optional)

Zenith angle in deg.

data (str, optional)

Name of the data file with the measured cumulative PSF.

plot_all (activation mode, optional)

If activated, plots will be generated for all values tested during tuning.

fixed (activation mode, optional)

Keep the first entry of mirror_reflection_random_angle fixed.

test (activation mode, optional)

If activated, application will be faster by simulating fewer photons.

write_psf_parameters (activation mode, optional)

Write the optimized PSF parameters as simulation model parameter files.

rmsd_threshold (float, optional)

RMSD threshold for gradient descent convergence (default: 0.007).

learning_rate (float, optional)

Learning rate for gradient descent optimization (default: 0.01).

monte_carlo_analysis (activation mode, optional)

Run Monte Carlo analysis to find statistical uncertainties.

Example#

–telescope LSTN-01 –model_version 6.0.0

Run the application:

simtools-derive-psf-parameters --site North --telescope LSTN-01 \\
    --model_version 6.0.0 --data tests/resources/PSFcurve_data_v2.ecsv --plot_all --test

Run with parameter export:

simtools-derive-psf-parameters --site North --telescope LSTN-01 --model_version 6.0.0 \\
    --plot_all --test --rmsd_threshold 0.01 --learning_rate 0.001 \\
    --data tests/resources/PSFcurve_data_v2.ecsv \\
    --write_psf_parameters

Run monte carlo analysis:

simtools-derive-psf-parameters --site North --telescope LSTN-01 --model_version 6.0.0 \\
    --plot_all --test --monte_carlo_analysis \\
    --data tests/resources/PSFcurve_data_v2.ecsv \\
    --write_psf_parameters

The output is saved in simtools-output/derive_psf_parameters.

Output files include:

  • Gradient descent progression log in psf_gradient_descent_[telescope].log

  • Gradient descent convergence plots in gradient_descent_convergence_[telescope].png

  • PSF progression plots showing evolution through iterations (if –plot_all is specified)

  • D80 vs off-axis angle plots (d80_vs_offaxis_cm.png, d80_vs_offaxis_deg.png)

  • Optimized simulation model parameter files (if –write_psf_parameters is specified)

derive_psf_parameters.main()[source]#

Derive PSF parameters.