From d7f738741b22b14fd9cb44c116ac6d0dbd369bfd Mon Sep 17 00:00:00 2001 From: alexhroom Date: Wed, 9 Apr 2025 09:12:40 +0100 Subject: [PATCH 1/2] added remaining docstrings --- API/RATMain.m | 17 +++++++++ API/projectClass/multiTypeTable.m | 46 +++++++++++++++-------- targetFunctions/reflectivityCalculation.m | 13 +++++++ 3 files changed, 61 insertions(+), 15 deletions(-) diff --git a/API/RATMain.m b/API/RATMain.m index 4a498dcb1..454d9aa7e 100644 --- a/API/RATMain.m +++ b/API/RATMain.m @@ -1,4 +1,21 @@ function [problemStruct,results,bayesResults] = RATMain(problemStruct,controls) + % Select and run the internal RAT procedure. + % + % Parameters + % ---------- + % problemStruct : struct + % The project class in struct form (generated from parseClassToStructs) + % controls : struct + % The controls struct (generated from parseClassToStructs) + % + % Returns + % ------- + % problemStruct : struct + % The output problem struct. + % results : struct + % The calculation results. + % bayesResults : struct + % Additional results from a Bayesian calculation. % Adds C struct names for inputs coder.cstructname(problemStruct.names, 'ParamNames'); diff --git a/API/projectClass/multiTypeTable.m b/API/projectClass/multiTypeTable.m index bb490072e..839a6f908 100644 --- a/API/projectClass/multiTypeTable.m +++ b/API/projectClass/multiTypeTable.m @@ -1,8 +1,5 @@ classdef multiTypeTable < tableUtilities - - % This is the class definition for the backgrounds and resolutions - % tables. - + % A multi-type table, used in backgrounds and resolution tables. properties typesAutoNameString = 'Row' end @@ -12,7 +9,10 @@ function obj = multiTypeTable() % Initialises a multi-type table. % - % multiTable = multiTypeTable(); + % Examples + % -------- + % >>> multiTable = multiTypeTable(); + % sz = [0 8]; varTypes = {'string','string','string','string','string','string','string','string'}; varNames = {'Name','Type','Source','Value 1','Value 2','Value 3','Value 4','Value 5'}; @@ -24,7 +24,15 @@ % with up to seven parameters, with empty strings used for % values that are not specified. % - % multiTable.addRow({'New Row'}); + % Parameters + % ---------- + % varargin : keyword arguments + % The parameters to add to the row. + % + % Examples + % -------- + % >>> multiTable.addRow({'New Row'}); + % switch length(varargin) case 0 @@ -57,17 +65,25 @@ end function obj = setValue(obj, row, col, value) - % Change the value of a given parameter in the table. The row - % and column of the parameter can both be specified by either - % name or index. The expected input is three values: row, - % column, value + % Change the value of a given parameter in the table. % - % multiTable.setValue(1, 1, 'origin'); - % First parameter needs to be either a row name or number + % The row and column of the parameter can both be specified by either + % name or index. + % + % Parameters + % ---------- + % row : string or int + % The name or index of the row. + % col : string or int + % The name or index of the column. + % value : any + % The value to change the parameter to. + % + % Examples + % -------- + % >>> multiTable.setValue(1, 1, 'origin'); + % row = obj.getValidRow(row); - - % Second parameter needs to be either a column name or - % number. colNames = obj.varTable.Properties.VariableNames; if isText(col) diff --git a/targetFunctions/reflectivityCalculation.m b/targetFunctions/reflectivityCalculation.m index d00299c75..15ed21d16 100644 --- a/targetFunctions/reflectivityCalculation.m +++ b/targetFunctions/reflectivityCalculation.m @@ -1,4 +1,6 @@ function result = reflectivityCalculation(problemStruct,controls) +% Compute the reflectivity and SLD curves for a given model using the Abeles matrix formalism. +% % Main entry point into the reflectivity calculation for the toolbox. % This is the main function that is called by any of the minimisers or % analysis tools from the rest of the toolbox. @@ -12,6 +14,17 @@ % % * domains - Target function for samples consisting of domains which are larger than the beam lateral coherence length. % +% Parameters +% ---------- +% problemStruct : struct +% The project class as a struct (generated via parseClassToStructs) +% controls : struct +% The controls struct (generated via parseClassToStructs) +% +% Returns +% ------- +% result : struct +% The results of the calculation. % Decide which target function we are calling and call the relevant routines targetFunction = problemStruct.TF; From 0cfbee4107e6bf4eaf5845dbcf32a8896050216a Mon Sep 17 00:00:00 2001 From: alexhroom Date: Wed, 9 Apr 2025 15:41:13 +0100 Subject: [PATCH 2/2] review fixes --- API/projectClass/multiTypeTable.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/API/projectClass/multiTypeTable.m b/API/projectClass/multiTypeTable.m index 839a6f908..3d91b55c9 100644 --- a/API/projectClass/multiTypeTable.m +++ b/API/projectClass/multiTypeTable.m @@ -67,7 +67,7 @@ function obj = setValue(obj, row, col, value) % Change the value of a given parameter in the table. % - % The row and column of the parameter can both be specified by either + % Both the row and column of the parameter can both be specified by either % name or index. % % Parameters