Project Class

Project Class is all about data. It contains the very data user wants to work with. It stores all the data required for reflectivity calculations. Everything in RAT comes from projectClass in one way or another. There are many functions that deal with breaking down the data from Project Class into smaller pieces so that they can be used in other parts of the software.

Project Class has lot of other classes that help create objects for inputs. They are :

Note

Most of these classes have the following in common:

  1. They are all called from Project Class.

  2. Methods to add or remove or change an attribute depending on the class.

  3. Methods to find the location based on input value. Finding row when given an attribute’s name or vice versa (Not all of them though).

  4. Display methods.

  5. A ‘toStruct’ method which output the class parameters as a struct.

The methods on the left call the methods on the right in the table.

Method in Project Class

Method in Parameter Class

projectClass.addBulkIn/addBulkOut()

parametersClass.addParameter()

projectClass.removeBulkIn/removeBulkOut()

parametersClass.removeParameter()

projectClass.setBulkIn/setBulkOut()

parametersClass.setParameter()

Although, Project class provides one level higher interface so that one can use addBulkIn and addBulkOut methods from projectClass to set these parameters.

Adding Bulk Out. Can set to a class using projectClass.addBulkOut(BulkIn)
    %                   Name       min     val   max  fit?
    problem.addBulkOut({'SLD SMW',2e-6,2.073e-6,3e-6,true});

Domains Class

RAT currently supports two calculation types (nonPolarised and Domains). The Domains Class is a project class with extra parameters (domainRatio, domainContrasts) for the Domains calculation.

Note

It is recommended to use API.createProject instead of creating a Project or Domains object directly.

Reference

API.createProject(options)

Creates a project object. The input arguments are the experiment name which is a char array; the calculation type, which is a calculationTypes enum; the model type, which is a modelTypes enum; the geometry, which is a geometryOptions enum; and a logical to state whether or not absorption terms are included in the refractive index. All of the arguments are optional.

project = createProject(name=’New experiment’, calc=’non polarised’);

class API.projectClass.projectClass(experimentName, calculationType, modelType, geometry, absorption)
addBackground(varargin)

Adds a background to the project. Expects a cell array with background name and type and up to 4 parameters

project.addBackground(‘name’, ‘constant’, ‘par’);

addBackgroundParam(varargin)

Adds a new background parameter. A parameter consists of a name, min, value, max, fit flag, prior type’, mu, and sigma

project.addBackgroundParam(‘Backs Value D2O’, 1e-8, 2.8e-6, 1e-5);

addBulkIn(varargin)

Adds a new bulk-in parameter. Expects the name of bulk-in, min, value, max, and if fit is off or on

project.addBulkIn(‘Silicon’, -1e-6, 0.0, 1e-6, true);

addBulkOut(varargin)

Adds a new bulk-out parameter. Expects the name of bulk-out, min, value, max, and if fit is off or on

project.addBulkOut(‘SLD ACMW’, -1e-6, 0.0, 1e-6, true);

addContrast(varargin)

Adds a new contrast parameter. Expects a parameter name, and with key-value pairs with one or more of the following “data”, “background”, “bulk in”, “bulk out”, “scalefactor”, “resolution”, “resample”, “model”

project.addContrast(‘contrast 1’, ‘bulkIn’, ‘Silicon’);

addCustomFile(varargin)

Adds a new custom file parameter. Expects a parameter name, filename, language (matlab, octave, or cpp), and working directory

project.addCustomFile(‘model 1’, ‘custom.m’, ‘matlab’, pwd);

addData(varargin)

Adds a new data parameter. Expects the name of data and the data array

project.addData(‘Sim 2’, data);

addLayer(varargin)

Adds a single layer to the layers object. Expects layer details which are name, thickness, SLD, roughness, hydration, and hydrate with, or provide with no details, or just a name, to create an empty layer.

project.addLayer(‘New Layer’);

addLayerGroup(layerGroup)

Adds a group of layers to the layers object. Expects a cell array of layer cell arrays

project.addLayerGroup({{‘Layer 1’}, {‘Layer 2’}});

addParameter(varargin)

Adds an individual parameter to the parameters object. Check how many parameters we are adding and make sure all the inputs are cells. A parameter consists of a name, min, value, max, fit flag, prior type’, mu, and sigma. The input is optional but if provided should contain 1, 2, 4, 5, or 8 values of the parameter to added.

project.addParameter(‘Tails Roughness’);

addParameterGroup(paramGroup)

Adds a group of parameters to the parameters object. Expects a cell array of parameter cell arrays.

project.addParameterGroup({{‘Tails Thickness’}, {‘Heads Thickness’}});

addResolution(varargin)

Adds a resolution to the project. Expects a cell array with resolution name and type and up to 4 parameters

project.addResolution(‘name’,’constant’,’par’);

addResolutionParam(varargin)

Adds a new resolution parameter. A parameter consists of a name, min, value, max, fit flag, prior type’, mu, and sigma

project.addResolutionParam(‘Resolution Param 1’, 1e-8, 2.8e-6, 1e-5);

addScalefactor(varargin)

Adds a new scale factor parameter. Expects the name of scale factor, min, value, max, and if fit is off or on

project.addScalefactor(‘Scalefactor 2’, 0.1, 0.19, 1.0, true);

background

backgroundsClass object

bulkIn

parametersClass object

bulkOut

parametersClass object

contrasts

contrastsClass object

customFile

Custom file object

data

dataClass object

delete()

Destroys the wrappers

getAllAllowedNames()

Returns a cell array of all currently set parameter names for the project.

layers

layersClass object

parameters

parametersClass object

projectClass(experimentName, calculationType, modelType, geometry, absorption)

Creates a Project object. The input arguments are the experiment name which is a char array; the calculation type, which is a calculationTypes enum; the model type, which is a modelTypes enum; the geometry, which is a geometryOptions enum; and a logical to state whether or not absorption terms are included in the refractive index. All of the arguments are optional.

project = projectClass(‘New experiment’);

removeBackground(row)

Removes background from the project. Expects index or array of indices of background(s) of background(s) to remove

project.removeBackground(1);

removeBackgroundParam(varargin)

Removes a given background parameter. Expects index or name of parameter to remove

project.removeBackgroundParam(2);

removeBulkIn(varargin)

Removes specified bulk-in parameter. Expects the name/index of bulk-in to remove

project.removeBulkIn(2);

removeBulkOut(varargin)

Removes specified bulk-out parameter. Expects the name/index of bulk-out to remove

project.removeBulkOut(2);

removeContrast(row)

Removes a specified contrast parameter. Expects index or name of resolution to remove

project.removeContrast(1);

removeCustomFile(row)

Removes custom file entry(ies) from the custom files object. Expects index of entry(ies) to remove.

project.removeCustomFile(1);

removeData(row)

Removes a dataset. Expects the index or array of indices of dataset(s) to remove.

project.removeData(2);

removeLayer(layer)

Removes layer(s) from the layers object. Expects index of layer(s) to remove.

project.removeLayer(1);

removeParameter(row)

Removes a parameter from the parameters object. The parameter will also be removed from the layers array if it is in use. Expects series of indices or names of parameters to remove

project.removeParameter(2);

removeResolution(row)

Removes resolution from the project. Expects index of resolution to remove

project.removeResolution(1);

removeResolutionParam(varargin)

Removes a given resolution parameter. Expects index or name of parameter to remove

project.removeResolutionParam(2);

removeScalefactor(varargin)

Removes specified scale factor parameter. Expects the name/index of scale factor to remove

project.removeScalefactor(2);

resolution

resolutionClass object

scalefactors

parametersClass object

setBackground(row, varargin)

Sets the value of an existing background. Expects index or name of background and keyword/value pairs to set

project.setBackground(1, ‘name’, ‘Background ACMW’);

setBackgroundName(row, name)

Sets the name of an existing Background. Expects index or name of background and the new name

project.setBackgroundName(2, ‘new name’);

setBackgroundParam(varargin)

Sets the value of an existing background parameter. Expects index or name of parameter and keyword/value pairs to set

project.setBackgroundParam(1, ‘name’, ‘Backs Value H2O’);

setBackgroundParamLimits(row, min, max)

Sets the constraints of existing background parameter. Expects index or name of parameter and new min and max of the parameter’s value

project.setBackgroundParamLimits(1, 0, 1);

setBackgroundParamName(row, name)

Sets the name of an existing background parameter. Expects index or name of parameter and the new name

project.setBackgroundParamName(2, ‘new name’);

setBackgroundParamValue(row, value)

Sets the value of existing background parameter. Expects index or name of parameter and new value to set

project.setBackgroundParamValue(1, 5.5e-6);

setBulkIn(varargin)

Edits an existing bulk-in parameter. Expects the index of bulk-in to edit and key-value pairs

project.setBulkIn(1, ‘name’, ‘Silicon’, ‘max’, 2.07e-6);

setBulkOut(varargin)

Edits an existing bulk-out parameter. Expects the index of bulk-out to edit and key-value pairs

project.setBulkOut(1, ‘name’, ‘SLD H2O’, ‘min’, 2.07e-6);

setContrast(row, varargin)

Allow setting of all parameters in terms of name value pairs. First input must be contrast number or name, subsequent inputs are name / value pairs for the parts involved

project.setContrast(1, ‘name’, ‘contrast’)

setContrastModel(row, model)

Edits the model of an existing contrast parameter. Expects the index of contrast parameter and cell array of layer names

project.setContrastModel(1, {‘layer 1’})

setCustomFile(row, varargin)

Edits an existing custom file parameter. Expects the index of custom file to edit and key-value pairs

project.setCustomFile(2, ‘filename’, ‘custom.cpp’);

setData(varargin)

Edits an existing data parameter. Expects the index of data to edit and key-value pairs

project.setData(1, ‘name’, ‘Sim 1’, ‘data’, zeros(4, 3));

setGeometry(geometry)

Sets the experiment geometry. The geometry should be a string, either “Air/Substrate” or “Substrate/Liquid” is permitted.

project.setGeometry(‘Substrate/liquid’);

setLayerValue(row, col, value)

Sets a value of a given layer. Expects the row/name and column of layer value to set, then the name/index of the parameter to set the value to.

project.setLayerValue(1, 2, ‘Tails Thickness’);

setModelType(modelType)

Sets the experiment type. The type should be a string, either “standard layers”, “custom layers”, or “custom xy” is permitted.

project.setModelType(‘Custom Layers’);

setParameter(row, varargin)

General purpose set parameter method. Expects index or name of parameter and keyword/value pairs to set

project.setParameter(2, ‘value’, 50);

setParameterFit(row, fitFlag)

Sets the ‘fit’ to off or on for parameter. Expects index or name of parameter and new fit flag

project.setParameterFit(2, true);

setParameterLimits(row, min, max)

Sets the limits of an existing parameter. Expects index or name of parameter and new min and max of the parameter’s value

project.setParameterLimits(2, 0, 100);

setParameterName(row, name)

Sets the name of an existing parameter Expects index or name of parameter and the new name

project.setParameterName(2, ‘new name’);

setParameterPrior(row, varargin)

Sets the prior type of the parameter. Expects index or name of parameter and new prior type(‘uniform’,’gaussian’,’jeffreys’)

project.setParameterPrior(2, ‘uniform’);

setParameterValue(row, value)

Sets the value of a given parameter. Expects index or name of parameter and new value to set

project.setParameterValue(2, 50);

setResolution(row, varargin)

Sets the value of an existing resolution. Expects index or name of resolution and keyword/value pairs to set

project.setResolution(1, ‘name’, ‘Resolution ACMW’);

setResolutionName(row, name)

Sets the name of an existing resolution. Expects index or name of resolution and the new name

project.setResolutionName(2, ‘new name’);

setResolutionParam(varargin)

Sets the value of an existing resolution parameter. Expects index or name of parameter and keyword/value pairs to set

project.setResolutionParam(1, ‘name’, ‘Resolution Param’);

setResolutionParamLimits(row, min, max)

Sets the constraints of existing resolution parameter. Expects index or name of parameter and new min and max of the parameter’s value

project.setResolutionParamLimits(1, 0, 1);

setResolutionParamName(row, name)

Sets the name of an existing resolution parameter. Expects index or name of parameter and the new name

project.setResolutionParamName(2, ‘new name’);

setResolutionParamValue(row, value)

Sets the value of existing resolution parameter. Expects index or name of parameter and new value to set

project.setResolutionParamValue(1, 5.5e-6);

setScalefactor(varargin)

Edits an existing scale factor parameter. Expects the index of scale factor to edit and key-value pairs

project.setScalefactor(1, ‘name’,’Scalefactor 1’, ‘value’, 0.23251);

setUsePriors(showFlag)

Sets the use priors flag. The showFlag should be a boolean/logical.

project.setUsePriors(true);

toDomainsClass()

Alias of the converter routine from projectClass to domainsClass. This routine takes the currently defined project and converts it to a domains calculation, preserving all currently defined properties.

domainsProject = project.toDomainsClass();

toStruct()

Converts the class parameters into a struct array for input into the RAT toolbox

writeScript(options)

Writes a MATLAB script that can be run to reproduce this projectClass object.

project.writeScript(script = “newScript.m”);

class API.projectClass.domainsClass(experimentName, calculationType, modelType, geometry, absorption)
addDomainContrast(varargin)

Adds a new domainContrast parameter. Expects a parameter name, and with key-value pairs with one or more of the following “bulk in”, “bulk out”, “model”

project.addDomainContrast(‘domainContrast 1’, ‘bulkIn’, ‘Silicon’);

addDomainRatio(varargin)

Adds a new domain ratio parameter. Expects the name of domain ratio, min, value, max, and if fit is off or on

project.addDomainRatio(‘Domain Ratio 2’, 0.4, 0.5, 0.6, true);

domainContrasts

Modified contrast class with no data for domains

domainRatio

Class for specifying the ratio between domains

domainsClass(experimentName, calculationType, modelType, geometry, absorption)

Creates a Project object for a domains calculation. The input arguments are the experiment name which is a char array; the calculation type, which is a calculationTypes enum; the model type, which is a modelTypes enum; the geometry, which is a geometryOptions enum; and a logical to state whether or not absorption terms are included in the refractive index. All of the arguments are optional.

project = domainsClass(‘New experiment’);

getAllAllowedNames()

Returns a cell array of all currently set parameter names for the project.

removeDomainContrast(row)

Removes a specified domainContrast parameter. Expects index or name of resolution to remove

project.removeDomainContrast(1);

removeDomainRatio(varargin)

Removes specified domain ratio parameter. Expects the name/index of domain ratio to remove

project.removeDomainRatio(2);

setContrastModel(row, model)

Edits the model of an existing contrast parameter. Expects the index of contrast parameter and cell array of layer names

project.setContrastModel(1, {‘layer 1’})

setDomainContrast(row, varargin)

Allow setting of all parameters in terms of name value pairs. First input must be domainContrast number or name, subsequent inputs are name / value pairs for the parts involved

project.setContrast(1, ‘name’, ‘domainContrast’)

setDomainContrastModel(row, model)

Edits the model of an existing contrast parameter. Expects the index of contrast parameter and cell array of layer names

project.setDomainContrastModel(1, {‘layer 1’})

setDomainRatio(varargin)

Edits an existing domain ratio parameter. Expects the index of domain ratio to edit and key-value pairs

project.setDomainRatio(1, ‘name’,’Domain Ratio 1’, ‘value’, 0.55);

setModelType(modelType)

Sets the experiment type. The type should be a string, either “standard layers”, “custom layers”, or “custom xy” is permitted.

project.setModelType(‘Custom Layers’);

toProjectClass()

Alias of the converter routine from domainsClass to projectClass. This routine takes the currently defined project and converts it to a nonPolarised calculation, preserving all currently defined properties.

nonPolarisedProject = project.toProjectClass();

toStruct()

Converts the domains class parameters into a struct array for input into the RAT toolbox