mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2024-11-10 00:45:36 +00:00
data plot with filters
This commit is contained in:
parent
f4dff86ce6
commit
6fbb0f70ef
@ -206,6 +206,42 @@ PlotData::PlotData(const XYStatData &data, const Index i, const Index j, const b
|
||||
setCommand("'" + tmpFileName + "' " + usingCmd);
|
||||
}
|
||||
|
||||
PlotData::PlotData(const XYStatData & data, XYStatData::CoordFilter f, Index i, const Index j, const bool abs)
|
||||
{
|
||||
string usingCmd, tmpFileName;
|
||||
|
||||
if (!abs)
|
||||
{
|
||||
usingCmd = (data.isXExact(i)) ? "u 1:3:4 w yerr" : "u 1:3:2:4 w xyerr";
|
||||
}
|
||||
else
|
||||
{
|
||||
usingCmd = (data.isXExact(i)) ? "u 1:(abs($3)):4 w yerr" : "u 1:(abs($3)):2:4 w xyerr";
|
||||
}
|
||||
|
||||
tmpFileName = dumpToTmpFile(data.getTable(i, j, f));
|
||||
pushTmpFile(tmpFileName);
|
||||
setCommand("'" + tmpFileName + "' " + usingCmd);
|
||||
}
|
||||
|
||||
PlotData::PlotData(const XYStatData & data, XYStatData::PointFilter f, Index i, const Index j, const bool abs)
|
||||
{
|
||||
string usingCmd, tmpFileName;
|
||||
|
||||
if (!abs)
|
||||
{
|
||||
usingCmd = (data.isXExact(i)) ? "u 1:3:4 w yerr" : "u 1:3:2:4 w xyerr";
|
||||
}
|
||||
else
|
||||
{
|
||||
usingCmd = (data.isXExact(i)) ? "u 1:(abs($3)):4 w yerr" : "u 1:(abs($3)):2:4 w xyerr";
|
||||
}
|
||||
|
||||
tmpFileName = dumpToTmpFile(data.getTable(i, j, f));
|
||||
pushTmpFile(tmpFileName);
|
||||
setCommand("'" + tmpFileName + "' " + usingCmd);
|
||||
}
|
||||
|
||||
// PlotPoint constructor ///////////////////////////////////////////////////////
|
||||
PlotPoint::PlotPoint(const double x, const double y)
|
||||
{
|
||||
@ -775,7 +811,7 @@ void Plot::display(void)
|
||||
ostringstream scriptBuf;
|
||||
|
||||
getProgramPath();
|
||||
command = gnuplotPath_ + "/" + gnuplotBin_ + " 2>/dev/null";
|
||||
command = gnuplotPath_ + "/" + gnuplotBin_;
|
||||
gnuplotPipe = popen(command.c_str(), "w");
|
||||
if (!gnuplotPipe)
|
||||
{
|
||||
|
@ -94,6 +94,10 @@ public:
|
||||
PlotData(const DMatSample &x, const DVec &y, const bool abs = false);
|
||||
PlotData(const XYStatData &data, const Index i = 0, const Index j = 0,
|
||||
const bool abs = false);
|
||||
PlotData(const XYStatData &data, XYStatData::CoordFilter f, Index i = 0,
|
||||
const Index j = 0, const bool abs = false);
|
||||
PlotData(const XYStatData &data, XYStatData::PointFilter f, Index i = 0,
|
||||
const Index j = 0, const bool abs = false);
|
||||
// destructor
|
||||
virtual ~PlotData(void) = default;
|
||||
};
|
||||
|
@ -65,6 +65,9 @@ private:
|
||||
******************************************************************************/
|
||||
class XYStatData: public FitInterface
|
||||
{
|
||||
public:
|
||||
typedef std::function<bool(const std::vector<Index> &)> CoordFilter;
|
||||
typedef std::function<bool(const DVec &)> PointFilter;
|
||||
public:
|
||||
// constructor
|
||||
XYStatData(void) = default;
|
||||
@ -89,6 +92,8 @@ public:
|
||||
DVec getXError(const Index i) const;
|
||||
DVec getYError(const Index j) const;
|
||||
DMat getTable(const Index i, const Index j) const;
|
||||
DMat getTable(const Index i, const Index j, CoordFilter &coordFilter) const;
|
||||
DMat getTable(const Index i, const Index j, PointFilter &ptFilter) const;
|
||||
// get total fit variance & correlation matrices and their pseudo-inverse
|
||||
const DMat & getFitVarMat(void);
|
||||
const DMat & getFitVarMatPInv(void);
|
||||
|
Loading…
Reference in New Issue
Block a user