gravelamps.lensing.generic

Generic Lensing Functions

Following are functions that are model agnostic and used to interface the specific model forms with the rest of the architecture. Also included is a main running script which forms the minimal program gravelamps_generate_interpolator_data which is included for HTCondor scheduling of lens data generation. This is not generally intended to be run by the user.

Written by Mick Wright 2022

Routines

checkpoint_signal_handler

Exits with checkpointing exit code (85) when receiving checkpoint signal

get_additional_arguments

Retrieves required additional arguments for model specific lens generation

get_condor_config

Generates condor settings from the user INI

generate_interpolator_condor

Builds and, if specified, submits a lens generation run for the HTCondor scheduler

generate_inerpolator_data

Performs lens generation for the specified model in the format needed

Functions

get_additional_arguments(config, args, argument_list, ...)

Retrieves required additional arguments for model specific lens generation

get_condor_config(config, args, output_directories, ...)

Generates HTCondor configuration from user settings in INI

generate_interpolator_condor(args, output_directories, ...)

Builds and, if specified, submits a lens generation run for the HTCondor Scheduler.

generate_interpolator_data(config, args, model, file_dict)

Performs lens generation for the specified model in the format needed.

main()

Forms the program gravelamps_generate_interpolator_data.

Module Contents

gravelamps.lensing.generic.get_additional_arguments(config, args, argument_list, type_list)

Retrieves required additional arguments for model specific lens generation

Parameters:
configconfigparser.ConfigParser

Object containing settings for user INI file

argsargparse.Namespace

Object containing commmandline arguments to program

argument_listList of str

Model specific arguments to retrieve from config file

type_listList of type funcs

Types of the arguments given in argument_list

Returns:
value_listList of objects

Values of the arguments specified in argument_list

gravelamps.lensing.generic.get_condor_config(config, args, output_directories, model, file_dict)

Generates HTCondor configuration from user settings in INI

Parameters:
configconfigparser.ConfigParser

Object containing settings from user INI file

argsargparse.Namespace

Object containing commandline arguments to program

output_directoriesdict

Contains paths to the folders for output

modelstr

Full python path to the lens model

file_dictdict

Contains the paths for the interpolator grid and data files

Returns:
condor_settingsdict

Contains settings used by HTCondor

gravelamps.lensing.generic.generate_interpolator_condor(args, output_directories, condor_settings)

Builds and, if specified, submits a lens generation run for the HTCondor Scheduler.

Parameters:
argsargparse.Namespace

Object containing commandline arguments to program

output_directoriesdict

Contains paths to the folders for output

file_dictdict

Contains paths for interpolator grid and data files

condor_settingsdict

Contains the settings for HTCondor to use

gravelamps.lensing.generic.generate_interpolator_data(config, args, model, file_dict)

Performs lens generation for the specified model in the format needed.

Lens generation can be done in one of three ways — it can be done locally from the generate_interpolator_data function for the model if it has it, it can be done locally from the amplification_factor function directly if the model is sufficiently speedy to not need a specific interpolator generation function, or it can generate an HTCondor DAG file to run one of these should scheduling be required.

Parameters:
configconfigparser.ConfigParser

Object containing settings from user INI file

argsargparse.Namespace

Object containing commandline arguments to program

modelstr

Full python path to the lensing model

file_dictdict

Contains paths for interpolator grid and data files

Raises:
AttributeError

Occurs when no data generation functions exist within model module

gravelamps.lensing.generic.main()

Forms the program gravelamps_generate_interpolator_data.

This program is not intended to be run directly by the user, instead it is a minimal function that will be called by the HTCondor scheduler when it is being used. Users should use the more full features gravelamps_generate_lens program. If run, however, it will use the specified file dictionary and output to generate lens data directly.