mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2025-04-11 03:20:46 +01:00
latan-plot now allows plotting of imag component
This commit is contained in:
parent
7bb8ee4a1d
commit
f16b26e04c
@ -15,11 +15,13 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
// parse arguments /////////////////////////////////////////////////////////
|
// parse arguments /////////////////////////////////////////////////////////
|
||||||
OptParser opt;
|
OptParser opt;
|
||||||
bool parsed;
|
bool parsed, imag;
|
||||||
string plotFileName, outFileName, xName, yName, title;
|
string plotFileName, outFileName, xName, yName, title;
|
||||||
vector<string> inFileName;
|
vector<string> inFileName;
|
||||||
double xLow, xHigh, spacing;
|
double xLow, xHigh, spacing;
|
||||||
|
|
||||||
|
opt.addOption("i" , "imag" , OptParser::OptType::trigger, true,
|
||||||
|
"plot imaginary");
|
||||||
opt.addOption("o", "output", OptParser::OptType::value , true,
|
opt.addOption("o", "output", OptParser::OptType::value , true,
|
||||||
"output file", "");
|
"output file", "");
|
||||||
opt.addOption("x", "xAxis", OptParser::OptType::value , true,
|
opt.addOption("x", "xAxis", OptParser::OptType::value , true,
|
||||||
@ -44,6 +46,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
plotFileName = opt.getArgs().front();
|
plotFileName = opt.getArgs().front();
|
||||||
|
imag = opt.gotOption("i");
|
||||||
xName = opt.optionValue("x");
|
xName = opt.optionValue("x");
|
||||||
xLow = opt.optionValue<double>("l");
|
xLow = opt.optionValue<double>("l");
|
||||||
yName = opt.optionValue("y");
|
yName = opt.optionValue("y");
|
||||||
@ -51,6 +54,8 @@ int main(int argc, char *argv[])
|
|||||||
title = opt.optionValue("t");
|
title = opt.optionValue("t");
|
||||||
outFileName = opt.optionValue<string>("o");
|
outFileName = opt.optionValue<string>("o");
|
||||||
|
|
||||||
|
cout << "imag: " << imag << endl;
|
||||||
|
|
||||||
|
|
||||||
if(plotFileName.find(".h5") == string::npos)
|
if(plotFileName.find(".h5") == string::npos)
|
||||||
{
|
{
|
||||||
@ -68,7 +73,14 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
tmp = Io::load<DMatSample>(plotFileName);
|
tmp = Io::load<DMatSample>(plotFileName);
|
||||||
nt = tmp[central].rows();
|
nt = tmp[central].rows();
|
||||||
tmp = tmp.block(0, 0, nt, 1);
|
if(imag)
|
||||||
|
{
|
||||||
|
tmp = tmp.block(0, 1, nt, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tmp = tmp.block(0, 0, nt, 1);
|
||||||
|
}
|
||||||
xHigh= xLow+spacing*(nt-1);
|
xHigh= xLow+spacing*(nt-1);
|
||||||
tAxis.setLinSpaced(nt, xLow, xHigh);
|
tAxis.setLinSpaced(nt, xLow, xHigh);
|
||||||
p << PlotData(tAxis, tmp);
|
p << PlotData(tAxis, tmp);
|
||||||
@ -78,7 +90,6 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
tmp = Io::load<DMatSample>(inFileName[0]);
|
tmp = Io::load<DMatSample>(inFileName[0]);
|
||||||
nt = tmp[central].rows();
|
nt = tmp[central].rows();
|
||||||
tmp = tmp.block(0, 0, nt, 1);
|
|
||||||
xHigh= xLow+spacing*(nt-1);
|
xHigh= xLow+spacing*(nt-1);
|
||||||
tAxis.setLinSpaced(nt, xLow, xHigh);
|
tAxis.setLinSpaced(nt, xLow, xHigh);
|
||||||
|
|
||||||
@ -86,8 +97,14 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
plotFileName = inFileName[i];
|
plotFileName = inFileName[i];
|
||||||
tmp = Io::load<DMatSample>(plotFileName);
|
tmp = Io::load<DMatSample>(plotFileName);
|
||||||
|
if(imag)
|
||||||
|
{
|
||||||
|
tmp = tmp.block(0, 1, nt, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
tmp = tmp.block(0, 0, nt, 1);
|
tmp = tmp.block(0, 0, nt, 1);
|
||||||
|
}
|
||||||
p << PlotData(tAxis, tmp);
|
p << PlotData(tAxis, tmp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user