Set mode_files in such a way that it can be handled with key-value pair.
We need a single mode file that contains variable xparams = [x1 x2 x3] all multiple modes, one per column. Fixes #1199time-shift
parent
d8fea3ff13
commit
3e8dbcfc7e
|
@ -230,10 +230,10 @@ if init,
|
||||||
end
|
end
|
||||||
|
|
||||||
case 'mode_files'
|
case 'mode_files'
|
||||||
% for multimodal posteriors provide a list of mode files,
|
% for multimodal posteriors provide the name of
|
||||||
% one per mode. With this info, the code will automatically
|
% a file containing a variable array xparams = [nparam * nmodes]
|
||||||
% set the <mode> option. The mode files need only to
|
% one column per mode. With this info, the code will automatically
|
||||||
% contain the xparam1 variable.
|
% set the <mode> option.
|
||||||
% This will automatically trigger <rotated>
|
% This will automatically trigger <rotated>
|
||||||
% default = []
|
% default = []
|
||||||
posterior_sampler_options.mode_files = options_list{i,2};
|
posterior_sampler_options.mode_files = options_list{i,2};
|
||||||
|
@ -326,9 +326,12 @@ if init,
|
||||||
|
|
||||||
if ~isempty(posterior_sampler_options.mode_files), % multimodal case
|
if ~isempty(posterior_sampler_options.mode_files), % multimodal case
|
||||||
modes = posterior_sampler_options.mode_files; % these can be also mean files from previous parallel slice chains
|
modes = posterior_sampler_options.mode_files; % these can be also mean files from previous parallel slice chains
|
||||||
for j=1:length( modes ),
|
load(modes, 'xparams')
|
||||||
load(modes{j}, 'xparam1')
|
if size(xparams,2)<2,
|
||||||
mode(j).m=xparam1;
|
error(['check_posterior_sampler_options:: Variable xparams loaded in file <' modes '> has size [' int2str(size(xparams,1)) 'x' int2str(size(xparams,2)) ']: it must contain at least two columns, to allow multi-modal sampling.'])
|
||||||
|
end
|
||||||
|
for j=1:size(xparams,2),
|
||||||
|
mode(j).m=xparams(:,j);
|
||||||
end
|
end
|
||||||
posterior_sampler_options.mode = mode;
|
posterior_sampler_options.mode = mode;
|
||||||
posterior_sampler_options.rotated = 1;
|
posterior_sampler_options.rotated = 1;
|
||||||
|
|
Loading…
Reference in New Issue