current TeX

minor code changes
This commit is contained in:
2017-05-06 17:32:40 +02:00
parent 2438080389
commit edd41293c1
12 changed files with 650 additions and 132 deletions

View File

@@ -69,7 +69,7 @@ public:
//splot.setTitle("optimizing TXP and EXP}");
splot.getAxisX().setLabel("TXP (dBm)");
splot.getAxisX().setLabelOffset(-3.9, -1.9);
splot.getAxisX().setLabelOffset(-3.9 + 1.5, -1.9);
splot.getAxisX().setTicsStep(2.5);
splot.getAxisX().setTicsOffset(-1, -0.1);
@@ -87,15 +87,19 @@ public:
std::string name = Settings::fPathGFX + "/wifiop_show_optfunc_params";
gp.setOutput(name + ".tex");
gp.setTerminal("epslatex", K::GnuplotSize(8.7, 5.0));
gp.setTerminal("epslatex", K::GnuplotSize(7.7, 4.5));
splot.getAxisZ().setTicsVisible(false);
splot.getAxisZ().setLabel("");
gp << "set palette defined (0 '#00ff00', 1 '#eeeeee', 9 '#222222')\n";
gp << "set margins 0,0,0,0\n";
gp << "set multiplot layout 1,1 scale 1.25, 1.4 offset 0.02, 0.05\n";
gp << "set multiplot layout 1,1 scale 1.25, 1.4 offset -0.04, 0.05\n";
gp << "set colorbox horizontal user origin 0.03, 0.95 size 0.4, 0.03\n";
//gp << "set pm3d implicit\n";
//gp << "set hidden3d front\n";
//p mac="D8:84:66:4A:23:F0" px="46" py="47.400002" pz="13.8" txp="-40" exp="2.6500001" waf="-6.5"/>
const MACAddress mac("D8:84:66:4A:23:F0");
const Point3 pos_m(46, 47.4, 13.8);
@@ -176,19 +180,19 @@ public:
K::Gnuplot gp;
K::GnuplotSplot splot;
K::GnuplotSplotElementMesh mesh; splot.add(&mesh);
K::GnuplotSplotElementLines lines1; splot.add(&lines1); lines1.getStroke().setWidth(2); lines1.getStroke().setType(K::GnuplotDashtype::DOTTED);
K::GnuplotSplotElementLines lines2; splot.add(&lines2); lines2.getStroke().setWidth(2); lines2.getStroke().setType(K::GnuplotDashtype::DASHED);
K::GnuplotSplotElementLines lines1; splot.add(&lines1); lines1.getStroke().setWidth(1); lines1.getStroke().getColor().setHexStr("#444444"); lines1.getStroke().setType(K::GnuplotDashtype::DOTTED);
K::GnuplotSplotElementLines lines2; splot.add(&lines2); lines2.getStroke().setWidth(1); lines2.getStroke().getColor().setHexStr("#444444"); //lines2.getStroke().setType(K::GnuplotDashtype::DASHED);
K::GnuplotSplotElementLines lines3; splot.add(&lines3); lines3.getStroke().setWidth(2);
K::GnuplotSplotElementPoints points; splot.add(&points); points.setPointSize(1.5); points.setPointType(7);
//splot.setTitle("optimizing position");
splot.getAxisX().setLabel("y-pos (meter)");
splot.getAxisX().setLabelOffset(-0.9, -1.4);
splot.getAxisX().setLabelOffset(-0.9 + 0.2, -1.4 - 0.5);
splot.getAxisX().setTicsOffset(-0.9, 0);
splot.getAxisX().setTicsStep(25);
splot.getAxisY().setLabel("z-pos (meter)");
splot.getAxisY().setLabelOffset(0, -0.3);
splot.getAxisY().setLabelOffset(-0.3, -0.3 - 0.3);
splot.getAxisY().setTicsOffset(0, -0.5);
splot.getAxisY().setTicsStep(3);
@@ -203,11 +207,12 @@ public:
std::string name = Settings::fPathGFX + "/wifiop_show_optfunc_pos_yz";
gp.setOutput(name + ".tex");
gp.setTerminal("epslatex", K::GnuplotSize(8.7, 5.0));
gp.setTerminal("epslatex", K::GnuplotSize(7.7, 4.5));
gp << "set palette defined (0 '#00ff00', 1 '#eeeeee', 9 '#222222')\n";
gp << "set margins 0,0,0,0\n";
gp << "set multiplot layout 1,1 scale 1.25,1.4 offset 0.02, 0.05\n";
gp << "set multiplot layout 1,1 scale 1.25,1.4 offset -0.04, 0.05\n";
gp << "set colorbox horizontal user origin 0.57, 0.95 size 0.4, 0.03\n";
gp << "set hidden3d front\n";
// paper out
splot.setStringMod(new K::GnuplotStringModLaTeX());
@@ -223,6 +228,13 @@ public:
const int steps = 35;
std::vector<std::vector<K::GnuplotPoint3>> hor;
hor.resize(3);
std::vector<std::vector<K::GnuplotPoint3>> ver;
ver.resize(5);
for (float sz = 0; sz < steps; ++sz) {
for (int sy = 0; sy < steps; ++sy) {
@@ -239,16 +251,44 @@ public:
const K::GnuplotPoint3 gp3(pos.y, pos.z, err);
mesh.add(gp3);
if (sy == 0) {lines1.add(gp3);}
if (sy == 17) {lines2.add(gp3);}
if (sz == 24) {lines3.add(gp3);}
// horizontal lines
if (sy == 9) {hor[0].push_back(gp3);}
if (sy == 17) {hor[1].push_back(gp3);}
if (sy == 26) {hor[2].push_back(gp3);}
if (sy == 9 && sz == 24) {points.add(gp3);}
if (sy == 26 && sz == 24) {points.add(gp3);}
// vertical lines
if (sz == 0) {ver[0].push_back(gp3);}
if (sz == 8) {ver[1].push_back(gp3);}
if (sz == 14) {ver[2].push_back(gp3);}
if (sz == 20) {ver[3].push_back(gp3);}
if (sz == 28) {ver[4].push_back(gp3);}
if (sz == 24) {lines3.add(gp3);}
if (sy == 9 && sz == 24) {points.add(gp3 + K::GnuplotPoint3(0,0,0.10));} // minor z-offset for Hidden3D to work
if (sy == 26 && sz == 24) {points.add(gp3 + K::GnuplotPoint3(0,0,0.10));} // minor z-offset for Hidden3D to work
}
}
// horizontal lines
for (const std::vector<K::GnuplotPoint3>& vec : hor) {
for (const K::GnuplotPoint3 p3 : vec) {
lines1.add(p3 + K::GnuplotPoint3(0,0,0.05)); // minor z-offset for Hidden3D to work
}
lines1.add(K::GnuplotPoint3::getEmpty());
lines1.add(K::GnuplotPoint3::getEmpty());
}
// vertical lines
for (const std::vector<K::GnuplotPoint3>& vec : ver) {
for (const K::GnuplotPoint3 p3 : vec) {
lines2.add(p3 + K::GnuplotPoint3(0,0,0.05)); // minor z-offset for Hidden3D to work
}
lines2.add(K::GnuplotPoint3::getEmpty());
lines2.add(K::GnuplotPoint3::getEmpty());
}
gp.draw(splot);
LeHelper::writeCode(name + ".gp", gp.getBuffer());
gp.flush();

View File

@@ -32,6 +32,7 @@
#include "../plots/PlotErrTime.h"
#include "../plots/PlotErrFunc.h"
#include "../plots/PlotWiFiGroundProb.h"
#include "../WalkResult.h"
//#include "CSV.h"
#include <unordered_set>
@@ -142,12 +143,16 @@ public:
}
}
void walk(const std::string& fPath, const std::vector<int> gtIndices) {
WalkResult walk(const std::string& fPath, const std::vector<int> gtIndices) {
static PlotErrTime pet_m("","",""); pet_m.clear();
static PlotErrTime pet_p("","",""); pet_p.clear();
Offline::FileReader reader(fPath);
WalkResult res;
const Offline::FileReader::GroundTruth gtp = reader.getGroundTruth(map, gtIndices);
// process each wifi entry within the offline file
@@ -233,6 +238,15 @@ public:
stats_m->add(err_m);
pet_m.addErr(ts, err_m, idx);
// remember
WalkResult::Entry e;
e.ts = ts;
e.estimation = curEst;
e.groundTruth = gt;
e.err = err_m;
res.entries.push_back(e);
// error in -log(p)
float gtFloat[3] = {gt.x, gt.y, gt.z};
const double probOnGT = -func(gtFloat);
@@ -255,6 +269,8 @@ public:
}
return res;
}
};