Inputs#
This module contains the objects used to organise input data to RAT to be fed into the C++ module.
Converts python models to the necessary inputs for the compiled RAT code
- class RATapi.inputs.FileHandles(files=None)#
Class to defer creation of custom file handles.
- Parameters:
files (ClassList[CustomFile]) – A list of custom file models.
- get_handle(index)#
Returns file handle for a given custom file.
- Parameters:
index (int) – The index of the custom file.
- RATapi.inputs.append_data_background(data, background)#
Append background data to contrast data.
- Parameters:
data (np.array) – The contrast data to which we are appending a background.
background (np.array) – The background data to append to the contrast.
- Returns:
The contrast data with background data appended as two additional columns.
- Return type:
np.array
- RATapi.inputs.check_indices(problem)#
Checks the indices in contrast lists in a ProblemDefinition object lie within the range of the corresponding parameter lists.
- Parameters:
problem (RAT.rat_core.ProblemDefinition) – The problem input used in the compiled RAT code.
- Return type:
None
- RATapi.inputs.get_python_handle(file_name, function_name, path='')#
Get the function handle from a function defined in a python module located anywhere within the filesystem.
- Parameters:
file_name (str) – The name of the file containing the function of interest.
function_name (str) – The name of the function we wish to obtain the handle for within the module.
path (str) – The path to the file containing the function (default is “”, which represent the working directory).
- Returns:
handle – The handle of the function defined in the python module file.
- Return type:
Callable
- RATapi.inputs.make_controls(input_controls)#
Converts the controls object to the format required by the compiled RAT code.
- Parameters:
input_controls (RAT.Controls) – The controls model, which defines algorithmic properties.
checks (Rat.rat_core.Checks) – States whether or not to fit each parameter defined in the project.
- Returns:
controls – The controls object used in the compiled RAT code.
- Return type:
RAT.rat_core.Control
- RATapi.inputs.make_data_present(project)#
Constructs the “dataPresent” field of the problem input required for the compiled RAT code.
- Parameters:
project (RAT.Project) – The project model, which defines the physical system under study.
- Returns:
The “dataPresent” field of the problem input used in the compiled RAT code.
- Return type:
list[int]
- RATapi.inputs.make_input(project, controls)#
Constructs the inputs required for the compiled RAT code using the data defined in the input project and controls.
- Parameters:
project (RAT.Project) – The project model, which defines the physical system under study.
controls (RAT.Controls) – The controls model, which defines algorithmic properties.
- Returns:
problem (RAT.rat_core.ProblemDefinition) – The problem input used in the compiled RAT code.
limits (RAT.rat_core.Limits) – A list of min/max values for each parameter defined in the project.
priors (RAT.rat_core.Priors) – The priors defined for each parameter in the project.
cpp_controls (RAT.rat_core.Control) – The controls object used in the compiled RAT code.
- Return type:
tuple[ProblemDefinition, Limits, Priors, Control]
- RATapi.inputs.make_problem(project, checks)#
Constructs the problem input required for the compiled RAT code.
- Parameters:
project (RAT.Project) – The project model, which defines the physical system under study.
checks (Checks)
- Returns:
problem – The problem input used in the compiled RAT code.
- Return type:
RAT.rat_core.ProblemDefinition
- RATapi.inputs.make_resample(project)#
Constructs the “resample” field of the problem input required for the compiled RAT code.
- Parameters:
project (RAT.Project) – The project model, which defines the physical system under study.
- Returns:
The “resample” field of the problem input used in the compiled RAT code.
- Return type:
list[int]