Models#
The models module. Contains the pydantic models used by RAT to store project parameters.
- pydantic model RATapi.models.AbsorptionLayer#
A slab model layer with a non-negligible absorption term.
- Parameters:
name (str) – The name of this layer.
thickness (str) – The name of the parameter describing the thickness of this layer.
SLD_real (str) – The name of the parameter describing the real (scattering) term for the scattering length density of this layer.
SLD_imaginary (str) – The name of the parameter describing the imaginary (absorption) term for the scattering length density of this layer.
roughness (str) – The name of the parameter describing the roughness of this layer.
hydration (str)
hydrate_with (str)
- Fields:
SLD_imaginary (str)
SLD_real (str)
hydrate_with (RATapi.utils.enums.Hydration)
hydration (str)
name (str)
roughness (str)
thickness (str)
- pydantic model RATapi.models.Background#
A background signal.
- Parameters:
name (str) – The name of the background.
type (TypeOptions) – The type of background (constant, function or data)
source (str) –
The source of the background;
if type is ‘constant’, this should be the name of a background parameter.
if type is ‘data’, this should be the name of a dataset defined in Project.data.
if type is ‘function’, this should be the name of a custom function defined in Project.custom_files.
value_1 (str) –
Values required by the background.
if type is ‘constant’, all values will be ignored.
if type is ‘data’, value_1 may be the parameter name for an optional offset. Other values are ignored.
if type is ‘function’, these values may be the names of up to 5 parameters which are passed to the function.
value_2 (str) –
Values required by the background.
if type is ‘constant’, all values will be ignored.
if type is ‘data’, value_1 may be the parameter name for an optional offset. Other values are ignored.
if type is ‘function’, these values may be the names of up to 5 parameters which are passed to the function.
value_3 (str) –
Values required by the background.
if type is ‘constant’, all values will be ignored.
if type is ‘data’, value_1 may be the parameter name for an optional offset. Other values are ignored.
if type is ‘function’, these values may be the names of up to 5 parameters which are passed to the function.
value_4 (str) –
Values required by the background.
if type is ‘constant’, all values will be ignored.
if type is ‘data’, value_1 may be the parameter name for an optional offset. Other values are ignored.
if type is ‘function’, these values may be the names of up to 5 parameters which are passed to the function.
value_5 (str) –
Values required by the background.
if type is ‘constant’, all values will be ignored.
if type is ‘data’, value_1 may be the parameter name for an optional offset. Other values are ignored.
if type is ‘function’, these values may be the names of up to 5 parameters which are passed to the function.
- Fields:
name (str)
source (str)
type (RATapi.utils.enums.TypeOptions)
value_1 (str)
value_2 (str)
value_3 (str)
value_4 (str)
value_5 (str)
- pydantic model RATapi.models.Contrast#
A group of all of the components of a model.
- Parameters:
name (str) – The name of the contrast.
data (str) – The name of the dataset used by the contrast.
background (str) – The name of the background for the contrast.
background_action (BackgroundActions) – Whether the background should be added (‘add’) or subtracted (‘subtract’) from the data.
bulk_in (str) – The name of the bulk-in parameter which defines the SLD of the interface between the first layer and the environment.
bulk_out (str) – The name of the bulk-out parameter which defines the SLD of the interface between the last layer and the environment.
scalefactor (str) – The name of the scalefactor which defines how much the data for this contrast should be scaled.
resolution (str) – The name of the instrument resolution for this contrast.
resample (bool) – Whether adaptive resampling should be used for interface microslicing.
model (list[str]) – If this is a standard layers model, this should be a list of layer names that make up the slab model for this contrast. For custom models, this should be a list containing just the custom file name for the custom model function.
- Fields:
background (str)
background_action (RATapi.utils.enums.BackgroundActions)
bulk_in (str)
bulk_out (str)
data (str)
model (list[str])
name (str)
resample (bool)
resolution (str)
scalefactor (str)
- pydantic model RATapi.models.ContrastWithRatio#
A group of all of the components of a model, including domain terms.
- Parameters:
name (str) – The name of the contrast.
data (str) – The name of the dataset used by the contrast.
background (str) – The name of the background for the contrast.
background_action (BackgroundActions) – Whether the background should be added (‘add’) or subtracted (‘subtract’) from the data.
bulk_in (str) – The name of the bulk-in parameter which defines the SLD of the interface between the first layer and the environment.
bulk_out (str) – The name of the bulk-out parameter which defines the SLD of the interface between the last layer and the environment.
scalefactor (str)
resolution (str) – The name of the instrument resolution for this contrast.
resample (bool) – Whether adaptive resampling should be used for interface microslicing.
domain_ratio (str) – The name of the domain ratio parameter describing how the first domain should be weighted relative to the second.
model (list[str]) – If this is a standard layers model, this should be a list of the names of the two domain contrasts which make up the domain model for this contrast. For custom models, this should be a list containing just the custom file name for the custom model function.
- Fields:
background (str)
background_action (RATapi.utils.enums.BackgroundActions)
bulk_in (str)
bulk_out (str)
data (str)
domain_ratio (str)
model (list[str])
name (str)
resample (bool)
resolution (str)
scalefactor (str)
- pydantic model RATapi.models.CustomFile#
A file containing functions to use for a custom model or function background.
- Parameters:
name (str) – The name of this custom file object.
filename (str) – The name of the file containing the custom function.
function_name (str) – The name of the custom function within the file.
language (Languages) – What language the custom function is written in: ‘matlab’, ‘python’, or ‘cpp’ (C++)
path (pathlib.Path) – The path to the custom file.
- Fields:
filename (str)
function_name (str)
language (RATapi.utils.enums.Languages)
name (str)
path (pathlib.Path)
- pydantic model RATapi.models.Data#
A dataset required for a contrast.
- Parameters:
name (str) – The name of this dataset.
data (np.ndarray[np.float64]) – The (x, y, error) data for this dataset, given as a Numpy array of three columns.
data_range (list[float])
simulation_range (list[float])
- Fields:
data (numpy.ndarray[numpy.float64])
data_range (list[float])
name (str)
simulation_range (list[float])
- pydantic model RATapi.models.DomainContrast#
A group of layers required for a domain.
- Parameters:
name (str) – The name of this domain contrast.
model (list[str]) – A list of layer names that make up the slab model for this contrast.
- Fields:
model (list[str])
name (str)
- pydantic model RATapi.models.Layer#
A slab model layer with given physical properties.
- Parameters:
name (str) – The name of this layer.
thickness (str) – The name of the parameter describing the thickness of this layer.
SLD (str) – The name of the parameter describing the scattering length density of this layer.
roughness (str) – The name of the parameter describing the roughness of this layer.
hydration (str)
hydrate_with (str)
- Fields:
SLD (str)
hydrate_with (RATapi.utils.enums.Hydration)
hydration (str)
name (str)
roughness (str)
thickness (str)
- pydantic model RATapi.models.Parameter#
A parameter needed to specify the model.
- Parameters:
name (str) – The name of this parameter.
min (float) – The minimum value that this parameter could take when fitted.
value (float) – The value of this parameter.
max (float) – The maximum value that this parameter could take when fitted.
fit (bool) – Whether this parameter should be fitted in a calculation.
prior_type (Priors) – For Bayesian calculations, whether the prior likelihood is assumed to be ‘uniform’ or ‘gaussian’.
mu (float) – If the prior type is Gaussian, the mu and sigma values describing the Gaussian function for the prior likelihood.
sigma (float) – If the prior type is Gaussian, the mu and sigma values describing the Gaussian function for the prior likelihood.
- Fields:
fit (bool)
max (float)
min (float)
mu (float)
name (str)
prior_type (RATapi.utils.enums.Priors)
show_priors (bool)
sigma (float)
value (float)
- pydantic model RATapi.models.ProtectedParameter#
A Parameter with a fixed name.
- Fields:
fit (bool)
max (float)
min (float)
mu (float)
name (str)
prior_type (RATapi.utils.enums.Priors)
show_priors (bool)
sigma (float)
value (float)
- pydantic model RATapi.models.Resolution#
An instrument resolution.
- Parameters:
name (str) – The name of the resolution.
type (TypeOptions) – The type of resolution: ‘constant’, ‘data’, or (NOT YET IMPLEMENTED) ‘function’.
source (str) –
The source data for the resolution;
if type is ‘constant’, this should be the name of a background parameter.
if type is ‘data’, this should be empty (resolution data is in the contrast data).
if type is ‘function’ (NOT YET IMPLEMENTED), this should be the name of a custom function defined in Project.custom_files.
value_1 (str) –
Values required by the background.
if type is ‘constant’ or ‘data’, all values will be ignored.
if type is ‘function’ (NOT YET IMPLEMENTED), these values may be the names of up to 5 parameters which are passed to the function.
value_2 (str) –
Values required by the background.
if type is ‘constant’ or ‘data’, all values will be ignored.
if type is ‘function’ (NOT YET IMPLEMENTED), these values may be the names of up to 5 parameters which are passed to the function.
value_3 (str) –
Values required by the background.
if type is ‘constant’ or ‘data’, all values will be ignored.
if type is ‘function’ (NOT YET IMPLEMENTED), these values may be the names of up to 5 parameters which are passed to the function.
value_4 (str) –
Values required by the background.
if type is ‘constant’ or ‘data’, all values will be ignored.
if type is ‘function’ (NOT YET IMPLEMENTED), these values may be the names of up to 5 parameters which are passed to the function.
value_5 (str) –
Values required by the background.
if type is ‘constant’ or ‘data’, all values will be ignored.
if type is ‘function’ (NOT YET IMPLEMENTED), these values may be the names of up to 5 parameters which are passed to the function.
- Fields:
name (str)
source (str)
type (RATapi.utils.enums.TypeOptions)
value_1 (str)
value_2 (str)
value_3 (str)
value_4 (str)
value_5 (str)