Contrasts Class#
Contrast Class is a class to responsible to manipulate contrasts. While adding the contrast, the input(cell array) goes through some checks and if no input is given, the contrast is automatically named and counter is incremented. If only name was given, contrast is incremented and the cell array’s name is set to current name.
The cell array of contrasts is sent to Contrast Class to get converted to a struct parseContrastInput method which gets attached to the class object.
problem.addContrast('name','Bilayer / D2O',...
'background','Background D2O',...
'resolution','Resolution 1',...
'scalefactor', 'Scalefactor 1',...
'resample',false,....
'bulkOut', 'SLD D2O',...
'bulkIn', 'Silicon',...
'data', 'Bilayer / D2O');
While setting contrasts to a model, setContrastModel method is called. This method is called with a cell array of a { number , cell array }. The number being what contrast is and the cell array containing the information about the model. The main purpose of this method is to set the contrast to a model based on specified type of model. Based on the type of model, the code checks whether some of the contrast names are allowed or not. If not, it throws an error.
% 1 refers to the contrast number and the rest Layer information
problem.setContrastModel(1,{'Oxide Layer',...
'Water Layer',...
'Bil inner head',...
'Bil tail',...
'Bil tail',...
'Bil outer head'});
Domains Contrasts Class#
The Domains Contrasts Class is a simplified model only contrasts class for the Domains calculation.
Reference#
- class API.projectClass.contrastsClass(calcType)#
- contrastsClass(calcType)#
Class Constructor The (optional) inputs are logical flags to state whether or not this is a domains calculation and wheter or not this is an oil-water calculation.
contrasts = contrastsClass()
- 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.
- contrastsClass.parseContrastInput(allowedNames, …
‘name’, ‘Contrast Name’, … ‘background’, ‘Background H2O’)
- static setDefaultValues(contrast)#
Set non-empty default values when adding a contrast.
- toStruct(allowedNames, modelType, dataTable)#
Convert the contrasts class to a struct. This routine builds on that in the base class by dealing with the additional properties defined in this subclass. The expected input is the allowed names for each parameter, the model type and the data table from the data class.
contrasts.toStruct(allowedNames, ‘standard layers’, dataTable)
- 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
contrasts.updateDataName(nameChange)
- class API.projectClass.domainContrastsClass#
- parseContrastInput(~, ~, 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.
contrastsClass.parseContrastInput(‘name’, ‘Contrast Name’)
- static setDefaultValues(contrast)#
Set non-empty default values when adding a contrast.
- toStruct(allowedNames, ~, ~)#
Convert the contrasts class to a struct. This routine builds on that in the base class by dealing with the additional properties defined in this subclass. The expected input is the allowed names for each parameter.
domainContrasts.toStruct(allowedNames, ~, ~)