mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2024-11-10 00:45:36 +00:00
Merge branch 'andrew-pr' into develop
This commit is contained in:
commit
a20dff68d1
@ -184,7 +184,7 @@ PlotData::PlotData(const DMatSample &x, const DVec &y, const bool abs)
|
||||
}
|
||||
else
|
||||
{
|
||||
setCommand("'" + tmpFileName + "' u 1:($3):2 w xerr");
|
||||
setCommand("'" + tmpFileName + "' u 1:(abs($3)):2 w xerr");
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,6 +206,60 @@ PlotData::PlotData(const XYStatData &data, const Index i, const Index j, const b
|
||||
setCommand("'" + tmpFileName + "' " + usingCmd);
|
||||
}
|
||||
|
||||
// PlotPoint constructor ///////////////////////////////////////////////////////
|
||||
PlotPoint::PlotPoint(const double x, const double y)
|
||||
{
|
||||
DMat d(1, 2);
|
||||
string usingCmd, tmpFileName;
|
||||
|
||||
d(0, 0) = x;
|
||||
d(0, 1) = y;
|
||||
tmpFileName = dumpToTmpFile(d);
|
||||
pushTmpFile(tmpFileName);
|
||||
setCommand("'" + tmpFileName + "' u 1:2");
|
||||
}
|
||||
|
||||
PlotPoint::PlotPoint(const DSample &x, const double y)
|
||||
{
|
||||
DMat d(1, 3);
|
||||
string usingCmd, tmpFileName;
|
||||
|
||||
d(0, 0) = x[central];
|
||||
d(0, 2) = y;
|
||||
d(0, 1) = sqrt(x.variance());
|
||||
tmpFileName = dumpToTmpFile(d);
|
||||
pushTmpFile(tmpFileName);
|
||||
setCommand("'" + tmpFileName + "' u 1:3:2 w xerr");
|
||||
}
|
||||
|
||||
PlotPoint::PlotPoint(const double x, const DSample &y)
|
||||
{
|
||||
DMat d(1, 3);
|
||||
string usingCmd, tmpFileName;
|
||||
|
||||
d(0, 0) = x;
|
||||
d(0, 1) = y[central];
|
||||
d(0, 2) = sqrt(y.variance());
|
||||
tmpFileName = dumpToTmpFile(d);
|
||||
pushTmpFile(tmpFileName);
|
||||
setCommand("'" + tmpFileName + "' u 1:2:3 w yerr");
|
||||
}
|
||||
|
||||
PlotPoint::PlotPoint(const DSample &x, const DSample &y)
|
||||
{
|
||||
DMat d(1, 4);
|
||||
string usingCmd, tmpFileName;
|
||||
|
||||
d(0, 0) = x[central];
|
||||
d(0, 2) = y[central];
|
||||
d(0, 1) = sqrt(x.variance());
|
||||
d(0, 3) = sqrt(y.variance());
|
||||
tmpFileName = dumpToTmpFile(d);
|
||||
pushTmpFile(tmpFileName);
|
||||
setCommand("'" + tmpFileName + "' u 1:3:2:4 w xyerr");
|
||||
}
|
||||
|
||||
|
||||
// PlotLine constructor ////////////////////////////////////////////////////////
|
||||
PlotLine::PlotLine(const DVec &x, const DVec &y)
|
||||
{
|
||||
|
@ -98,6 +98,18 @@ public:
|
||||
virtual ~PlotData(void) = default;
|
||||
};
|
||||
|
||||
class PlotPoint: public PlotObject
|
||||
{
|
||||
public:
|
||||
// constructor
|
||||
PlotPoint(const double x, const double y);
|
||||
PlotPoint(const DSample &x, const double y);
|
||||
PlotPoint(const double x, const DSample &y);
|
||||
PlotPoint(const DSample &x, const DSample &y);
|
||||
// destructor
|
||||
virtual ~PlotPoint(void) = default;
|
||||
};
|
||||
|
||||
class PlotHLine: public PlotObject
|
||||
{
|
||||
public:
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <LatAnalyze/Core/Plot.hpp>
|
||||
#include <LatAnalyze/Functional/CompiledModel.hpp>
|
||||
#include <LatAnalyze/Io/Io.hpp>
|
||||
#include <LatAnalyze/Numerical/DWT.hpp>
|
||||
#include <LatAnalyze/Numerical/MinuitMinimizer.hpp>
|
||||
#include <LatAnalyze/Numerical/NloptMinimizer.hpp>
|
||||
#include <LatAnalyze/Physics/CorrelatorFitter.hpp>
|
||||
@ -23,7 +24,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
// parse arguments /////////////////////////////////////////////////////////
|
||||
OptParser opt;
|
||||
bool parsed, doPlot, doHeatmap, doCorr, fold, doScan;
|
||||
bool parsed, doLaplace, doPlot, doHeatmap, doCorr, fold, doScan;
|
||||
string corrFileName, model, outFileName, outFmt, savePlot;
|
||||
Index ti, tf, shift, nPar, thinning;
|
||||
double svdTol;
|
||||
@ -52,6 +53,8 @@ int main(int argc, char *argv[])
|
||||
"only do the uncorrelated fit");
|
||||
opt.addOption("" , "fold" , OptParser::OptType::trigger, true,
|
||||
"fold the correlator");
|
||||
opt.addOption("l" , "laplace" , OptParser::OptType::trigger, true,
|
||||
"apply Laplace filter to the correlator");
|
||||
opt.addOption("p", "plot" , OptParser::OptType::trigger, true,
|
||||
"show the fit plot");
|
||||
opt.addOption("h", "heatmap" , OptParser::OptType::trigger, true,
|
||||
@ -74,6 +77,7 @@ int main(int argc, char *argv[])
|
||||
ti = opt.optionValue<Index>("ti");
|
||||
tf = opt.optionValue<Index>("tf");
|
||||
thinning = opt.optionValue<Index>("t");
|
||||
doLaplace = opt.gotOption("l");
|
||||
shift = opt.optionValue<Index>("s");
|
||||
model = opt.optionValue("m");
|
||||
nPar = opt.optionValue<Index>("nPar");
|
||||
@ -110,6 +114,22 @@ int main(int argc, char *argv[])
|
||||
nt = corr[central].rows();
|
||||
corr = corr.block(0, 0, nt, 1);
|
||||
corr = CorrelatorUtils::shift(corr, shift);
|
||||
|
||||
if (doLaplace)
|
||||
{
|
||||
vector<double> filter = {1., -2., 1.};
|
||||
DVec buf;
|
||||
|
||||
FOR_STAT_ARRAY(corr, s)
|
||||
{
|
||||
DWT::filterConvolution(buf, corr[s], filter, 1);
|
||||
corr[s] = buf;
|
||||
}
|
||||
}
|
||||
if (fold)
|
||||
{
|
||||
corr = CorrelatorUtils::fold(corr);
|
||||
}
|
||||
|
||||
// make model //////////////////////////////////////////////////////////////
|
||||
CorrelatorFitter fitter(corr);
|
||||
@ -283,7 +303,7 @@ int main(int argc, char *argv[])
|
||||
DMat id = DMat::Identity(n, n),
|
||||
var = fitter.data().getFitVarMat();
|
||||
|
||||
p << PlotMatrix(Math::varToCorr(var));
|
||||
p << PlotCorrMatrix(Math::varToCorr(var));
|
||||
p << Caption("correlation matrix");
|
||||
p.display();
|
||||
if (svdTol > 0.)
|
||||
|
Loading…
Reference in New Issue
Block a user