mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2025-06-07 10:37:05 +01:00
Compare commits
3 Commits
6fbb0f70ef
...
4988f351f2
Author | SHA1 | Date | |
---|---|---|---|
4988f351f2 | |||
89b540d074 | |||
bdfbaa80b9 |
@ -112,20 +112,28 @@ PlotHeadCommand::PlotHeadCommand(const string &command)
|
||||
}
|
||||
|
||||
// PlotData constructor ////////////////////////////////////////////////////////
|
||||
PlotData::PlotData(const DMatSample &x, const DMatSample &y, const bool abs)
|
||||
PlotData::PlotData(const DVecPair &x, const DVecPair &y, const bool abs)
|
||||
{
|
||||
if (x[central].rows() != y[central].rows())
|
||||
if (x.first.rows() != y.first.rows())
|
||||
{
|
||||
LATAN_ERROR(Size, "x and y vectors do not have the same size");
|
||||
}
|
||||
if (x.first.rows() != x.second.rows())
|
||||
{
|
||||
LATAN_ERROR(Size, "x and error vectors do not have the same size");
|
||||
}
|
||||
if (y.first.rows() != y.second.rows())
|
||||
{
|
||||
LATAN_ERROR(Size, "y and error vectors do not have the same size");
|
||||
}
|
||||
|
||||
DMat d(x[central].rows(), 4);
|
||||
DMat d(x.first.rows(), 4);
|
||||
string usingCmd, tmpFileName;
|
||||
|
||||
d.col(0) = x[central].col(0);
|
||||
d.col(2) = y[central].col(0);
|
||||
d.col(1) = x.variance().cwiseSqrt().col(0);
|
||||
d.col(3) = y.variance().cwiseSqrt().col(0);
|
||||
d.col(0) = x.first.col(0);
|
||||
d.col(2) = y.first.col(0);
|
||||
d.col(1) = x.second.col(0);
|
||||
d.col(3) = y.second.col(0);
|
||||
tmpFileName = dumpToTmpFile(d);
|
||||
pushTmpFile(tmpFileName);
|
||||
if (!abs)
|
||||
@ -138,19 +146,23 @@ PlotData::PlotData(const DMatSample &x, const DMatSample &y, const bool abs)
|
||||
}
|
||||
}
|
||||
|
||||
PlotData::PlotData(const DVec &x, const DMatSample &y, const bool abs)
|
||||
PlotData::PlotData(const DVec &x, const DVecPair &y, const bool abs)
|
||||
{
|
||||
if (x.rows() != y[central].rows())
|
||||
if (x.rows() != y.first.rows())
|
||||
{
|
||||
LATAN_ERROR(Size, "x and y vector does not have the same size");
|
||||
LATAN_ERROR(Size, "x and y vectors do not have the same size");
|
||||
}
|
||||
if (y.first.rows() != y.second.rows())
|
||||
{
|
||||
LATAN_ERROR(Size, "y and error vectors do not have the same size");
|
||||
}
|
||||
|
||||
DMat d(x.rows(), 3);
|
||||
string usingCmd, tmpFileName;
|
||||
|
||||
d.col(0) = x;
|
||||
d.col(1) = y[central].col(0);
|
||||
d.col(2) = y.variance().cwiseSqrt().col(0);
|
||||
d.col(1) = y.first.col(0);
|
||||
d.col(2) = y.second.col(0);
|
||||
tmpFileName = dumpToTmpFile(d);
|
||||
pushTmpFile(tmpFileName);
|
||||
if (!abs)
|
||||
@ -163,19 +175,23 @@ PlotData::PlotData(const DVec &x, const DMatSample &y, const bool abs)
|
||||
}
|
||||
}
|
||||
|
||||
PlotData::PlotData(const DMatSample &x, const DVec &y, const bool abs)
|
||||
PlotData::PlotData(const DVecPair &x, const DVec &y, const bool abs)
|
||||
{
|
||||
if (x[central].rows() != y.rows())
|
||||
if (x.first.rows() != y.rows())
|
||||
{
|
||||
LATAN_ERROR(Size, "x and y vectors do not have the same size");
|
||||
}
|
||||
if (x.first.rows() != x.second.rows())
|
||||
{
|
||||
LATAN_ERROR(Size, "x and error vectors do not have the same size");
|
||||
}
|
||||
|
||||
DMat d(x[central].rows(), 3), xerr, yerr;
|
||||
DMat d(x.first.rows(), 3), xerr, yerr;
|
||||
string usingCmd, tmpFileName;
|
||||
|
||||
d.col(0) = x[central].col(0);
|
||||
d.col(0) = x.first.col(0);
|
||||
d.col(2) = y;
|
||||
d.col(1) = x.variance().cwiseSqrt().col(0);
|
||||
d.col(1) = x.second.col(0);
|
||||
tmpFileName = dumpToTmpFile(d);
|
||||
pushTmpFile(tmpFileName);
|
||||
if (!abs)
|
||||
@ -188,6 +204,19 @@ PlotData::PlotData(const DMatSample &x, const DVec &y, const bool abs)
|
||||
}
|
||||
}
|
||||
|
||||
PlotData::PlotData(const DMatSample &x, const DMatSample &y, const bool abs)
|
||||
: PlotData(DVecPair(x[central], x.variance().cwiseSqrt()),
|
||||
DVecPair(y[central], y.variance().cwiseSqrt()), abs)
|
||||
{}
|
||||
|
||||
PlotData::PlotData(const DVec &x, const DMatSample &y, const bool abs)
|
||||
: PlotData(x, DVecPair(y[central], y.variance().cwiseSqrt()), abs)
|
||||
{}
|
||||
|
||||
PlotData::PlotData(const DMatSample &x, const DVec &y, const bool abs)
|
||||
: PlotData(DVecPair(x[central], x.variance().cwiseSqrt()), y, abs)
|
||||
{}
|
||||
|
||||
PlotData::PlotData(const XYStatData &data, const Index i, const Index j, const bool abs)
|
||||
{
|
||||
string usingCmd, tmpFileName;
|
||||
@ -913,6 +942,7 @@ ostream & Latan::operator<<(ostream &out, const Plot &plot)
|
||||
if (!plot.options_.terminal.empty())
|
||||
{
|
||||
out << "set term " << plot.options_.terminal << endl;
|
||||
out << "set pointintervalbox 0" << endl;
|
||||
}
|
||||
if (!plot.options_.output.empty())
|
||||
{
|
||||
|
@ -87,8 +87,13 @@ public:
|
||||
|
||||
class PlotData: public PlotObject
|
||||
{
|
||||
public:
|
||||
typedef std::pair<DVec, DVec> DVecPair;
|
||||
public:
|
||||
// constructor
|
||||
PlotData(const DVecPair &x, const DVecPair &y, const bool abs = false);
|
||||
PlotData(const DVec &x, const DVecPair &y, const bool abs = false);
|
||||
PlotData(const DVecPair &x, const DVec &y, const bool abs = false);
|
||||
PlotData(const DMatSample &x, const DMatSample &y, const bool abs = false);
|
||||
PlotData(const DVec &x, const DMatSample &y, const bool abs = false);
|
||||
PlotData(const DMatSample &x, const DVec &y, const bool abs = false);
|
||||
|
@ -66,18 +66,18 @@ void DataFilter::operator()(DMat &out, const DMat &in)
|
||||
******************************************************************************/
|
||||
// constructor ////////////////////////////////////////////////////////////////
|
||||
LaplaceDataFilter::LaplaceDataFilter(const bool downsample)
|
||||
: DataFilter({1., -2. , 1.}, downsample)
|
||||
: DataFilter({-1., 2. , -1.}, downsample)
|
||||
{}
|
||||
|
||||
// filtering //////////////////////////////////////////////////////////////////
|
||||
void LaplaceDataFilter::operator()(DVec &out, const DVec &in, const double lambda)
|
||||
{
|
||||
filter_[1] = -2. - lambda;
|
||||
filter_[1] = 2. + Math::pow<2>(lambda);
|
||||
DataFilter::operator()(out, in);
|
||||
}
|
||||
|
||||
void LaplaceDataFilter::operator()(DMat &out, const DMat &in, const double lambda)
|
||||
{
|
||||
filter_[1] = -2. - lambda;
|
||||
filter_[1] = 2. + Math::pow<2>(lambda);
|
||||
DataFilter::operator()(out, in);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
template <typename MatType, Index o>
|
||||
double optimiseFunction(const StatArray<MatType, o> &data,
|
||||
ObjectiveFunction<MatType, o> &fn,
|
||||
Minimizer &min, const unsigned int nPass = 3);
|
||||
Minimizer &min);
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
@ -104,8 +104,7 @@ void LaplaceDataFilter::operator()(StatArray<MatType, o> &out,
|
||||
template <typename MatType, Index o>
|
||||
double LaplaceDataFilter::optimiseFunction(const StatArray<MatType, o> &data,
|
||||
ObjectiveFunction<MatType, o> &fn,
|
||||
Minimizer &min,
|
||||
const unsigned int nPass)
|
||||
Minimizer &min)
|
||||
{
|
||||
StatArray<MatType, o> fdata(data.size());
|
||||
DVec init(1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user