Skip to content

Commit 6f82749

Browse files
authored
Renames target functions and minimisers (#176)
* Renames "standardTF" to "nonPolarisedTF" * Tidies up Paramonte functions * Tidies up code in minimisers * Renames "NSMain" as "NS" * Updates paths * Addresses review comments
1 parent 756e64a commit 6f82749

File tree

78 files changed

+158
-192
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+158
-192
lines changed

3rdParty/paramonte/pmLogFunction.m

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,16 @@
1616

1717
function logFuncVal = get(obj,pars)
1818

19-
problem = obj.problemDef;
20-
control = obj.controls;
21-
cells = obj.problemDefCells;
22-
limits = obj.problemDefLimits;
23-
priors = obj.priors;
24-
19+
problem = obj.problemDef;
2520
problem.fitpars = pars;
2621

27-
if obj.scaled
22+
if obj.scaled
2823
problem = unscalePars(problem);
2924
end
3025

31-
problem = unpackparams(problem,control);
26+
problem = unpackparams(problem,obj.controls);
3227

33-
[outProblem,results] = reflectivityCalculation_mex(problem,cells,limits,control);
28+
[outProblem,~] = reflectivityCalculation_mex(problem,obj.problemDefCells,obj.controls);
3429
chi = outProblem.calculations.sum_chi;
3530
logFuncVal = -chi/2;
3631

@@ -42,14 +37,10 @@
4237
% Now apply the priors where necessary.
4338
priorfun = @(th,mu,sig) sum(((th-mu)./sig).^2);
4439

45-
val = priorfun(problem.fitpars,priors(:,1),priors(:,2));
46-
47-
logFuncVal = logFuncVal + val;
40+
val = priorfun(problem.fitpars,obj.priors(:,1),obj.priors(:,2));
4841

49-
%end
50-
42+
logFuncVal = logFuncVal + val;
5143

5244
end
5345
end
5446
end
55-

3rdParty/paramonte/pmPars.m

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
classdef pmPars < handle
22

3-
4-
properties
5-
6-
covMat = []
7-
delayedRejectionCount = []
8-
name = ''
9-
scalefactor = 1e-3
10-
chainSize = 10000
11-
chainTrim = 0.25 % Use only the last part of chain...
12-
mpi = false;
13-
14-
end
15-
16-
17-
18-
3+
properties
4+
5+
covMat = []
6+
delayedRejectionCount = []
7+
name = ''
8+
scalefactor = 1e-3
9+
chainSize = 10000
10+
chainTrim = 0.25 % Use only the last part of chain...
11+
mpi = false;
12+
13+
end
1914

2015
end

3rdParty/paramonte/processParamonteRuns.m

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
2-
function [outProblemDef,result,pmpd] = processFits(problem,controls,chainName,chainTrim)
1+
function [outProblemDef,result,pmpd] = processParamonteRuns(problem,controls,chainName,chainTrim)
32

43
% problem = load(name);
54
% problem = problem.twentyMNProblem;
65
%
76
% controls = controlsClass();
87

9-
[problemDef,problemDefCells,problemDefLimits,priors,controls] = parseClassToStructs(problem,controls);
10-
problemDefInput = problemDef;
8+
[problemDef,problemDefCells,problemDefLimits,~,controls] = parseClassToStructs(problem,controls);
119

1210
[problemDef,fitNames] = packparams(problemDef,problemDefCells,problemDefLimits,controls.checks);
13-
nDims = length(problemDef.fitpars);
1411

1512
pm = paramonte();
1613
pmpd = pm.ParaDRAM();
@@ -50,7 +47,6 @@
5047
[problemDef,outProblemStruct,result,bayesResults] = processBayes(bayesOutputs,allProblem);
5148
bayesResults.chain = unscaledChain;
5249

53-
5450
result = parseResultToStruct(outProblemStruct,result);
5551

5652
if isfield(problemDef,'fitpars')

3rdParty/paramonte/runParamonte.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
logFunc.NDIM = nDims;
4141
logFunc.scaled = true;
4242

43-
% Create a paraMonte object
43+
% Create a paramonte object
4444
pm = paramonte();
4545

4646
% create a ParaDRAM simulation object

3rdParty/paramonte/scalePars.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
function problem = scalePars(problem)
22

3-
43
limits = problem.fitconstr;
54
vals = problem.fitpars;
65

76
scaled = (vals(:) - limits(:,1))./(limits(:,2)-limits(:,1));
87

98
problem.fitpars = scaled;
10-
%problem.unscaledPars = vals;
9+
%problem.unscaledPars = vals;
10+
11+
end

3rdParty/paramonte/unscalePars.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55

66
unscaled = (scaled.*(limits(:,2)-limits(:,1)))+limits(:,1);
77

8-
problem.fitpars = unscaled;
8+
problem.fitpars = unscaled;
9+
10+
end

addPaths.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
fullfile(root,'minimisers','DE');
3838
%fullfile(root,'minimisers','mcmcstat_new');
3939
%fullfile(root,'minimisers','mcmcstat_new','src');
40-
fullfile(root,'minimisers','NSMain');
40+
fullfile(root,'minimisers','NS');
4141

4242
fullfile(root,'targetFunctions' );
4343
fullfile(root,'targetFunctions','common');
@@ -50,7 +50,7 @@
5050
fullfile(root,'targetFunctions','common','resampleLayers');
5151
fullfile(root,'targetFunctions','common','resolutionFunctions','simpleGaussian');
5252

53-
fullfile(root,'tests','standardTFReflectivityCalculation');
53+
fullfile(root,'tests','nonPolarisedTFReflectivityCalculation');
5454
fullfile(root,'tests','domainsTFReflectivityCalculation');
5555
fullfile(root,'tests','testCommonFunctions');
5656
fullfile(root,'tests','testProjectConversion');

compile/reflectivityCalculation/setCompilePaths.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function setCompilePaths(which)
1+
function setCompilePaths()
22

33
% This function sets the paths for compiling, depending on whether a mex
44
% file of source code is being generated.

minimisers/DREAM/diagnostics/raftery.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
q = 0.0;
104104
i1 = find(runs == 0); i2 = find(runs == 1);
105105
ct1 = size(i1); ct2 = size(i2);
106-
if (ct1+ct2 ~= n), error('raftery needs 0s and 1s in runs'); end;
106+
if (ct1+ct2 ~= n), error('raftery needs 0s and 1s in runs'); end
107107
work = runs;
108108
q = sum(runs);
109109
q = q/n;

minimisers/DREAM/functions/DREAM.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@
193193

194194

195195
% Store the model simulations (if appropriate)
196-
storeDREAMResults ( DREAMPar , fx , Meas_info , 'a+' );
196+
storeDREAMResults(DREAMPar,fx,Meas_info,'a+');
197197
end
198198

199199
% Check whether we update the crossover values

0 commit comments

Comments
 (0)