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 telescope zenith angle and the source distance can be set by command line arguments.

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 a random search. A number of random combination of the parameters are tested and the best ones are selected based on the minimum value of the Root Mean Squared Deviation between data and simulations. The range in which the parameter are drawn uniformly are defined based on the previous value on the telescope model.

The optimization workflow includes:

  • Loading and preprocessing PSF data from measurement files

  • Generating random parameter combinations for optimization

  • Running ray-tracing simulations for each parameter set

  • Calculating RMSD between measured and simulated PSF curves

  • Identifying the best-fit parameters with minimum RMSD

  • Creating comprehensive plots and D80 vs off-axis angle analysis

  • 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/derive_psf_parameters.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.

random_seed (int, optional)

Random seed for parameter generation.

n_runs (int, optional)

Number of parameter combinations to test.

Example#

LSTN-01 5.0.0

Runtime < 3 min.

Get PSF data from the DB:

simtools-db-get-file-from-db --file_name PSFcurve_data_v2.txt

Run the application:

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

Run with parameter export:

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

The output is saved in simtools-output/tune_psf.

Output files include:

  • Parameter optimization results in tested_psf_parameters.txt

  • PSF comparison plots in tune_psf_[telescope].pdf

  • 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)

  • Cumulative PSF plots for all tested combinations (if –plot_all is specified)