Skip to content

Commit 144b52e

Browse files
committed
Merge pull request #190 from dmcdougall/edit_examples_v0.50.0
Edit examples v0.50.0
2 parents 43e0d32 + c5bb371 commit 144b52e

15 files changed

+493
-381
lines changed

examples/Makefile.am

+2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ exSimpleStatisticalInverseProblem_gsldir = $(prefix)/examples/simpleStatisticalI
8282

8383
exSimpleStatisticalInverseProblem_gsl_DATA = $(top_srcdir)/examples/simpleStatisticalInverseProblem/tests/test_2013_08_26/example.inp
8484
exSimpleStatisticalInverseProblem_gsl_DATA += $(top_srcdir)/examples/simpleStatisticalInverseProblem/tests/test_2013_08_26/simple_ip_plots.m
85+
exSimpleStatisticalInverseProblem_gsl_DATA += $(top_srcdir)/examples/simpleStatisticalInverseProblem/tests/test_2013_08_26/histyy.m
8586
exSimpleStatisticalInverseProblem_gsl_DATA += $(top_srcdir)/examples/simpleStatisticalInverseProblem/src/Makefile_sip_example_margarida
8687

8788
exSimpleStatisticalInverseProblem_gsl_PROGRAMS = exSimpleStatisticalInverseProblem_gsl
@@ -109,6 +110,7 @@ dist_exSimpleStatisticalInverseProblem_gsl_DATA += ${exSimpleStatisticalInverseP
109110
exSimpleStatisticalForwardProblem_gsldir = $(prefix)/examples/simpleStatisticalForwardProblem
110111

111112
exSimpleStatisticalForwardProblem_gsl_DATA = $(top_srcdir)/examples/simpleStatisticalForwardProblem/tests/test_2013_08_27/simple_sfp_example.inp
113+
exSimpleStatisticalForwardProblem_gsl_DATA += $(top_srcdir)/examples/simpleStatisticalForwardProblem/tests/test_2013_08_27/simple_fp_plots.m
112114
exSimpleStatisticalForwardProblem_gsl_DATA += $(top_srcdir)/examples/simpleStatisticalForwardProblem/src/Makefile_sfp_example_margarida
113115

114116
exSimpleStatisticalForwardProblem_gsl_PROGRAMS = exSimpleStatisticalForwardProblem_gsl

examples/gravity/src/Makefile_example_violeta

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
##########################################################
2-
# Using installed QUESO 0.47.1, from tarball, in 'violeta'
2+
# Using installed QUESO 0.50.0, from external release, in 'violeta'
33
##########################################################
44

5-
QUESO_DIR = /home/kemelli/LIBRARIES/QUESO-0.47.1
5+
QUESO_DIR = /home/kemelli/LIBRARIES/QUESO-0.50.0
66
BOOST_DIR = /home/kemelli/LIBRARIES/boost-1.53.0
77
GSL_DIR = /home/kemelli/LIBRARIES/gsl-1.15
88
HDF5_DIR = /home/kemelli/LIBRARIES/hdf5-1.8.10

examples/simpleStatisticalForwardProblem/src/Makefile_sfp_example_margarida

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
##########################################################
2-
# Using installed QUESO 0.47.1, from tarball, in 'margarida'
2+
# Using installed QUESO 0.50.0, from external release in 'margarida'
33
##########################################################
44

5-
QUESO_DIR = /home/kemelli/LIBRARIES/QUESO-0.47.1
5+
QUESO_DIR = /home/kemelli/LIBRARIES/QUESO-0.50.0
66
BOOST_DIR = /home/kemelli/LIBRARIES/boost-1.53.0
77
GSL_DIR = /home/kemelli/LIBRARIES/gsl-1.15
88
HDF5_DIR = /home/kemelli/LIBRARIES/hdf5-1.8.10

examples/simpleStatisticalInverseProblem/src/Makefile_sip_example_margarida

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
##########################################################
2-
# Using installed QUESO 0.47.1, from tarball, in 'margarida'
2+
# Using installed QUESO 0.50.0, from external release in 'margarida'
33
##########################################################
44

5-
QUESO_DIR = /home/kemelli/LIBRARIES/QUESO-0.47.1
5+
QUESO_DIR = /home/kemelli/LIBRARIES/QUESO-0.50.0
66
BOOST_DIR = /home/kemelli/LIBRARIES/boost-1.53.0
77
GSL_DIR = /home/kemelli/LIBRARIES/gsl-1.15
88
HDF5_DIR = /home/kemelli/LIBRARIES/hdf5-1.8.10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
function varargout = histyy(data1,nBins1,data2,nBins2,varargin)
2+
%% function to plot two histograms on the same plot on two different axes.
3+
% Syntax
4+
% ------
5+
% histyy(data1, nBins1, data2, nBins2)
6+
% histyy(data1, nBins1, data2, nBins2)
7+
% histyy(data1, nBins1, data2, nBins2, label1, label2)
8+
% hAx = histyy(...)
9+
%
10+
% Inputs
11+
% ------
12+
% data1 - vector containing first histogram
13+
% nBins1 - number of bins in first histogram
14+
% data2 - vector containing second histogram
15+
% nBins2 - number of bins in second histogram
16+
% label1 - ylabel for first histogram
17+
% label2 - ylabel for second histogram
18+
%
19+
% Outputs
20+
% -------
21+
% hAx - vector containing handles to axes
22+
% hAx(1) contains handle to first histogram axis
23+
% hAx(2) contains handle to second histogram axis
24+
%
25+
% Author : araja 11/07/11
26+
27+
if isempty(varargin)
28+
label1 = '';
29+
label2 = '';
30+
elseif length(varargin) ~= 2
31+
error('Provide both label strings.');
32+
else
33+
label1 = varargin{1};
34+
label2 = varargin{2};
35+
end
36+
37+
if isempty(nBins1)
38+
nBins1 = 10;
39+
end
40+
if isempty(nBins2)
41+
nBins2 = 10;
42+
end
43+
44+
% create one axis or get current axes
45+
hAx1 = gca;
46+
47+
% get position of axis
48+
posAx1 = get(hAx1, 'Position');
49+
50+
% create an overlapping axis at the same location
51+
hAx2 = axes('Position', posAx1);
52+
53+
% histogram for first data vector
54+
hist(hAx1,data1,nBins1);
55+
set(findobj(hAx1,'Type','patch'),'FaceColor','b','EdgeColor','w', 'facealpha',0.75);
56+
57+
58+
% histogram for second data vector
59+
hist(hAx2, data2,nBins2);
60+
61+
% make second axis transparent
62+
set(hAx2,'Color','none');
63+
64+
% change color of second histogram
65+
set(findobj(hAx2,'Type','patch'),'FaceColor','g','EdgeColor','w', 'facealpha',0.75);
66+
67+
% ylabel for histogram 1
68+
ylabel(hAx1,label1);
69+
70+
% ylabel for histogram 2
71+
set(hAx2,'YAxisLocation','right');
72+
ylabel(hAx2,label2);
73+
74+
% set x-axis limits
75+
lim1 = get(hAx1, 'XLim');
76+
lim2 = get(hAx2, 'XLim');
77+
78+
set(hAx1, 'XLim', [min([lim1(1) lim2(1)]) max([lim1(2) lim2(2)])]);
79+
set(hAx2, 'XLim', [min([lim1(1) lim2(1)]) max([lim1(2) lim2(2)])]);
80+
set(hAx2, 'XTickLabel',[])
81+
82+
% output
83+
if nargout == 1
84+
varargout{1} = [hAx1 hAx2];
85+
end
86+
87+

examples/simpleStatisticalInverseProblem/tests/test_2013_08_26/simple_ip_plots.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106

107107

108108
% CDF plots ---------------------------------------------------------------
109-
fprintf(1,' Plotting KDE - raw <press any key>\n');
109+
fprintf(1,' Plotting CDF - raw <press any key>\n');
110110
[f,xi] = ksdensity(ip_mh_rawChain_unified(:,1),'function','cdf');
111111
[f2,x2] = ksdensity(ip_mh_rawChain_unified(:,2),'function','cdf');
112112
plot(xi,f,'b',x2,f2,'g','linewidth',3);
@@ -121,7 +121,7 @@
121121
clf;
122122

123123
%FILTERED
124-
fprintf(1,' Plotting KDE - filtered <press any key>\n');
124+
fprintf(1,' Plotting KCDF - filtered <press any key>\n');
125125
[f,xi] = ksdensity(ip_mh_filtChain_unified(:,1),'function','cdf');
126126
[f2,x2] = ksdensity(ip_mh_filtChain_unified(:,2),'function','cdf');
127127
plot(xi,f,'b',x2,f2,'g','linewidth',3);

examples/validationCycle/src/exTgaValidationCycle_appl.h

+13-6
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,9 @@ uqAppl(const QUESO::BaseEnvironment& env)
115115
}
116116

117117
// Inverse problem: instantiate the prior rv
118-
QUESO::UniformVectorRV<P_V,P_M> calPriorRv("cal_prior_", // Extra prefix before the default "rv_" prefix
119-
paramDomain);
118+
QUESO::UniformVectorRV<P_V,P_M> calPriorRv(
119+
"cal_prior_", // Extra prefix before the default "rv_" prefix
120+
paramDomain);
120121

121122
// Inverse problem: instantiate the likelihood function object (data + routine)
122123
likelihoodRoutine_Data<P_V,P_M> calLikelihoodRoutine_Data(env,
@@ -364,9 +365,14 @@ uqAppl(const QUESO::BaseEnvironment& env)
364365
// Inverse problem: solve it, that is, set 'pdf' and 'realizer' of the posterior rv
365366
QUESO::MhOptionsValues* valIpMhOptionsValues = NULL;
366367

367-
const QUESO::SequentialVectorRealizer<P_V,P_M>* tmpRealizer = dynamic_cast< const QUESO::SequentialVectorRealizer<P_V,P_M>* >(&(cycle.calIP().postRv().realizer()));
368-
P_M* valProposalCovMatrix = cycle.calIP().postRv().imageSet().vectorSpace().newProposalMatrix(&tmpRealizer->unifiedSampleVarVector(), // Use 'realizer()' because the post. rv was computed with Metr. Hast.
369-
&tmpRealizer->unifiedSampleExpVector()); // Use these values as the initial values
368+
const QUESO::SequentialVectorRealizer<P_V,P_M>*
369+
tmpRealizer = dynamic_cast< const QUESO::SequentialVectorRealizer<P_V,P_M>* >(&(cycle.calIP().postRv().realizer()));
370+
371+
// Use 'realizer()' because the post. rv was computed with Metr. Hast.
372+
P_M* valProposalCovMatrix = cycle.calIP().postRv().imageSet().vectorSpace().newProposalMatrix(
373+
&tmpRealizer->unifiedSampleVarVector(),
374+
&tmpRealizer->unifiedSampleExpVector()); // Use these values as the initial values
375+
370376
#ifdef UQ_EXAMPLES_USES_QUESO_INPUT_FILE
371377
#else
372378
QUESO::SsOptionsValues ssOptionsValues5;
@@ -448,7 +454,8 @@ uqAppl(const QUESO::BaseEnvironment& env)
448454
delete valProposalCovMatrix;
449455
delete valIpMhOptionsValues;
450456

451-
// Forward problem: instantiate it (parameter rv = posterior rv of inverse problem; qoi rv is instantiated internally)
457+
// Forward problem: instantiate it (parameter rv = posterior rv of inverse problem;
458+
// qoi rv is instantiated internally)
452459
qoiRoutine_Data<P_V,P_M,Q_V,Q_M> valQoiRoutine_Data;
453460
valQoiRoutine_Data.m_beta = beta_prediction;
454461
valQoiRoutine_Data.m_criticalMass = criticalMass_prediction;

0 commit comments

Comments
 (0)