gravelamps.core.module_handling

Gravelamps Module Handling

Following are functions that handle modules used within Gravelamps. This is largely an interface used for handling the module that will contain the lensing functions in an agnostic fashion

Written by Mick Wright 2022

Routines

get_lens_module

Retrieves module to be used for lensing functions

check_module

Ascertains the existence of given module

get_interpolator_model

Retrieves module to be used for interpolator functions

Functions

get_lens_module(config, args)

Retrieves module to be used for lensing functions

check_module(module_name)

Ascertains the existence of a given module

get_interpolator_model(config, args)

Retrieves module to be used for interpolator functions

Module Contents

gravelamps.core.module_handling.get_lens_module(config, args)

Retrieves module to be used for lensing functions

The module is specified by the user either as a full python path or as a submodule of gravelamps.lensing. If the module is not supplied at all, it defaults to gravelamps.lensing.interpolator.

Parameters:
configconfigparser.ConfigParser

Object containing settings from INI file

argsargparse.Namespace

Object containing commandline arguments to program

Returns:
lens_moduleModuleType

Module containing the lensing functions

gravelamps.core.module_handling.check_module(module_name)

Ascertains the existence of a given module

Parameters:
module_namestr

full python path of the module to be checked

Returns:
bool

Flag of whether the module exists or not

gravelamps.core.module_handling.get_interpolator_model(config, args)

Retrieves module to be used for interpolator functions

The model for the interpolator should be specified in the INI as either a complete python path or one of the submodules of gravelamps.lensing. Will return None if no module is specified

Parameters:
configconfigparser.ConfigParser

Object containing settings from the INI file

argsargparse.Namespace

Object containing commandline arguments to the program

Returns:
interpolator_modelstr

Full python path to the interpolator model module

Raises:
ModuleNotFoundError

If the full python path as determined by the function cannot be loaded as a module