Skip to content

Commit 042d834

Browse files
committed
Removed uses of "all..." elsewhere in the code
1 parent 869e07c commit 042d834

8 files changed

Lines changed: 67 additions & 67 deletions

File tree

API/parseClassToStructs.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,13 @@
195195
totalNumber = totalNumber + size(priors.(priorFields{i}), 1);
196196
end
197197

198-
allPriors = cell(totalNumber,4);
198+
priorsCell = cell(totalNumber,4);
199199
cellCount = 1;
200200

201201
for i=1:length(priorFields)
202202
currentPrior = priorFields{i};
203203
for j = 1:size(priors.(currentPrior), 1)
204-
allPriors{cellCount,1} = priors.(currentPrior){j}{1};
204+
priorsCell{cellCount,1} = priors.(currentPrior){j}{1};
205205

206206
% Check prior type.....
207207
thisType = priors.(currentPrior){j}{2};
@@ -213,16 +213,16 @@
213213
else
214214
priorType = 3;
215215
end
216-
allPriors{cellCount,2} = priorType;
216+
priorsCell{cellCount,2} = priorType;
217217

218-
allPriors{cellCount,3} = priors.(currentPrior){j}{3};
219-
allPriors{cellCount,4} = priors.(currentPrior){j}{4};
218+
priorsCell{cellCount,3} = priors.(currentPrior){j}{3};
219+
priorsCell{cellCount,4} = priors.(currentPrior){j}{4};
220220
cellCount = cellCount + 1;
221221
end
222222
end
223223

224-
priors.priorNames = allPriors(:, 1);
225-
priors.priorValues = cell2mat(allPriors(:, 2:end));
224+
priors.priorNames = priorsCell(:, 1);
225+
priors.priorValues = cell2mat(priorsCell(:, 2:end));
226226

227227

228228
%% Split up the contrastBackgrounds array

minimisers/NS/parseBayesResults.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@
6868

6969
%calculate the reflectivity and SLD for all the in-range fits.
7070
numCalcs = size(chain,1);
71-
allRefs = cell(numCalcs,1);
72-
allSLDs = cell(numCalcs,1);
71+
refs = cell(numCalcs,1);
72+
slds = cell(numCalcs,1);
7373
for i = 1:numCalcs
7474
problemStruct.fitParams = chain(i,1:end-1);
7575
problemStruct = unpackParams(problemStruct,controls);
7676
result = reflectivityCalculation(problemStruct,problemCells,problemLimits,controls);
77-
allRefs{i} = result.reflectivity;
78-
allSLDs{i} = result.sldProfiles;
77+
refs{i} = result.reflectivity;
78+
slds{i} = result.sldProfiles;
7979
end
8080

8181
%Also calculate the best fit
@@ -90,7 +90,7 @@
9090
for i = 1:problemStruct.numberOfContrasts
9191
%Since array size may vary if qz-shift is fitted
9292
%interpolate all curves onto the x-range of the first
93-
thisRef = allRefs{n}{i};
93+
thisRef = refs{n}{i};
9494
% if n == 1
9595
% referenceRef = thisRef;
9696
% groupRefs{i}(:,n) = referenceRef(:,2);

minimisers/NS/runNestedSampler.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@
5151
bayesOutputs.sschain = [];
5252
bayesOutputs.data = problemCells{2};
5353

54-
allProblem = cell(4,1);
55-
allProblem{1} = problemStruct;
56-
allProblem{2} = controls;
57-
allProblem{3} = problemLimits;
58-
allProblem{4} = problemCells;
54+
problem = cell(4,1);
55+
problem{1} = problemStruct;
56+
problem{2} = controls;
57+
problem{3} = problemLimits;
58+
problem{4} = problemCells;
5959

60-
[problemStruct,result,nestResults] = processBayes(bayesOutputs,allProblem);
60+
[problemStruct,result,nestResults] = processBayes(bayesOutputs,problem);
6161

6262
bayesResults.predlims = nestResults.predlims;
6363
bayesResults.bestFitsMean = nestResults.bestFitsMean;

minimisers/generalUtils/bayesStats/processBayes.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
function [problemStruct,result,bayesResults] = processBayes(bayesOutputs,allProblem)
1+
function [problemStruct,result,bayesResults] = processBayes(bayesOutputs,problem)
22

33
%problem = {problemStruct ; controls ; problemLimits ; problemCells};
4-
problemStruct = allProblem{1};
5-
controlsStruct = allProblem{2};
6-
problemLimits = allProblem{3};
7-
problemCells = allProblem{4};
4+
problemStruct = problem{1};
5+
controlsStruct = problem{2};
6+
problemLimits = problem{3};
7+
problemCells = problem{4};
88

99
% Need to impose that we calculate the SLD..
1010
controlsStruct.calcSldDuringFit = true;
@@ -22,7 +22,7 @@
2222
bestFitMean.data = result.shiftedData;
2323

2424
% 2. Reflectivity and SLD shading
25-
allPredInts = refPrctileConfInts(bayesOutputs,problemStruct,problemCells,problemLimits,controlsStruct,result,parConfInts);
25+
predInts = refPrctileConfInts(bayesOutputs,problemStruct,problemCells,problemLimits,controlsStruct,result,parConfInts);
2626

2727

2828
% ---------------------------------
@@ -32,7 +32,7 @@
3232
%bayesResults.bestPars_Max = bestPars_max;
3333
%bayesResults.bayesData = bayesOutputs.data;
3434
% bayesResults.bestFitsMax = {bestFitMax_Ref, bestFitMax_Sld, bestFitMax_chi};
35-
bayesResults = struct('bestFitsMean',bestFitMean,'predlims',allPredInts,...
35+
bayesResults = struct('bestFitsMean',bestFitMean,'predlims',predInts,...
3636
'parConfInts',parConfInts);
3737

3838
% bayesResults.bestFitsMean = bestFitMean;

targetFunctions/+domainsTF/+customLayers/processCustomFunction.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function [resampledLayers,subRoughs] = processCustomFunction(contrastBulkIns,contrastBulkOuts,...
2-
bulkIn,bulkOut,cCustFiles,numberOfContrasts,customFiles,params,useImaginary)
2+
bulkInArray,bulkOutArray,cCustFiles,numberOfContrasts,customFiles,params,useImaginary)
33

44
% Top-level function for processing custom layers for all the
55
% contrasts.
@@ -19,7 +19,7 @@
1919
coder.varsize('tempResampledLayers{:}',[10000 6],[1 1]);
2020
coder.varsize('resampledLayers{:}',[10000 6],[1 1]);
2121

22-
allBulkOuts = bulkOut(contrastBulkOuts);
22+
bulkOuts = bulkOutArray(contrastBulkOuts);
2323
for i = 1:numberOfContrasts
2424

2525
% Choose which custom file is associated with this contrast
@@ -33,15 +33,15 @@
3333
thisContrastLayers2 = [1 1 1]; % typeDef
3434
coder.varsize('thisContrastLayers2',[10000, 6],[1 1]);
3535

36-
thisBulkIn = bulkIn(contrastBulkIns(i));
37-
thisBulkOut = allBulkOuts(i);
36+
thisBulkIn = bulkInArray(contrastBulkIns(i));
37+
thisBulkOut = bulkOuts(i);
3838

3939
if isnan(str2double(functionHandle))
40-
[thisContrastLayers1, subRoughs(i)] = callMatlabFunction(functionHandle, params, thisBulkIn, allBulkOuts, i, 1);
41-
[thisContrastLayers2, ~] = callMatlabFunction(functionHandle, params, thisBulkIn, allBulkOuts, i, 2);
40+
[thisContrastLayers1, subRoughs(i)] = callMatlabFunction(functionHandle, params, thisBulkIn, bulkOuts, i, 1);
41+
[thisContrastLayers2, ~] = callMatlabFunction(functionHandle, params, thisBulkIn, bulkOuts, i, 2);
4242
else
43-
[thisContrastLayers1, subRoughs(i)] = callCppFunction(functionHandle, params, thisBulkIn, allBulkOuts, i-1, 0);
44-
[thisContrastLayers2, ~] = callCppFunction(functionHandle, params, thisBulkIn, allBulkOuts, i-1, 1);
43+
[thisContrastLayers1, subRoughs(i)] = callCppFunction(functionHandle, params, thisBulkIn, bulkOuts, i-1, 0);
44+
[thisContrastLayers2, ~] = callCppFunction(functionHandle, params, thisBulkIn, bulkOuts, i-1, 1);
4545
end
4646

4747
% If the output layers has 5 columns, then we need to do
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
function [allSLDs,subRoughs] = processCustomFunction(contrastBulkIns,contrastBulkOuts,...
2-
bulkIn,bulkOut,cCustFiles,numberOfContrasts,customFiles,params)
1+
function [slds,subRoughs] = processCustomFunction(contrastBulkIns,contrastBulkOuts,...
2+
bulkInArray,bulkOutArray,cCustFiles,numberOfContrasts,customFiles,params)
33

44
% Top-level function for processing custom XY profiles for all the
55
% contrasts.
66

77
% Do some pre-definitions to keep the compiler happy...
8-
tempAllSLDs = cell(numberOfContrasts,2);
9-
allSLDs = cell(numberOfContrasts,2);
8+
tempSLDs = cell(numberOfContrasts,2);
9+
slds = cell(numberOfContrasts,2);
1010
subRoughs = zeros(numberOfContrasts,1);
1111

1212
for i = 1:numberOfContrasts
13-
allSLDs{i,1} = [1,1]; % Type def as double (size not important)
14-
allSLDs{i,2} = [1,1];
15-
tempAllSLDs{i,1} = [0 0];
16-
tempAllSLDs{i,2} = [0 0];
13+
slds{i,1} = [1,1]; % Type def as double (size not important)
14+
slds{i,2} = [1,1];
15+
tempSLDs{i,1} = [0 0];
16+
tempSLDs{i,2} = [0 0];
1717
end
18-
coder.varsize('tempAllSLDs{:}',[10000 3],[1 1]); % 3 columns to allow for potential imaginary curve
18+
coder.varsize('tempSLDs{:}',[10000 3],[1 1]); % 3 columns to allow for potential imaginary curve
1919

20-
allBulkOuts = bulkOut(contrastBulkOuts);
20+
bulkOuts = bulkOutArray(contrastBulkOuts);
2121
for i = 1:numberOfContrasts % TODO - the ambition is for parfor here, but would fail for Matlab and Python CM's..
2222

2323
% Choose which custom file is associated with this contrast
2424
functionHandle = customFiles{cCustFiles(i)};
2525

2626
% Find values of 'bulkIn' and 'bulkOut' for this contrast...
27-
thisBulkIn = bulkIn(contrastBulkIns(i));
27+
thisBulkIn = bulkInArray(contrastBulkIns(i));
2828

2929
if isnan(str2double(functionHandle))
30-
[tempAllSLDs{i, 1}, subRoughs(i)] = callMatlabFunction(functionHandle, params, thisBulkIn, allBulkOuts, i, 1);
31-
[tempAllSLDs{i, 2}, ~] = callMatlabFunction(functionHandle, params, thisBulkIn, allBulkOuts, i, 2);
30+
[tempSLDs{i, 1}, subRoughs(i)] = callMatlabFunction(functionHandle, params, thisBulkIn, bulkOuts, i, 1);
31+
[tempSLDs{i, 2}, ~] = callMatlabFunction(functionHandle, params, thisBulkIn, bulkOuts, i, 2);
3232
else
33-
[tempAllSLDs{i, 1}, subRoughs(i)] = callCppFunction(functionHandle, params, thisBulkIn, allBulkOuts, i-1, 0);
34-
[tempAllSLDs{i, 2}, ~] = callCppFunction(functionHandle, params, thisBulkIn, allBulkOuts, i-1, 1);
33+
[tempSLDs{i, 1}, subRoughs(i)] = callCppFunction(functionHandle, params, thisBulkIn, bulkOuts, i-1, 0);
34+
[tempSLDs{i, 2}, ~] = callCppFunction(functionHandle, params, thisBulkIn, bulkOuts, i-1, 1);
3535
end
3636
end
3737

38-
allSLDs = tempAllSLDs;
38+
slds = tempSLDs;
3939
end

targetFunctions/+nonPolarisedTF/+customLayers/processCustomFunction.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function [resampledLayers,subRoughs] = processCustomFunction(contrastBulkIns,contrastBulkOuts,...
2-
bulkIn,bulkOut,cCustFiles,numberOfContrasts,customFiles,params,useImaginary)
2+
bulkInArray,bulkOutArray,cCustFiles,numberOfContrasts,customFiles,params,useImaginary)
33

44
% Top-level function for processing custom layers for all the
55
% contrasts.
@@ -15,23 +15,23 @@
1515
end
1616
coder.varsize('tempResampledLayers{:}',[10000 6],[1 1]);
1717

18-
allBulkOuts = bulkOut(contrastBulkOuts);
18+
bulkOuts = bulkOutArray(contrastBulkOuts);
1919
for i = 1:numberOfContrasts % TODO - the ambition is for parfor here, but would fail for Matlab and Python CM's..
2020

2121
% Choose which custom file is associated with this contrast
2222
functionHandle = customFiles{cCustFiles(i)};
2323

2424
% Find values of 'bulkIn' and 'bulkOut' for this
2525
% contrast...
26-
thisBulkIn = bulkIn(contrastBulkIns(i));
27-
thisBulkOut = allBulkOuts(i);
26+
thisBulkIn = bulkInArray(contrastBulkIns(i));
27+
thisBulkOut = bulkOuts(i);
2828

2929
thisContrastLayers = [1 1 1]; % typeDef
3030
coder.varsize('thisContrastLayers',[10000, 6],[1 1]);
3131
if isnan(str2double(functionHandle))
32-
[thisContrastLayers,subRoughs(i)] = callMatlabFunction(functionHandle, params, thisBulkIn, allBulkOuts, i, 0);
32+
[thisContrastLayers,subRoughs(i)] = callMatlabFunction(functionHandle, params, thisBulkIn, bulkOuts, i, 0);
3333
else
34-
[thisContrastLayers, subRoughs(i)] = callCppFunction(functionHandle, params, thisBulkIn, allBulkOuts, i-1, -1);
34+
[thisContrastLayers, subRoughs(i)] = callCppFunction(functionHandle, params, thisBulkIn, bulkOuts, i-1, -1);
3535
end
3636

3737
% If the output layers has 5 columns, then we need to do
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
function [allSLDs,subRoughs] = processCustomFunction(contrastBulkIns,contrastBulkOuts,...
2-
bulkIn,bulkOut,cCustFiles,numberOfContrasts,customFiles,params)
1+
function [slds,subRoughs] = processCustomFunction(contrastBulkIns,contrastBulkOuts,...
2+
bulkInArray,bulkOutArray,cCustFiles,numberOfContrasts,customFiles,params)
33

44
% Top-level function for processing custom XY profiles for all the
55
% contrasts.
66

77
% Do some pre-definitions to keep the compiler happy...
8-
tempAllSLDs = cell(numberOfContrasts,1);
9-
allSLDs = cell(numberOfContrasts,1);
8+
tempSLDs = cell(numberOfContrasts,1);
9+
slds = cell(numberOfContrasts,1);
1010
subRoughs = zeros(numberOfContrasts,1);
1111

1212
for i = 1:numberOfContrasts
13-
allSLDs{i} = [1,1]; % Type def as double (size not important)
14-
tempAllSLDs{i} = [0 0];
13+
slds{i} = [1,1]; % Type def as double (size not important)
14+
tempSLDs{i} = [0 0];
1515
end
16-
coder.varsize('tempAllSLDs{:}',[10000 3],[1 1]); % 3 columns to allow for potential imaginary curve
16+
coder.varsize('tempSLDs{:}',[10000 3],[1 1]); % 3 columns to allow for potential imaginary curve
1717

18-
allBulkOuts = bulkOut(contrastBulkOuts);
18+
bulkOuts = bulkOutArray(contrastBulkOuts);
1919
for i = 1:numberOfContrasts % TODO - the ambition is for parfor here, but would fail for Matlab and Python CM's..
2020

2121
% Choose which custom file is associated with this contrast
2222
functionHandle = customFiles{cCustFiles(i)};
2323

2424
% Find values of 'bulkIn' and 'bulkOut' for this
2525
% contrast...
26-
thisBulkIn = bulkIn(contrastBulkIns(i));
26+
thisBulkIn = bulkInArray(contrastBulkIns(i));
2727

2828
if isnan(str2double(functionHandle))
29-
[tempAllSLDs{i}, subRoughs(i)] = callMatlabFunction(functionHandle, params, thisBulkIn, allBulkOuts, i, 0);
29+
[tempSLDs{i}, subRoughs(i)] = callMatlabFunction(functionHandle, params, thisBulkIn, bulkOuts, i, 0);
3030
else
31-
[tempAllSLDs{i}, subRoughs(i)] = callCppFunction(functionHandle, params, thisBulkIn, allBulkOuts, i-1, -1);
31+
[tempSLDs{i}, subRoughs(i)] = callCppFunction(functionHandle, params, thisBulkIn, bulkOuts, i-1, -1);
3232
end
3333
end
3434

35-
allSLDs = tempAllSLDs;
35+
slds = tempSLDs;
3636
end

0 commit comments

Comments
 (0)