From b730bbf9ae4c47369f82ebccb4261a49b1e4b8bf Mon Sep 17 00:00:00 2001 From: Stephen Nneji Date: Wed, 9 Apr 2025 10:35:09 +0100 Subject: [PATCH 1/6] Refactors layers and fixes bug --- API/projectClass/customFileClass.m | 36 +------ API/projectClass/dataClass.m | 45 +-------- API/projectClass/layersClass.m | 150 +++++++++++++++++++++-------- API/projectClass/multiTypeTable.m | 6 +- API/projectClass/parametersClass.m | 3 +- API/projectClass/projectClass.m | 57 +++++------ API/projectClass/tableUtilities.m | 38 +++++++- tests/testCustomFileClass.m | 4 +- tests/testLayersClass.m | 64 ++++++------ tests/testProjectClass.m | 22 +++-- utilities/findParameterIndex.m | 30 ++++++ 11 files changed, 253 insertions(+), 202 deletions(-) create mode 100644 utilities/findParameterIndex.m diff --git a/API/projectClass/customFileClass.m b/API/projectClass/customFileClass.m index 8bfc42a5f..0da2feb7a 100644 --- a/API/projectClass/customFileClass.m +++ b/API/projectClass/customFileClass.m @@ -199,7 +199,7 @@ options.functionName = obj.varTable{row, 3}{:}; end options.language = validateOption(options.language, 'supportedLanguages', obj.invalidLanguageMessage).value; - obj.setName(row, options.name); + obj.setRowName(row, options.name); obj.varTable{row, 2} = {obj.addFileExtension(options.filename, options.language)}; obj.varTable{row, 4} = {options.language}; obj.varTable{row, 5} = {obj.validatePath(options.path)}; @@ -344,40 +344,6 @@ function delete(obj) end end - methods(Access = protected) - function obj = setName(obj, row, name) - % Sets the name of an existing custom file entry. - % - % Examples - % -------- - % To change the name of the second custom file in the table (custom file in row 2) - % - % >>> file.setName(2, 'custom file 1'); - % - % To change the name of a custom file called 'custom file 1' to 'new custom file' - % - % >>> file.setName('custom file 1', 'new custom file'); - % - % Parameters - % ---------- - % row : string or char array or whole number - % If ``row`` is an integer, it is the row number of the custom file to update. If it is text, - % it is the name of the custom file to update. - % name : string or char array - % The new name of the custom file. - - % Name must not be an existing name - existingNames = obj.varTable{:,1}; - existingNames(row) = []; - if any(strcmpi(name,existingNames)) - throw(exceptions.duplicateName('Duplicate custom file names are not allowed')); - end - - % Set the relevant name - obj.varTable{row, 1} = {name}; - end - end - methods(Access = private) function path = validatePath(~, path) % Validates custom file path exists. diff --git a/API/projectClass/dataClass.m b/API/projectClass/dataClass.m index d9b9888ce..9d7c9bc21 100644 --- a/API/projectClass/dataClass.m +++ b/API/projectClass/dataClass.m @@ -201,7 +201,9 @@ [options.dataRange, options.simRange] = obj.validateData(options.data, options.dataRange, options.simRange); if ~strcmp(options.name, obj.varTable{row, 1}{:}) - nameChanged = obj.setName(row, options.name); + nameChanged.oldName = obj.varTable{row, 1}; + nameChanged.newName = options.name; + obj.setRowName(row, options.name); end obj.varTable{row, 2} = {options.data}; obj.varTable{row, 3} = {options.dataRange}; @@ -272,47 +274,6 @@ function displayTable(obj) end methods(Access = protected) - function nameChanged = setName(obj, row, name) - % Sets the name of an existing dataset. - % - % Examples - % -------- - % To change the name of the second dataset in the table (dataset in row 2) - % - % >>> nameChanged = data.setName(2, 'Data SMW'); - % - % To change the name of a dataset called 'Data D20' to 'Data SMW' - % - % >>> nameChanged = data.setName('Data D20', 'Data SMW'); - % - % Parameters - % ---------- - % row : string or char array or whole number - % If ``row`` is an integer, it is the row number of the dataset to update. If it is text, - % it is the name of the dataset to update. - % name : string or char array - % The new name of the dataset. - % - % Returns - % ------- - % nameChanged : struct - % A struct which contains the former name ``oldName`` and the new name ``newName`` of the dataset. - arguments - obj - row - name {mustBeTextScalar, mustBeNonempty} - end - existingNames = obj.getNames; - if any(strcmpi(name, existingNames)) - throw(exceptions.duplicateName('Duplicate data names are not allowed')); - end - - % Set the relevant name - nameChanged.oldName = obj.varTable{row, 1}; - nameChanged.newName = name; - obj.varTable{row, 1} = {name}; - end - function [dataRange, simRange] = validateData(~, data, dataRange, simRange) % Checks the data and simulation ranges are valid. If any range is invalid, % a warning is printed and the range is adjusted when possible. diff --git a/API/projectClass/layersClass.m b/API/projectClass/layersClass.m index 7be1ff2f7..484006830 100644 --- a/API/projectClass/layersClass.m +++ b/API/projectClass/layersClass.m @@ -14,23 +14,23 @@ % varTable : table % The table which contains the properties for each layer. - properties(Access = private, Constant, Hidden) + properties(Access = private, Constant) invalidTypeMessage = sprintf('Hydration type must be a HydrationTypes enum or one of the following strings (%s)', ... strjoin(hydrationTypes.values(), ', ')) end - + properties (Dependent, SetAccess = private) varCount end + + properties (Dependent) + absorption + end methods - function obj = layersClass(SLDValues) - arguments - SLDValues {mustBeText} = 'SLD' - end - - varNames = [{'Name', 'Thickness'}, SLDValues, {'Roughness', 'Hydration', 'Hydrate with'}]; + function obj = layersClass() + varNames = {'Name', 'Thickness', 'SLD', 'Roughness', 'Hydration', 'Hydrate with'}; sz = [0 length(varNames)]; varTypes = repmat({'string'}, 1, length(varNames)); @@ -41,6 +41,26 @@ count = length(obj.varTable.Properties.VariableNames); end + function set.absorption(obj, value) + % Add or remove a column from the layers table whenever the + % "absorption" property is modified. + if value == obj.absorption + return + end + if value + newCol = repmat("", height(obj.varTable), 1); + obj.varTable = addvars(obj.varTable, newCol, 'After', 'SLD', 'NewVariableNames', 'SLD Imaginary'); + obj.varTable = renamevars(obj.varTable, 'SLD', 'SLD Real'); + else + obj.varTable = removevars(obj.varTable, 'SLD Imaginary'); + obj.varTable = renamevars(obj.varTable, 'SLD Real', 'SLD'); + end + end + + function value = get.absorption(obj) + value = width(obj.varTable) == 7; + end + function obj = addLayer(obj, paramNames, varargin) % Adds a new layer to the layers table. This method can be called in 2 ways. The first for when ``absorption`` is false % @@ -138,63 +158,109 @@ obj.removeRow(row); end - function obj = setLayerValue(obj, row, col, inputValue, paramNames) - % Change the value of a given layer parameter in the table (excluding the layer name). + function obj = setLayer(obj, row, paramNames, options) + % General purpose method for updating properties of an existing layer. + % Any unset property will remain unchanged. % % Examples % -------- % To update the thickness of the second layer in the table (layer in row 2). % % >>> parameterNames = project.getAllAllowedNames().paramNames; - % >>> layers.setLayerValue(2, 2, 'New thickness', paramNames); + % >>> layers.setLayer(2, paramNames, thickness='New thickness'); % - % The same can be achieved using names, to change the 'Thickness' of 'Layer 1'. + % To change the properties of a layer called 'Layer 1'. % - % >>> layers.setLayerValue('Layer 1', 'Thickness', 'New thickness', paramNames); + % >>> layers.setLayer('Layer 1', paramNames, name='new layer', thickness='New thickness', sld='Layer SLD'); % - % Note that the number of columns change depending on whether ``absorption`` is true or false so the column indices will change also. - % For example, the code below will update 'Roughness' if ``absorption`` is false, otherwise it will update the Imaginary SLD. So it is - % recommended to use column names to ensure the correct change. + % To change the imaginary SLD when absorption is true. % - % >>> layers.setLayerValue(2, 4, 'New Roughness', paramNames); + % >>> layers.setLayer('Layer 1', paramNames, name='new layer', thickness='New thickness', realSLD='Layer SLD', imaginarySLD='Layer Imaginary SLD'); % % Parameters % ---------- % row : string or char array or whole number % If ``row`` is an integer, it is the row of the layer to update. If it is text, % it is the name of the layer to update. - % col : string or char array or whole number - % If ``col`` is an integer, it is the column of layer to update. If it is text, - % it is the name of the column to update. The column names are the following: 'Name', 'Thickness', - % 'SLD', 'Roughness', 'Hydration', 'Hydrate with'. If ``absorption`` is true, the 'SLD' column is replaced - % with 'SLD Imaginary', and 'SLD Real'. - % inputValue : string or char array or whole number - % The name (or row index) of a parameter to replace the one in specified row and column. % paramNames: cell % A cell array which contains the names of available parameters. - - colNames = obj.varTable.Properties.VariableNames; + % options + % Keyword/value pair to properties to update for the specific parameter. + % * name (string or char array or whole number, default: '') the new name of the layer. + % * thickness (string or char array or whole number, default: '') The name (or the row index) of the parameter describing the thickness of this layer. + % * sld, realSLD (string or char array or whole number, default: '') The name (or the row index) of the parameter describing the real (scattering) term. + % * imaginarySLD (string or char array or whole number, default: '') the new name (or the row index) of the parameter describing the imaginary (absorption) term. + % * roughness (string or char array or whole number, default: '') the new name (or the row index) of the parameter describing the roughness of this layer. + % * hydration (string or char array or whole number, default: '') the new name (or the row index) of the parameter describing the percent hydration for the layer + % * hydrateWith (hydrationTypes, default: hydrationTypes.empty()) whether the layer is hydrated with the "bulk in" or "bulk out". + arguments + obj + row + paramNames + options.name {mustBeTextScalar, mustBeNonempty} + options.thickness {mustBeNonempty} + options.sld {mustBeNonempty} + options.realSLD {mustBeNonempty} + options.imaginarySLD {mustBeNonempty} + options.roughness {mustBeNonempty} + options.hydration + options.hydrateWith {mustBeNonempty} + end + row = obj.getValidRow(row); + if isfield(options, 'sld') + if isfield(options, 'realSLD') + throw(exceptions.invalidOption('The "sld" and "realSLD" options cannot be set at the same time.')); + end + + options.realSLD = options.sld; + end + + if ~isfield(options, 'name') + options.name = obj.varTable{row, 1}{:}; + end + + if ~isfield(options, 'thickness') + options.thickness = obj.varTable{row, 2}{:}; + end + + if ~isfield(options, 'roughness') + options.roughness = obj.varTable{row, end-2}{:}; + end + + if ~isfield(options, 'hydration') + options.hydration = obj.varTable{row, end-1}{:}; + end + + if ~isfield(options, 'hydrateWith') + options.hydrateWith = obj.varTable{row, end}{:}; + end + + if ~isfield(options, 'realSLD') + options.realSLD = obj.varTable{row, 3}{:}; + end - % Find the column index if we have a column name - if isText(col) - col = obj.findRowIndex(col, colNames, 'Unrecognised column name'); - elseif isnumeric(col) && all(mod(col, 1) == 0) - if (col < 2) || (col > length(colNames)) - throw(exceptions.indexOutOfRange(sprintf('The column index %d is not within the range 2 - %d', col, length(colNames)))); + if obj.absorption + if ~isfield(options, 'imaginarySLD') + options.imaginarySLD = obj.varTable{row, 4}{:}; end + values = {options.thickness, options.realSLD, options.imaginarySLD, options.roughness, options.hydration}; else - throw(exceptions.invalidType('Layer table column type should be a text or whole number.')); + if isfield(options, 'imaginarySLD') + throw(exceptions.invalidOption('The imaginarySLD option cannot be set when absorption is false.')); + end + values = {options.thickness, options.realSLD, options.roughness, options.hydration}; end - if col == length(colNames) - val = validateOption(inputValue, 'hydrationTypes', obj.invalidTypeMessage).value; - else - val = validateParameter(inputValue, paramNames); + for i=1:length(values) + if ~isempty(values{i}) + values{i} = validateParameter(values{i}, paramNames); + end end - - obj.varTable(row,col) = {val}; + values{end + 1} = validateOption(options.hydrateWith, 'hydrationTypes', obj.invalidTypeMessage).value; + obj.setRowName(row, options.name); + obj.varTable(row, 2:end) = values; end function layerStruct = toStruct(obj, paramNames) @@ -229,13 +295,13 @@ numCols = length(thisLayer); paramIndices = zeros(1,numCols-2); for j = 1:numCols-2 - paramIndices(j) = find(strcmpi(thisLayer{j},paramNames)); + paramIndices(j) = findParameterIndex(thisLayer{j}, paramNames, 'layer'); end - if strcmpi(thisLayer(numCols-1), "") + if isempty(thisLayer{numCols-1}) hydr = NaN; else - hydr = find(strcmpi(thisLayer{numCols-1},paramNames)); + hydr = findParameterIndex(thisLayer{numCols-1}, paramNames, 'layer'); end if strcmpi(thisLayer{numCols}, hydrationTypes.BulkIn.value) diff --git a/API/projectClass/multiTypeTable.m b/API/projectClass/multiTypeTable.m index bb490072e..d6e881882 100644 --- a/API/projectClass/multiTypeTable.m +++ b/API/projectClass/multiTypeTable.m @@ -81,7 +81,11 @@ end % Set the value - obj.varTable(row, col) = {value}; + if col == 1 + obj.setRowName(row, value); + else + obj.varTable(row, col) = {value}; + end end end diff --git a/API/projectClass/parametersClass.m b/API/projectClass/parametersClass.m index ee99d4827..40bf54659 100644 --- a/API/projectClass/parametersClass.m +++ b/API/projectClass/parametersClass.m @@ -346,8 +346,7 @@ row name {mustBeTextScalar} end - row = obj.getValidRow(row); - obj.varTable{row, 1} = {name}; + obj.setRowName(row, name); end function obj = setLimits(obj, row, min, max) diff --git a/API/projectClass/projectClass.m b/API/projectClass/projectClass.m index b0cf619e0..66c36e701 100644 --- a/API/projectClass/projectClass.m +++ b/API/projectClass/projectClass.m @@ -146,7 +146,9 @@ function delete(obj) throw(exceptions.invalidType('absorption must be true or false')); end obj.absorption = absorption; - obj.modifyLayersTable(); + if isa(obj.layers, 'layersClass') + obj.layers.absorption = absorption; + end end function set.geometry(obj, geometry) @@ -320,41 +322,40 @@ function delete(obj) end end - function obj = setLayerValue(obj, row, col, value) - % Change the value of a given layer parameter in the project (excluding the layer name). + function obj = setLayer(obj, row, varargin) + % General purpose method for updating properties of an existing layer. + % Any unset property will remain unchanged. % % Examples % -------- % To update the thickness of the second layer in the table (layer in row 2). % - % >>> project.setLayerValue(2, 2, 'New thickness', paramNames); + % >>> project.setLayer(2, thickness='New thickness'); % - % The same can be achieved using names, to change the 'Thickness' of 'Layer 1'. + % To change the properties of a layer called 'Layer 1'. % - % >>> project.setLayerValue('Layer 1', 'Thickness', 'New thickness'); + % >>> project.setLayer('Layer 1', name='new layer', thickness='New thickness', sld='Layer SLD'); % - % Note that the number of columns change depending on whether ``absorption`` is true or false so the column indices will change also. - % For example, the code below will update 'Roughness' if ``absorption`` is false, otherwise it will update the Imaginary SLD. So it is - % recommended to use column names to ensure the correct change. + % To change the imaginary SLD when absorption is true. % - % >>> project.setLayerValue(2, 4, 'New Roughness'); + % >>> project.setLayer('Layer 1', name='new layer', thickness='New thickness', realSLD='Layer SLD', imaginarySLD='Layer Imaginary SLD'); % % Parameters % ---------- % row : string or char array or whole number % If ``row`` is an integer, it is the row of the layer to update. If it is text, % it is the name of the layer to update. - % col : string or char array or whole number - % If ``col`` is an integer, it is the column of layer to update. If it is text, - % it is the name of the column to update. The column names are the following: 'Name', 'Thickness', - % 'SLD', 'Roughness', 'Hydration', 'Hydrate with'. If ``absorption`` is true, the 'SLD' column is replaced - % with 'SLD Imaginary', and 'SLD Real'. - % inputValue : string or char array or whole number - % The name (or row index) of a parameter to replace the one in specified row and column. - % paramNames: cell - % A cell array which contains the valid names of parameters. + % varargin + % Keyword/value pair to properties to update for the specific parameter. + % * name (string or char array or whole number, default: '') the new name of the layer. + % * thickness (string or char array or whole number, default: '') The name (or the row index) of the parameter describing the thickness of this layer. + % * sld, realSLD (string or char array or whole number, default: '') The name (or the row index) of the parameter describing the real (scattering) term. + % * imaginarySLD (string or char array or whole number, default: '') the new name (or the row index) of the parameter describing the imaginary (absorption) term. + % * roughness (string or char array or whole number, default: '') the new name (or the row index) of the parameter describing the roughness of this layer. + % * hydration (string or char array or whole number, default: '') the new name (or the row index) of the parameter describing the percent hydration for the layer + % * hydrateWith (hydrationTypes, default: hydrationTypes.empty()) whether the layer is hydrated with the "bulk in" or "bulk out". if isa(obj.layers, 'layersClass') - obj.layers.setLayerValue(row, col, value, obj.parameters.varTable{:,1}); + obj.layers.setLayer(row, obj.parameters.varTable{:,1}, varargin{:}); else throw(exceptions.invalidProperty(sprintf('Layer are not defined for the model type: %s', obj.modelType))); end @@ -1370,21 +1371,6 @@ function displayScalarObject(obj) end - function modifyLayersTable(obj) - % Add or remove a column from the layers table whenever the - % "absorption" property is modified. - if isa(obj.layers, 'layersClass') - if obj.absorption - newCol = repmat("", height(obj.layers.varTable), 1); - obj.layers.varTable = addvars(obj.layers.varTable, newCol, 'After', 'SLD', 'NewVariableNames', 'SLD Imaginary'); - obj.layers.varTable = renamevars(obj.layers.varTable, 'SLD', 'SLD Real'); - else - obj.layers.varTable = removevars(obj.layers.varTable, 'SLD Imaginary'); - obj.layers.varTable = renamevars(obj.layers.varTable, 'SLD Real', 'SLD'); - end - end - end - function setLayersAndContrasts(obj, oldModel) % Adjust layers and contrast objects when the model type is % changed. @@ -1397,6 +1383,7 @@ function setLayersAndContrasts(obj, oldModel) if strcmpi(obj.modelType, modelTypes.StandardLayers.value) if ~isa(obj.layers, 'layersClass') obj.layers = layersClass(); + obj.layers.absorption = obj.absorption; end else obj.layers = []; diff --git a/API/projectClass/tableUtilities.m b/API/projectClass/tableUtilities.m index d4464c76e..ea44b4066 100644 --- a/API/projectClass/tableUtilities.m +++ b/API/projectClass/tableUtilities.m @@ -200,6 +200,42 @@ function displayTable(obj) throw(exceptions.nameNotRecognised(errorMessage)); end end - + + function obj = setRowName(obj, row, name) + % Sets the name of an existing table entry. + % + % Examples + % -------- + % To change the name of the second parameter in the table (parameter in row 2) + % + % >>> obj.setRowName(2, 'parameter 1'); + % + % To change the name of a parameter called 'parameter 1' to 'new parameter' + % + % >>> obj.setRowName('parameter 1', 'new parameter'); + % + % Parameters + % ---------- + % row : string or char array or whole number + % If ``row`` is an integer, it is the row number of the parameter to update. If it is text, + % it is the name of the parameter to update. + % name : string or char array + % The new name of the parameter. + % + % Raises + % ------ + % duplicateName + % Name must not be an existing name + row = obj.getValidRow(row); + existingNames = obj.varTable{:, 1}; + existingNames(row) = []; + if any(strcmpi(name, existingNames)) + throw(exceptions.duplicateName('Duplicate names are not allowed.')); + end + + % Set the relevant name + obj.varTable{row, 1} = {name}; + end end + end diff --git a/tests/testCustomFileClass.m b/tests/testCustomFileClass.m index caaea6c26..ac3d1159f 100644 --- a/tests/testCustomFileClass.m +++ b/tests/testCustomFileClass.m @@ -33,7 +33,6 @@ } invalidInputData = {{'DPPC Model', 'name', 42},... {1, 'filename', datetime('today')},... - {'DSPC Model', 'language', table()},... {2, 'path', {'path', 'to', 'file'}} } @@ -163,7 +162,7 @@ function testSetCustomFile(testCase, testRow, inputData, expectedRow) end function testSetCustomFileInvalidType(testCase, invalidInputData) - %testCase.verifyError(@() testCase.exampleClass.setCustomFile(invalidInputData{:}), 'MATLAB:validators:mustBeTextScalar'); + testCase.verifyError(@() testCase.exampleClass.setCustomFile(invalidInputData{:}), 'MATLAB:validators:mustBeTextScalar'); end function testSetCustomFileInvalidInput(testCase) @@ -186,6 +185,7 @@ function testSetCustomFileInvalidInput(testCase) % Bad function name testCase.verifyWarning(@() testCase.exampleClass.setCustomFile(2, 'FunctionName', 'newModel'), ''); testCase.verifyEqual(testCase.exampleClass.varTable{2, 3}, "customBilayer", 'setCustomFile does not work correctly'); + testCase.verifyError(@() testCase.exampleClass.setCustomFile(2, 'name', 'DPPC Model'), exceptions.duplicateName.errorID) end function testSetCustomFileInvalidNumberOfParams(testCase) diff --git a/tests/testLayersClass.m b/tests/testLayersClass.m index 6e402e333..b969b80bc 100644 --- a/tests/testLayersClass.m +++ b/tests/testLayersClass.m @@ -144,17 +144,10 @@ function testInitialiseLayersClass(testCase) testCase.verifyEqual(testClass.varTable, testCase.initialLayersTable, 'layersClass does not initialise correctly'); % Adding the optional argument should give the same table - testClass = layersClass('SLD'); + testClass = layersClass(); testCase.verifySize(testClass.varTable, [0 6], 'layersClass does not initialise correctly'); testCase.verifyEqual(testClass.varTable, testCase.initialLayersTable, 'layersClass does not initialise correctly'); - - % For a cell array with more than one element, more columns - % should be added - testClass = layersClass({'SLDReal', 'SLDImag'}); - - testCase.verifySize(testClass.varTable, [0 7], 'layersClass does not initialise correctly'); - testCase.verifyEqual(testClass.varTable, testCase.initialAbsorptionTable, 'layersClass does not initialise correctly'); end function testAddLayer(testCase, layerInput, addedLayer) @@ -197,65 +190,70 @@ function testAddLayerInvalidFullLayer(testCase) testCase.verifyError(@() testCase.exampleClass.addLayer(testCase.parameterNames, 'Oxide Layer', 2, 3, NaN), exceptions.invalidType.errorID); end - function testSetLayerValue(testCase) + function testSetLayer(testCase) % Test setting values in the layers class table using both % names and indices to refer to rows and columns. % Row and column indices - testCase.exampleClass.setLayerValue(1, 5, 'Water hydr', testCase.parameterNames); + testCase.exampleClass.setLayer(1, testCase.parameterNames, 'hydration', 'Water hydr'); expectedRow = ["Bil inner head", "Bilayer heads thick", "Bilayer heads SLD", "Bilayer heads rough", "Water hydr", "bulk out"]; testCase.verifyEqual(testCase.exampleClass.varTable{1, :}, expectedRow, 'setValue does not work correctly'); % Row name and column index - testCase.exampleClass.setLayerValue('Bil Tail', 3, 'Water SLD', testCase.parameterNames); + testCase.exampleClass.setLayer('Bil Tail', testCase.parameterNames, 'sld', 'Water SLD'); expectedRow = ["Bil tail", "Bilayer tails thick", "Water SLD", "Bilayer tails rough", "Bilayer tails hydr", "bulk out"]; testCase.verifyEqual(testCase.exampleClass.varTable{2, :}, expectedRow, 'setValue does not work correctly'); % Row index and column name - testCase.exampleClass.setLayerValue(1, 'Roughness', 'Substrate Roughness', testCase.parameterNames); + testCase.exampleClass.setLayer(1, testCase.parameterNames, 'roughness', 'Substrate Roughness'); expectedRow = ["Bil inner head", "Bilayer heads thick", "Bilayer heads SLD", "Substrate Roughness", "Water hydr", "bulk out"]; testCase.verifyEqual(testCase.exampleClass.varTable{1, :}, expectedRow, 'setValue does not work correctly'); % Row and column names - testCase.exampleClass.setLayerValue('Bil Tail', 'Thickness', 'Water thick', testCase.parameterNames); + testCase.exampleClass.setLayer('Bil Tail', testCase.parameterNames, 'thickness', 'Water thick'); expectedRow = ["Bil tail", "Water thick", "Water SLD", "Bilayer tails rough", "Bilayer tails hydr", "bulk out"]; testCase.verifyEqual(testCase.exampleClass.varTable{2, :}, expectedRow, 'setValue does not work correctly'); % Change hydration type - testCase.exampleClass.setLayerValue(3, 6, hydrationTypes.BulkIn.value, testCase.parameterNames); + testCase.exampleClass.setLayer(3, testCase.parameterNames, 'hydrateWith', hydrationTypes.BulkIn.value); expectedRow = ["Bil outer head", "Bilayer heads thick", "Bilayer heads SLD", "Bilayer heads rough", "Bilayer heads hydr", "bulk in"]; testCase.verifyEqual(testCase.exampleClass.varTable{3, :}, expectedRow, 'setValue does not work correctly'); + + testCase.exampleClass.absorption = true; + testCase.exampleClass.setLayer(3, testCase.parameterNames, 'name', 'New Layer', 'realSLD', 'Water SLD', 'imaginarySLD', 'Bilayer heads SLD', 'hydrateWith', hydrationTypes.BulkIn.value); + testCase.verifyEqual(testCase.exampleClass.varTable{3, :}, ["New Layer", "Bilayer heads thick", "Water SLD", "Bilayer heads SLD", ... + "Bilayer heads rough", "Bilayer heads hydr", "bulk in"], 'setValue does not work correctly'); + + testCase.exampleClass.setLayer(3, testCase.parameterNames, 'name', 'Another Layer'); + testCase.verifyEqual(testCase.exampleClass.varTable{3, 1}, "Another Layer", 'setValue does not work correctly'); end - function testSetLayerValueInvalid(testCase) + function testSetLayerInvalid(testCase) % Test setting values in the layers class table using invalid % values of both names and indices to refer to rows and columns % Row indices - testCase.verifyError(@() testCase.exampleClass.setLayerValue(0, testCase.numCols, 'Substrate Roughness', testCase.parameterNames), exceptions.indexOutOfRange.errorID); - testCase.verifyError(@() testCase.exampleClass.setLayerValue(testCase.numRows+1, testCase.numCols, 'Substrate Roughness', testCase.parameterNames), exceptions.indexOutOfRange.errorID); - - % Column indices - testCase.verifyError(@() testCase.exampleClass.setLayerValue(1, 0, 'Substrate Roughness', testCase.parameterNames), exceptions.indexOutOfRange.errorID); - testCase.verifyError(@() testCase.exampleClass.setLayerValue(1, 1, 'Changed', testCase.parameterNames), exceptions.indexOutOfRange.errorID); % Can't change name - testCase.verifyError(@() testCase.exampleClass.setLayerValue(1, testCase.numCols+1, 'Substrate Roughness', testCase.parameterNames), exceptions.indexOutOfRange.errorID); + testCase.verifyError(@() testCase.exampleClass.setLayer(0, testCase.parameterNames, 'roughness', 'Substrate Roughness'), exceptions.indexOutOfRange.errorID); + testCase.verifyError(@() testCase.exampleClass.setLayer(testCase.numRows+1, testCase.parameterNames, 'roughness', 'Substrate Roughness'), exceptions.indexOutOfRange.errorID); % Row name - testCase.verifyError(@() testCase.exampleClass.setLayerValue('Invalid Name', testCase.numCols, 'Substrate Roughness', testCase.parameterNames), exceptions.nameNotRecognised.errorID); - - % Column name - testCase.verifyError(@() testCase.exampleClass.setLayerValue(1, 'Invalid Name', 'Substrate Roughness', testCase.parameterNames), exceptions.nameNotRecognised.errorID); + testCase.verifyError(@() testCase.exampleClass.setLayer('Invalid Name', testCase.parameterNames, 'roughness', 'Substrate Roughness'), exceptions.nameNotRecognised.errorID); % Invalid hydrate type - testCase.verifyError(@() testCase.exampleClass.setLayerValue(1, 6, 'Invalid hydrate', testCase.parameterNames), exceptions.invalidOption.errorID); - - % Float values within range - testCase.verifyError(@() testCase.exampleClass.setLayerValue(3, 2.5, 'Substrate Roughness', testCase.parameterNames), exceptions.invalidType.errorID); - testCase.verifyError(@() testCase.exampleClass.setLayerValue(2.5, 3, 'Substrate Roughness', testCase.parameterNames), exceptions.invalidType.errorID); + testCase.verifyError(@() testCase.exampleClass.setLayer(1, testCase.parameterNames, 'hydrateWith', 'Invalid hydrate'), exceptions.invalidOption.errorID); + % float index + testCase.verifyError(@() testCase.exampleClass.setLayer(2.5, testCase.parameterNames, 'roughness', 'Substrate Roughness'), exceptions.invalidType.errorID); % Invalid data types - testCase.verifyError(@() testCase.exampleClass.setLayerValue(testCase.initialLayersTable, testCase.numCols, 'Substrate Roughness', testCase.parameterNames), exceptions.invalidType.errorID); - testCase.verifyError(@() testCase.exampleClass.setLayerValue(1, datetime('today'), 'Substrate Roughness', testCase.parameterNames), exceptions.invalidType.errorID); + testCase.verifyError(@() testCase.exampleClass.setLayer(testCase.initialLayersTable, testCase.parameterNames, 'roughness', 'Substrate Roughness'), exceptions.invalidType.errorID); + testCase.verifyError(@() testCase.exampleClass.setLayer(1, testCase.parameterNames, 'name', 1), 'MATLAB:validators:mustBeTextScalar'); + testCase.verifyError(@() testCase.exampleClass.setLayer(1, testCase.parameterNames, 'name', ''), 'MATLAB:validators:mustBeNonempty'); + testCase.verifyError(@() testCase.exampleClass.setLayer(1, testCase.parameterNames, 'realSLD', ''), 'MATLAB:validators:mustBeNonempty'); + testCase.verifyError(@() testCase.exampleClass.setLayer(1, testCase.parameterNames, 'imaginarySLD', ''), 'MATLAB:validators:mustBeNonempty'); + + % Invalid option + testCase.verifyError(@() testCase.exampleClass.setLayer(1, testCase.parameterNames, 'realSLD', 'SLDs', 'sld', 'SLDs'), exceptions.invalidOption.errorID); + testCase.verifyError(@() testCase.exampleClass.setLayer(1, testCase.parameterNames, 'imaginarySLD', 'SLDs', 'sld', 'SLDs'), exceptions.invalidOption.errorID); end function testRemoveLayer(testCase) diff --git a/tests/testProjectClass.m b/tests/testProjectClass.m index 0bc7fb908..269188c70 100644 --- a/tests/testProjectClass.m +++ b/tests/testProjectClass.m @@ -250,6 +250,7 @@ function testParameters(testCase) testCase.verifyEqual(testCase.project.parameters.varTable{2, 1}, "NewParam", 'setParameterName method not working'); testCase.project.setParameter(2, 'name', 'Tails Thickness'); testCase.verifyError(@() testCase.project.setParameter(1, 'name', 'name'), exceptions.invalidOption.errorID) % can't rename substrate roughness + testCase.verifyError(@() testCase.project.setParameter(2, 'name', 'Substrate Roughness'), exceptions.duplicateName.errorID); testCase.verifyError(@() testCase.project.setParameter('substrate roughness', 'name', 'name'), exceptions.invalidOption.errorID) % can't rename substrate roughness testCase.project.setParameter('Tails Thickness', 'fit', false); testCase.verifyEqual(testCase.project.parameters.varTable{2, 5}, false, 'setParameterFit method not working'); @@ -283,14 +284,14 @@ function testLayers(testCase) testCase.verifySize(testCase.project.layers.varTable, [5, 6], 'Layers has wrong dimension'); testCase.verifyEqual(testCase.project.layers.varTable{5, 1}, "Another Layer", 'addLayer method not working'); % Test setting value in a layer - testCase.verifyError(@() testCase.project.setLayerValue(1, 2, 'Tail'), exceptions.nameNotRecognised.errorID) % parameter does not exist - testCase.verifyError(@() testCase.project.setLayerValue(1, 2, 11), exceptions.indexOutOfRange.errorID) % index greater than parameter table - testCase.project.setLayerValue(1, 2, 'Tails Thickness'); - testCase.verifyEqual(testCase.project.layers.varTable{1, 2}, "Tails Thickness", 'setLayerValue method not working'); - testCase.project.setLayerValue('Hydrogenated Tails', 4, 'Heads Roughness'); - testCase.verifyEqual(testCase.project.layers.varTable{1, 4}, "Heads Roughness", 'setLayerValue method not working'); - testCase.project.setLayerValue(2, 3, 1); - testCase.verifyEqual(testCase.project.layers.varTable{2, 3}, "Substrate Roughness", 'setLayerValue method not working'); + testCase.verifyError(@() testCase.project.setLayer(1, 'thickness', 'Tail'), exceptions.nameNotRecognised.errorID) % parameter does not exist + testCase.verifyError(@() testCase.project.setLayer(1, 'thickness', 11), exceptions.indexOutOfRange.errorID) % index greater than parameter table + testCase.project.setLayer(1, 'thickness', 'Tails Thickness'); + testCase.verifyEqual(testCase.project.layers.varTable{1, 2}, "Tails Thickness", 'setLayer method not working'); + testCase.project.setLayer('Hydrogenated Tails', 'roughness', 'Heads Roughness'); + testCase.verifyEqual(testCase.project.layers.varTable{1, 4}, "Heads Roughness", 'setLayer method not working'); + testCase.project.setLayer(2, 'sld', 1); + testCase.verifyEqual(testCase.project.layers.varTable{2, 3}, "Substrate Roughness", 'setLayer method not working'); % Check removing a parameter removes it from layer testCase.verifyEqual(testCase.project.layers.varTable{2, 2}, "Heads Thickness", 'param not removed from layers'); testCase.verifyEqual(testCase.project.layers.varTable{5, 2}, "Heads Thickness", 'param not removed from layers'); @@ -308,7 +309,7 @@ function testLayersExceptions(testCase) testCase.verifyError(@() customProject.addLayerGroup({{'New Layer'}, {'Another Layer'}}), exceptions.invalidProperty.errorID) testCase.verifyError(@() customProject.addLayer('New Layer'), exceptions.invalidProperty.errorID) testCase.verifyError(@() customProject.removeLayer(1), exceptions.invalidProperty.errorID) - testCase.verifyError(@() customProject.setLayerValue(1, 2, 'Tails Thickness'), exceptions.invalidProperty.errorID) + testCase.verifyError(@() customProject.setLayer(1, 2, 'Tails Thickness'), exceptions.invalidProperty.errorID) end function testData(testCase) @@ -330,6 +331,7 @@ function testData(testCase) testCase.verifyEqual(testCase.project.data.varTable{1, i}, expected{i}, 'setData method not working'); end testCase.verifyEqual(testCase.project.data.varTable{2, 1}, "Sim 2", 'setData method not working'); + testCase.verifyError(@() testCase.project.setData(2, 'name', 'Sim 1'), exceptions.duplicateName.errorID); % Tests that data can be removed testCase.project.removeData(2); testCase.verifySize(testCase.project.data.varTable, [1, 4], 'data has wrong dimension'); @@ -443,6 +445,7 @@ function testResolution(testCase) string({'Resolution 1', allowedTypes.Constant.value, 'Resolution par 1', '', '', '', '', ''}), 'resolution default'); % Checks that resolution can be added testCase.project.addResolution('Resolution 2', allowedTypes.Constant,'Resolution par 1','','','','',''); + testCase.verifyError(@() testCase.project.setResolution(2, 'name', 'Resolution 1'), exceptions.duplicateName.errorID); testCase.verifySize(testCase.project.resolution.resolutions.varTable, [2, 8], 'resolution has wrong dimension'); testCase.verifyEqual(testCase.project.resolution.resolutions.varTable{:, 1}, ["Resolution 1"; "Resolution 2"], 'addResolution method not working'); % Checks that resolution can be removed @@ -489,6 +492,7 @@ function testBackground(testCase) string({'Background 1', allowedTypes.Constant.value, 'Background Param 1', '', '', '', '', ''}), 'background default'); % Checks that background can be added testCase.project.addBackground('Background D2O',allowedTypes.Constant.value,'Backs Value D2O'); + testCase.verifyError(@() testCase.project.setBackground(2, 'name', 'Background 1'), exceptions.duplicateName.errorID); testCase.verifySize(testCase.project.background.backgrounds.varTable, [2, 8], 'background has wrong dimension'); testCase.verifyEqual(testCase.project.background.backgrounds.varTable{:, 1}, ["Background 1"; "Background D2O"], 'addBackground method not working'); % Checks that background can be removed diff --git a/utilities/findParameterIndex.m b/utilities/findParameterIndex.m new file mode 100644 index 000000000..dbcd4d8e8 --- /dev/null +++ b/utilities/findParameterIndex.m @@ -0,0 +1,30 @@ +function output = findParameterIndex(input, allowedNames, inputDesc) + % Get the index of an input name in list of allowed names. + % + % Parameters + % ---------- + % input: string or char array + % A name to validate. + % allowedNames: cell + % A cell containing the valid names. + % inputDesc: string or char array + % A description of the input. + % + % Returns + % ------- + % output: whole number + % Index of the input name in the allowed list of names. + if isempty(input) + throw(exceptions.invalidValue(sprintf("Input %s cannot be empty.", inputDesc))); + end + found = strcmpi(input, allowedNames); + if ~any(found) + if isempty(allowedNames) + msg = sprintf('"%s" is not a recognised %s. Did you forget to add the %s?', input, inputDesc, inputDesc); + else + msg = sprintf('"%s" is not a recognised %s. The allowed names are: "%s".', input, inputDesc, strjoin(allowedNames, '", "')); + end + throw(exceptions.nameNotRecognised(msg)); + end + output = find(found, 1); +end From 5fdac1003835e03ce628d5b8acdcf583cbfad1e5 Mon Sep 17 00:00:00 2001 From: StephenNneji <34302892+StephenNneji@users.noreply.github.com> Date: Wed, 9 Apr 2025 16:42:32 +0100 Subject: [PATCH 2/6] Update API/projectClass/projectClass.m Co-authored-by: Alex H. Room <69592136+alexhroom@users.noreply.github.com> --- API/projectClass/projectClass.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/API/projectClass/projectClass.m b/API/projectClass/projectClass.m index 66c36e701..352bcd770 100644 --- a/API/projectClass/projectClass.m +++ b/API/projectClass/projectClass.m @@ -323,7 +323,7 @@ function delete(obj) end function obj = setLayer(obj, row, varargin) - % General purpose method for updating properties of an existing layer. + % Update properties of an existing layer. % Any unset property will remain unchanged. % % Examples From 2ab0fb74a61d2ef7e7858dbfe8da7cbd57066594 Mon Sep 17 00:00:00 2001 From: StephenNneji <34302892+StephenNneji@users.noreply.github.com> Date: Wed, 9 Apr 2025 16:42:39 +0100 Subject: [PATCH 3/6] Update API/projectClass/layersClass.m Co-authored-by: Alex H. Room <69592136+alexhroom@users.noreply.github.com> --- API/projectClass/layersClass.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/API/projectClass/layersClass.m b/API/projectClass/layersClass.m index 484006830..d9b9913c0 100644 --- a/API/projectClass/layersClass.m +++ b/API/projectClass/layersClass.m @@ -159,7 +159,7 @@ end function obj = setLayer(obj, row, paramNames, options) - % General purpose method for updating properties of an existing layer. + % Update properties of an existing layer. % Any unset property will remain unchanged. % % Examples From dd5e058225608629c282a2d35bf15db38a5ca608 Mon Sep 17 00:00:00 2001 From: StephenNneji <34302892+StephenNneji@users.noreply.github.com> Date: Wed, 9 Apr 2025 16:42:47 +0100 Subject: [PATCH 4/6] Update API/projectClass/tableUtilities.m Co-authored-by: Alex H. Room <69592136+alexhroom@users.noreply.github.com> --- API/projectClass/tableUtilities.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/API/projectClass/tableUtilities.m b/API/projectClass/tableUtilities.m index ea44b4066..3aeb615b5 100644 --- a/API/projectClass/tableUtilities.m +++ b/API/projectClass/tableUtilities.m @@ -202,7 +202,7 @@ function displayTable(obj) end function obj = setRowName(obj, row, name) - % Sets the name of an existing table entry. + % Set the name of an existing table entry. % % Examples % -------- From 814f0ded879a9b4f4e47cba993a5bef820393e0e Mon Sep 17 00:00:00 2001 From: Stephen Nneji Date: Wed, 9 Apr 2025 16:53:58 +0100 Subject: [PATCH 5/6] Addresses review comments --- API/projectClass/layersClass.m | 4 ++-- API/projectClass/projectClass.m | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/API/projectClass/layersClass.m b/API/projectClass/layersClass.m index d9b9913c0..63dbe1d2e 100644 --- a/API/projectClass/layersClass.m +++ b/API/projectClass/layersClass.m @@ -188,8 +188,8 @@ % Keyword/value pair to properties to update for the specific parameter. % * name (string or char array or whole number, default: '') the new name of the layer. % * thickness (string or char array or whole number, default: '') The name (or the row index) of the parameter describing the thickness of this layer. - % * sld, realSLD (string or char array or whole number, default: '') The name (or the row index) of the parameter describing the real (scattering) term. - % * imaginarySLD (string or char array or whole number, default: '') the new name (or the row index) of the parameter describing the imaginary (absorption) term. + % * sld, realSLD (string or char array or whole number, default: '') The name (or the row index) of the parameter describing the real (scattering) term of the SLD. + % * imaginarySLD (string or char array or whole number, default: '') the new name (or the row index) of the parameter describing the imaginary (absorption) term of the SLD. % * roughness (string or char array or whole number, default: '') the new name (or the row index) of the parameter describing the roughness of this layer. % * hydration (string or char array or whole number, default: '') the new name (or the row index) of the parameter describing the percent hydration for the layer % * hydrateWith (hydrationTypes, default: hydrationTypes.empty()) whether the layer is hydrated with the "bulk in" or "bulk out". diff --git a/API/projectClass/projectClass.m b/API/projectClass/projectClass.m index 352bcd770..bf78684e9 100644 --- a/API/projectClass/projectClass.m +++ b/API/projectClass/projectClass.m @@ -349,8 +349,8 @@ function delete(obj) % Keyword/value pair to properties to update for the specific parameter. % * name (string or char array or whole number, default: '') the new name of the layer. % * thickness (string or char array or whole number, default: '') The name (or the row index) of the parameter describing the thickness of this layer. - % * sld, realSLD (string or char array or whole number, default: '') The name (or the row index) of the parameter describing the real (scattering) term. - % * imaginarySLD (string or char array or whole number, default: '') the new name (or the row index) of the parameter describing the imaginary (absorption) term. + % * sld, realSLD (string or char array or whole number, default: '') The name (or the row index) of the parameter describing the real (scattering) term of the SLD. + % * imaginarySLD (string or char array or whole number, default: '') the new name (or the row index) of the parameter describing the imaginary (absorption) term of the SLD. % * roughness (string or char array or whole number, default: '') the new name (or the row index) of the parameter describing the roughness of this layer. % * hydration (string or char array or whole number, default: '') the new name (or the row index) of the parameter describing the percent hydration for the layer % * hydrateWith (hydrationTypes, default: hydrationTypes.empty()) whether the layer is hydrated with the "bulk in" or "bulk out". From 831df6017fadedb09e90d0f5a2635aee293b5565 Mon Sep 17 00:00:00 2001 From: Stephen Nneji Date: Wed, 9 Apr 2025 16:55:22 +0100 Subject: [PATCH 6/6] Fixes tabs in enums --- API/enums/actions.m | 2 +- API/enums/allowedTypes.m | 2 +- API/enums/boundHandlingOptions.m | 2 +- API/enums/calculationTypes.m | 4 ++-- API/enums/coderEnums.m | 2 +- API/enums/displayOptions.m | 2 +- API/enums/errorCodes.m | 4 ++-- API/enums/eventTypes.m | 4 ++-- API/enums/geometryOptions.m | 10 +++++----- API/enums/hydrationTypes.m | 2 +- API/enums/modelTypes.m | 2 +- API/enums/parallelOptions.m | 2 +- API/enums/priorTypes.m | 4 ++-- API/enums/procedures.m | 4 ++-- API/enums/searchStrategy.m | 4 ++-- API/enums/supportedLanguages.m | 4 ++-- 16 files changed, 27 insertions(+), 27 deletions(-) diff --git a/API/enums/actions.m b/API/enums/actions.m index 4e52dc554..8b94a9262 100644 --- a/API/enums/actions.m +++ b/API/enums/actions.m @@ -1,5 +1,5 @@ classdef actions < customEnum - % Ways in which a background can be included in a contrast. + % Ways in which a background can be included in a contrast. methods (Static) function s = toStruct() s = customEnum.toStruct(mfilename('class')); diff --git a/API/enums/allowedTypes.m b/API/enums/allowedTypes.m index a3fdc8aa7..c82649252 100644 --- a/API/enums/allowedTypes.m +++ b/API/enums/allowedTypes.m @@ -1,5 +1,5 @@ classdef allowedTypes < customEnum - % Ways of defining a background or resolution. + % Ways of defining a background or resolution. methods (Static) function s = toStruct() s = customEnum.toStruct(mfilename('class')); diff --git a/API/enums/boundHandlingOptions.m b/API/enums/boundHandlingOptions.m index c9182681e..15b1a7415 100644 --- a/API/enums/boundHandlingOptions.m +++ b/API/enums/boundHandlingOptions.m @@ -1,5 +1,5 @@ classdef boundHandlingOptions < customEnum - % Options for bound handling in DREAM. + % Options for bound handling in DREAM. methods (Static) function s = toStruct() s = customEnum.toStruct(mfilename('class')); diff --git a/API/enums/calculationTypes.m b/API/enums/calculationTypes.m index 9c313cdb8..86989cb4f 100644 --- a/API/enums/calculationTypes.m +++ b/API/enums/calculationTypes.m @@ -1,6 +1,6 @@ classdef calculationTypes < customEnum - % Types of calculation that can be performed by RAT. - methods (Static) + % Types of calculation that can be performed by RAT. + methods (Static) function s = toStruct() s = customEnum.toStruct(mfilename('class')); end diff --git a/API/enums/coderEnums.m b/API/enums/coderEnums.m index 67b8b3317..bffc131e2 100644 --- a/API/enums/coderEnums.m +++ b/API/enums/coderEnums.m @@ -1,5 +1,5 @@ classdef coderEnums - % An Enum class which lets MATLAB Coder use Enums without redefinition or hardcoding. + % An Enum class which lets MATLAB Coder use Enums without redefinition or hardcoding. properties (Constant) actions = actions.toStruct() allowedTypes = allowedTypes.toStruct() diff --git a/API/enums/displayOptions.m b/API/enums/displayOptions.m index 3a9a5cbfb..7ae064489 100644 --- a/API/enums/displayOptions.m +++ b/API/enums/displayOptions.m @@ -1,5 +1,5 @@ classdef displayOptions < customEnum - % The available options for terminal output. + % The available options for terminal output. methods (Static) function s = toStruct() s = customEnum.toStruct(mfilename('class')); diff --git a/API/enums/errorCodes.m b/API/enums/errorCodes.m index 828ed6e15..b87793656 100644 --- a/API/enums/errorCodes.m +++ b/API/enums/errorCodes.m @@ -1,6 +1,6 @@ classdef errorCodes < customEnum - % Internal error codes for MATLAB Coder exceptions (see compile/exceptions/coderException.m). - methods (Static) + % Internal error codes for MATLAB Coder exceptions (see compile/exceptions/coderException.m). + methods (Static) function s = toStruct() s = customEnum.toStruct(mfilename('class')); end diff --git a/API/enums/eventTypes.m b/API/enums/eventTypes.m index bc9bfef06..d194ed942 100644 --- a/API/enums/eventTypes.m +++ b/API/enums/eventTypes.m @@ -1,6 +1,6 @@ classdef eventTypes < customEnum - % Types of output event from a RAT run. - methods (Static) + % Types of output event from a RAT run. + methods (Static) function s = toStruct() s = customEnum.toStruct(mfilename('class')); end diff --git a/API/enums/geometryOptions.m b/API/enums/geometryOptions.m index 31d9bfd2a..41b77c1a0 100644 --- a/API/enums/geometryOptions.m +++ b/API/enums/geometryOptions.m @@ -1,9 +1,9 @@ classdef geometryOptions < customEnum - % Where the substrate roughness is placed. - % - % For air/substrate, it is placed at the end of the stack. - % For substrate/liquid, it is placed at the beginning of the stack. - methods (Static) + % Where the substrate roughness is placed. + % + % For air/substrate, it is placed at the end of the stack. + % For substrate/liquid, it is placed at the beginning of the stack. + methods (Static) function s = toStruct() s = customEnum.toStruct(mfilename('class')); end diff --git a/API/enums/hydrationTypes.m b/API/enums/hydrationTypes.m index 03fb06f73..62befee7b 100644 --- a/API/enums/hydrationTypes.m +++ b/API/enums/hydrationTypes.m @@ -1,5 +1,5 @@ classdef hydrationTypes < customEnum - % Options for the 'hydrate with' parameter of a Layer. + % Options for the 'hydrate with' parameter of a Layer. methods (Static) function s = toStruct() s = customEnum.toStruct(mfilename('class')); diff --git a/API/enums/modelTypes.m b/API/enums/modelTypes.m index ee02f098a..b064a872f 100644 --- a/API/enums/modelTypes.m +++ b/API/enums/modelTypes.m @@ -1,5 +1,5 @@ classdef modelTypes < customEnum - % Types of layer model supported by RAT. + % Types of layer model supported by RAT. methods (Static) function s = toStruct() s = customEnum.toStruct(mfilename('class')); diff --git a/API/enums/parallelOptions.m b/API/enums/parallelOptions.m index 3dc9ee833..6687e91a6 100644 --- a/API/enums/parallelOptions.m +++ b/API/enums/parallelOptions.m @@ -1,5 +1,5 @@ classdef parallelOptions < customEnum - % Ways in which the calculation can be parallelised. + % Ways in which the calculation can be parallelised. methods (Static) function s = toStruct() s = customEnum.toStruct(mfilename('class')); diff --git a/API/enums/priorTypes.m b/API/enums/priorTypes.m index 5333354f1..808bf4b04 100644 --- a/API/enums/priorTypes.m +++ b/API/enums/priorTypes.m @@ -1,6 +1,6 @@ classdef priorTypes < customEnum - % Prior distributions for parameters in Bayesian algorithms. - methods (Static) + % Prior distributions for parameters in Bayesian algorithms. + methods (Static) function s = toStruct() s = customEnum.toStruct(mfilename('class')); end diff --git a/API/enums/procedures.m b/API/enums/procedures.m index 3e6a77b08..498db82d6 100644 --- a/API/enums/procedures.m +++ b/API/enums/procedures.m @@ -1,6 +1,6 @@ classdef procedures < customEnum - % The algorithms available in RAT. - methods (Static) + % The algorithms available in RAT. + methods (Static) function s = toStruct() s = customEnum.toStruct(mfilename('class')); end diff --git a/API/enums/searchStrategy.m b/API/enums/searchStrategy.m index f47a80e9e..203e93c55 100644 --- a/API/enums/searchStrategy.m +++ b/API/enums/searchStrategy.m @@ -1,6 +1,6 @@ classdef searchStrategy < customEnum - % Strategies for generating base vectors in differential evolution. - methods (Static) + % Strategies for generating base vectors in differential evolution. + methods (Static) function s = toStruct() s = customEnum.toStruct(mfilename('class'), true); end diff --git a/API/enums/supportedLanguages.m b/API/enums/supportedLanguages.m index 15588a2ab..1498b224c 100644 --- a/API/enums/supportedLanguages.m +++ b/API/enums/supportedLanguages.m @@ -1,6 +1,6 @@ classdef supportedLanguages < customEnum - % Languages for custom files. - methods (Static) + % Languages for custom files. + methods (Static) function s = toStruct() s = customEnum.toStruct(mfilename('class')); end