Contrasts Class#
The Contrasts Class is a class to manipulate contrasts, which describe a single “experimental sample” (e.g. a level of deuteration).
- class API.projectClass.contrastsClass(isDomains)#
This class holds the parameters for each contrast used in the simulation
Examples
>>> contrasts = contrastsClass(); >>> contrasts = contrastsClass(true);
- Parameters:
isDomains (
logical, default: false
) – Indicates if the contrast object is for a domains project.
- contrasts#
A cell containing all the contrast entries.
- Type:
cell
- parseContrastInput(allowedNames, inputValues)#
Parses the given keyword/value pairs of properties for the contrast, assigning default values to those unspecified and ensuring specified values are of the correct type, and included in the list of allowed names where necessary.
- Parameters:
allowedNames (
struct
) – A struct containing the valid names that can be referenced in the contrast.inputValues (
cell
) – A cell containing keyword/value pairs of properties for the contrast.
- Returns:
inputBlock – A struct containing the given properties of the contrast.
- Return type:
struct
- setDefaultValues(contrast)#
Sets default values to empty fields when adding a contrast.
- Parameters:
contrast (
struct
) – A struct containing properties of the contrast.- Returns:
contrast – A struct containing properties of the contrast with empty fields set to default.
- Return type:
struct
- toStruct(allowedNames, modelType, dataTable)#
Converts the contrasts class to a struct.
- Parameters:
allowedNames (
struct
) – A struct containing the valid names that can be referenced in the contrast.modelType (
modelTypes
) – The layer model type which can be ‘standard layers’, ‘custom layers’, or ‘custom xy’.dataTable (
table
) – A table from the dataClass.
- Returns:
contrastStruct – A struct which contains the properties for all the contrast entries.
- Return type:
struct
- updateDataName(nameChange)#
Update the “data” parameter in a contrast if the name is changed in the data class. This function is only really called from projectClass if a data name has been updated. It looks through the ‘data’ field of the contrasts and if it matches nameChange.oldName then this is updated to nameChange.newName
- Parameters:
nameChange (
struct
) – A struct which contains the former nameoldName
and the new namenewName
of the dataset or an empty array if name is not changed
- class API.projectClass.domainContrastsClass#
A simplified version of the contrast class that allows specification of the model only (i.e. with no data). This is used for domains calculations.
- parseContrastInput(allowedNames, inputValues)#
Parse the parameters given for the contrast, assigning default values to those unspecified and ensuring specified values are of the correct type, and included in the list of allowed names where necessary.
- Parameters:
allowedNames (
struct
) – A struct containing the valid names that can be referenced in the contrast.inputValues (
cell
) – A cell containing keyword/value pairs of properties for the contrast.
- Returns:
inputBlock – A struct containing properties of the contrast with empty fields set to default.
- Return type:
struct
- toStruct(allowedNames, ~, ~)#
Converts the domains contrasts class to a struct.
- Parameters:
allowedNames (
struct
) – A struct containing the valid names that can be referenced in the contrast.- Returns:
contrastStruct – A struct which contains the properties for all the contrast entries.
- Return type:
struct