convert_all_model_parameters_from_simtel#

Convert all simulation model parameters exported from sim_telarray format using schema files.

Check value, type, and range, convert units, and 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.

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, …)

Example#

Extract model parameters with schema files from simtel configuration file (requires access to the model parameter repository)

simtools-convert-all-model-parameters-from-simtel \\
   --schema_directory ../model_parameters/schema\\
   --simtel_cfg_file all_telescope_config_la_palma.cfg\\
   --simtel_telescope_name CT1\\
   --telescope LSTN-01\\
   --model_version "2024-03-06"

The export of the model parameters from sim_telarray for 6.0.0 can be done e.g., as follows:

./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)'  >| 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)'  >| all_telescope_config_paranal.cfg
convert_all_model_parameters_from_simtel.get_list_of_parameters_and_schema_files(schema_directory)[source]#

Return list of parameters and schema files located in schema file directory.

Returns:
list

List of parameters found in schema file directory.

list

List of schema files found in schema file directory.

convert_all_model_parameters_from_simtel.get_list_of_simtel_parameters(simtel_config_file, logger)[source]#

Return list of simtel parameters found in simtel configuration file.

Parameters:
simtel_config_file: str

File name for sim_telarray configuration

logger: logging.Logger

Logger object

Returns:
list

List of parameters found in simtel configuration file.

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 ocnfiguration 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.

Only applicable parameters are exported to json. 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, logger, schema_file, camera_pixels=None)[source]#

Read the simtel configuration file.

Parameters:
args_dict: dict

Dictionary with command line arguments.

logger: logging.Logger

Logger object

schema_file: str

Schema path name.

camera_pixels: int

Number of camera pixels.