simtools-convert-all-model-parameters-from-simtel#

Convert all simulation model parameters exported from sim_telarray format.

Check value, type, and range, convert units using schema files. Write json files ready to be submitted to the model database. Prints out parameters which are not found in simtel configuration file and parameters which are not found in simtools schema files.

Note that all parameters are assigned the same parameter version.

Command line arguments#

simtel_cfg_file (str)

File name of sim_telarray configuration file containing all simulation model parameters.

simtel_telescope_name (str)

Name of the telescope in the sim_telarray configuration file.

telescope (str, optional)

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

skip_parameter (str, optional)

List of parameters to be skipped (use sim_telarray names).

Example#

To export the model parameters from sim_telarray, first copy and unpack the configuration tar ball from sim_telarray (usually called ‘sim_telarray_config.tar.gz’) to the sim_telarray working directory. Extract the configuration using the following command:

./sim_telarray/bin/sim_telarray -c sim_telarray/cfg/CTA/CTA-PROD6-LaPalma.cfg \\
    -C limits=no-internal -C initlist=no-internal -C list=no-internal \\
    -C typelist=no-internal -C maximum_telescopes=30 -DNSB_AUTOSCALE \\
    -DNECTARCAM -DHYPER_LAYOUT -DNUM_TELESCOPES=30 /dev/null \\
    2>|/dev/null | grep '(@cfg)' | sed 's/^(@cfg) //' >| all_telescope_config_la_palma.cfg

./sim_telarray/bin/sim_telarray -c sim_telarray/cfg/CTA/CTA-PROD6-Paranal.cfg \\
    -C limits=no-internal -C initlist=no-internal -C list=no-internal \\
    -C typelist=no-internal -C maximum_telescopes=87 -DNSB_AUTOSCALE \\
    -DFLASHCAM -DHYPER_LAYOUT -DNUM_TELESCOPES=87 /dev/null \\
    2>|/dev/null | grep '(@cfg)' | sed 's/^(@cfg) //' >| all_telescope_config_paranal.cfg

Extract then model parameters from the simtel_array configuration file for LSTN-01 (telescopes are named CT1, CT2, …, in the sim_telarray configuration file and must be provided in the “simtel_telescope_name” command line argument) and write json files in the same format as the model parameter database:

simtools-convert-all-model-parameters-from-simtel \\
   --simtel_cfg_file all_telescope_config_la_palma.cfg\\
   --simtel_telescope_name CT1\\
   --telescope LSTN-01\\
   --parameter_version "1.0.0"\\
   --output_path /path/to/output
convert_all_model_parameters_from_simtel.get_number_of_camera_pixel(args_dict, logger)[source]#

Get the number of camera pixels from the simtel configuration file.

Required to set the dimension some of the parameter correctly, as simtel in some cases does not provide the dimension (‘all:’ in the parameter files).

Parameters:
args_dict: dict

Dictionary with command line arguments.

logger: logging.Logger

Logger object

Returns:
int, None

Number of camera pixels (None if file is not found)

convert_all_model_parameters_from_simtel.print_list_of_files(args_dict, logger)[source]#

Print model parameters which describe a file name.

This is useful to find files which are part of the model.

Parameters:
args_dict: dict

Dictionary with command line arguments.

logger: logging.Logger

Logger object

convert_all_model_parameters_from_simtel.print_parameters_not_found(_parameters_not_in_simtel, _simtel_parameters, args_dict, logger)[source]#

Print simtel/simtools parameter not found in schema and configuration files.

For simtel parameters not found, check if the setting for the chose telescope is different from the default values.

Parameters:
_parameters_not_in_simtel: list

List of simtel parameters not found in schema files.

_simtel_parameters: list

List of simtel parameters not found in simtools schema files.

args_dict: dict

Dictionary with command line arguments.

logger: logging.Logger

Logger object

convert_all_model_parameters_from_simtel.read_and_export_parameters(args_dict, logger)[source]#

Read and export parameters from simtel configuration file to json files.

Provide extensive logging information on the parameters found in the simtel configuration file.

Parameters:
args_dict: dict

Dictionary with command line arguments.

logger: logging.Logger

Logger object

Returns:
list

List of simtel parameters not found in schema files.

list

List of simtools parameter not found in simtel configuration file.

convert_all_model_parameters_from_simtel.read_simtel_config_file(args_dict, schema_file, camera_pixels=None)[source]#

Read the simtel configuration file.

Parameters:
args_dict: dict

Dictionary with command line arguments.

schema_file: str

Schema path name.

camera_pixels: int

Number of camera pixels.

Returns:
SimtelConfigReader, None

SimtelConfigReader object (None if parameter not found)