6 #include "C1dInvGaConf.h"
7 #include "NetCDFTools.h"
12 #include <boost/bind.hpp>
22 Configuration.GetData(
"1dinvga.conf");
26 cout <<
"Data name base: ";
28 MTData.GetData(datanamebase +
".mtt");
33 cout <<
"Model name base: ";
35 C1DMTSynthData MTModel;
36 MTModel.readmodel(modelnamebase +
"_mt.mod");
38 ublas::vector<double> MTModelVector = MTModel.GetModelVector();
40 double MTOldRMS = MTObjective.CalcPerformance(MTModelVector);
41 ublas::vector<double> OldData(MTObjective.GetSynthData());
43 MTAnalyser.SetModel(MTModelVector);
45 cout <<
"MT Singular Values : " << MTAnalyser.GetSingularValues() << endl;
48 cout <<
"Relative SVD Threshold: ";
49 double svdthreshold = 0.0;
51 MTAnalyser.SetRelativeSVDThreshold(svdthreshold);
52 ublas::vector<double> MTProjection(MTModelVector),
53 MTPerturb(MTModelVector), MTNewModel(MTModelVector);
56 double MTNewRMS = MTOldRMS;
57 cout <<
"Original RMS : " << MTOldRMS << endl;
61 for (
int i = 0; i < MTPerturb.size(); ++i)
62 MTPerturb(i) = Random.GetNumber(-1., 1.);
63 MTNewModel = MTModelVector;
64 while (std::abs(MTNewRMS - MTOldRMS) / MTOldRMS < 0.05 && currit < maxit)
66 MTProjection = prod(MTAnalyser.GetModelNullspace(), MTPerturb);
67 MTNewModel += MTProjection;
68 MTNewRMS = MTObjective.CalcPerformance(MTNewModel);
69 cout <<
"MT New RMS: " << MTNewRMS << endl;
73 MTObjective.WriteData(
"new.mtt");
75 MTObjective.WritePlot(
"new_mt.plot");
77 MTObjective.WriteModel(
"new_mt.mod");
78 cout <<
"MT OldRMS: " << MTOldRMS <<
" MT NewRMS: " << MTNewRMS << endl;
80 cout <<
"MT Old Model: " << MTModelVector << endl;
81 cout <<
"MT New Model: " << MTNewModel << endl;
83 WriteMatrixAsNetCDF(
"mtres.nc", MTAnalyser.GetModelResolution());
84 WriteMatrixAsNetCDF(
"mtnull.nc", MTAnalyser.GetModelNullspace());
void SetupMTFitParameters(const tConfObject &Configuration, C1DMTObjective &Objective)
boost::shared_ptr< PlottableObjective > MTObjective
The class ModelAnalysis is used to calculate resolution matrix, nullspace and other parameters for mo...
CLevanisoConf Configuration