Resolutions Class#
Resolutions are defined in a two stage process. Firstly, actual fitted parameters are defined. These are held in a ‘Parameter Class’ table (referring to data type). Then, these are grouped into the resolutions themselves using a multi-type table. Then the resolution parameters can be used to either define resolution as constant, data, or a function.
The constructor is called with the parameters and resolutions as input. The parameters are stored in the resolPars table whereas the resolutions are stored in the resolutions table and the allowed types are defined in the allowedTypes variable.
Note
For constant only one parameter is supplied to multi-type table.
For data, the name is supplied, along with name of the data in the data table.
For function, the function name is supplied, along with up to three parameters (from the parameters table) which are then supplied to the function to calculate the resolution.
In each case, the Resolutions can either be added to or subtracted from the data.
Reference#
- class API.projectClass.resolutionsClass(parameters, startResolution)#
Resolutions are defined in a two-stage process. Firstly, we define the actual fitted parameters. These resolution parameters are held in a
parametersClass
object and can be used define resolutions.For constant resolutions, only one resolution parameter is supplied.
For data resolutions, there are no parameters supplied, but it informs RAT to expect a fourth column in the datafile.
Examples
>>> resolutionParams = parametersClass('Resolution Parameter 1', 1e-8, 1e-5, 1e-3, true); >>> resolution = resolutionClass(resolutionParams, {'Resolution 1','constant','Resolution Parameter 1'});
- Parameters:
parameters (
parameterClass
) – The resolution parameters.startResolution (
cell
) – A cell array containing the properties for the first resolution.
- resolutionParams#
The resolution parameters.
- Type:
parameterClass
- resolutions = multiTypeTable
A custom table object that contains the resolution entries.
- addResolution(name, type, source, value1, value2, value3, value4, value5)#
Adds a new resolution to the resolution table.
Examples
To add a new constant resolution with name only.
>>> resolution.addResolution('New Resolution');
To add a constant resolution.
>>> resolution.addResolution(New Resolution', 'constant', 'param name');
To add a data resolution.
>>> resolution.addResolution('New Resolution', 'data');
- Parameters:
name (
string or char array, default: auto-generated name
) – The name of the resolution.type (
allowedTypes, default: allowedTypes.Constant
) – The type of resolution (constant or data).source (
string or char array, default: ''
) – The source of the resolution. if type is ‘constant’, this should be the name (or the row index) of a resolution parameter. if type is ‘data’, this should be empty. RAT will expect a fourth column in the datafile.value1 (
string or char array, default: ''
) – Any extra values required by the resolution. if type is ‘constant’, all values will be ignored. if type is ‘data’, all values will be ignored.value2 (
string or char array, default: ''
) – Any extra values required by the resolution. if type is ‘constant’, all values will be ignored. if type is ‘data’, all values will be ignored.value3 (
string or char array, default: ''
) – Any extra values required by the resolution. if type is ‘constant’, all values will be ignored. if type is ‘data’, all values will be ignored.value4 (
string or char array, default: ''
) – Any extra values required by the resolution. if type is ‘constant’, all values will be ignored. if type is ‘data’, all values will be ignored.value5 (
string or char array, default: ''
) – Any extra values required by the resolution. if type is ‘constant’, all values will be ignored. if type is ‘data’, all values will be ignored.
- displayTable(showPriors)#
Prints the resolutions and resolution parameters tables to the console.
Examples
To print the resolution parameters table with the prior information.
>>> resolutions.displayTable(true);
- Parameters:
showPriors (
logical, default: false
) – Indicates if the prior type, mu, and sigma columns in the resolution parameters table should be displayed.
- getNames()#
Returns a N x 1 cell array of names of the resolutions in the object.
- Returns:
names – A cell array which contains the names of resolution entries.
- Return type:
cell
- removeResolution(row)#
Removes a resolution entry from the table.
Examples
To remove the second resolution in the table (resolution in row 2).
>>> resolutions.removeResolution(2);
To remove resolution with a specific name.
>>> resolutions.removeResolution('Resolution 1');
- Parameters:
row (
string or char array or whole number
) – Ifrow
is an integer, it is the row number of the resolution to remove. If it is text, it is the name of the resolution to remove.
- setResolution(row, options)#
General purpose method for updating properties of an existing resolution.
Examples
To change the name and value of the second resolution in the table (resolution in row 2).
>>> resolutions.setResolution(2, name='Resolution 1', type='constant', source='param name');
To change the properties of a resolution called ‘Resolution 1’.
>>> resolutions.setResolution('Resolution 1', name='New Resolution', type='data');
- Parameters:
row (
string or char array or whole number
) – Ifrow
is an integer, it is the row number of the resolution to update. If it is text, it is the name of the resolution to update.options –
- Keyword/value pair to properties to update for the specific resolution.
name (char array or string, default: ‘’) the new name of the resolution.
type (allowedTypes, default: allowedTypes.empty()) the type of resolution (constant or data).
source (char array or string, or whole number, default: ‘’) the new source of the resolution.
value1, value2, value3, value4, value5 (char array or string or whole number, default: ‘’) any extra values required for the resolution.
- setResolutionName(row, name)#
Sets the name of a given resolution in the table.
Examples
To change the name of the second resolution in the table (resolution in row 2)
>>> resolutions.setResolutionName(2, 'new name');
To change the name of a resolution called ‘old name’ to ‘new name’
>>> resolutions.setResolutionName('old name', 'new name');
- Parameters:
row (
string or char array or whole number
) – Ifrow
is an integer, it is the row number of the resolution to update. If it is text, it is the name of the resolution to update.name (
string or char array
) – The new name of the resolution.
- toStruct()#
Converts the resolutionClass into a structure array.
- Returns:
resolutionStruct – A struct which contains the properties for all the resolutions and resolution parameters.
- Return type:
struct