mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2025-04-11 03:20:46 +01:00
resample: output dir option
This commit is contained in:
parent
89cf008fb8
commit
4506e1689c
@ -34,7 +34,7 @@ using namespace Latan;
|
|||||||
static void usage(const string &cmdName)
|
static void usage(const string &cmdName)
|
||||||
{
|
{
|
||||||
cerr << "usage: " << cmdName;
|
cerr << "usage: " << cmdName;
|
||||||
cerr << " [-n <nsample> -b <bin size> -r <state>]";
|
cerr << " [-n <nsample> -b <bin size> -r <state> -o <output dir>]";
|
||||||
cerr << " <data list> <name list>";
|
cerr << " <data list> <name list>";
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@ -44,12 +44,12 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
// argument parsing ////////////////////////////////////////////////////////
|
// argument parsing ////////////////////////////////////////////////////////
|
||||||
int c;
|
int c;
|
||||||
string manFileName, nameFileName, stateFileName, cmdName;
|
string manFileName, nameFileName, stateFileName, cmdName, outDirName = ".";
|
||||||
Index binSize = 1, nSample = DEF_NSAMPLE;
|
Index binSize = 1, nSample = DEF_NSAMPLE;
|
||||||
|
|
||||||
opterr = 0;
|
opterr = 0;
|
||||||
cmdName = basename(argv[0]);
|
cmdName = basename(argv[0]);
|
||||||
while ((c = getopt(argc, argv, "b:n:r:")) != -1)
|
while ((c = getopt(argc, argv, "b:n:r:o:")) != -1)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
@ -59,6 +59,9 @@ int main(int argc, char *argv[])
|
|||||||
case 'n':
|
case 'n':
|
||||||
nSample = strTo<Index>(optarg);
|
nSample = strTo<Index>(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'o':
|
||||||
|
outDirName = optarg;
|
||||||
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
stateFileName = optarg;
|
stateFileName = optarg;
|
||||||
break;
|
break;
|
||||||
@ -89,10 +92,11 @@ int main(int argc, char *argv[])
|
|||||||
cout << "================================================" << endl;
|
cout << "================================================" << endl;
|
||||||
cout << "Data resampler" << endl;
|
cout << "Data resampler" << endl;
|
||||||
cout << "------------------------------------------------" << endl;
|
cout << "------------------------------------------------" << endl;
|
||||||
cout << " #file= " << dataFileName.size() << endl;
|
cout << " #file= " << dataFileName.size() << endl;
|
||||||
cout << " #name= " << name.size() << endl;
|
cout << " #name= " << name.size() << endl;
|
||||||
cout << " bin size= " << binSize << endl;
|
cout << " bin size= " << binSize << endl;
|
||||||
cout << " #sample= " << nSample << endl;
|
cout << " #sample= " << nSample << endl;
|
||||||
|
cout << "output dir: " << outDirName << endl;
|
||||||
cout << "------------------------------------------------" << endl;
|
cout << "------------------------------------------------" << endl;
|
||||||
|
|
||||||
// data loading ////////////////////////////////////////////////////////////
|
// data loading ////////////////////////////////////////////////////////////
|
||||||
@ -129,7 +133,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
for (unsigned int i = 0; i < name.size(); ++i)
|
for (unsigned int i = 0; i < name.size(); ++i)
|
||||||
{
|
{
|
||||||
const string outFileName = name[i] + "_" + manFileName + ".boot";
|
const string outFileName = name[i] + "_" + manFileName + ".sample";
|
||||||
|
|
||||||
cout << '\r' << ProgressBar(i + 1, name.size());
|
cout << '\r' << ProgressBar(i + 1, name.size());
|
||||||
data[name[i]].bin(binSize);
|
data[name[i]].bin(binSize);
|
||||||
@ -138,7 +142,8 @@ int main(int argc, char *argv[])
|
|||||||
g.setState(state);
|
g.setState(state);
|
||||||
}
|
}
|
||||||
s = data[name[i]].bootstrapMean(nSample, g);
|
s = data[name[i]].bootstrapMean(nSample, g);
|
||||||
Io::save<DMatSample, AsciiFile>(s, outFileName);
|
Io::save<DMatSample, AsciiFile>(s, outDirName + "/" + outFileName,
|
||||||
|
File::Mode::write, outFileName);
|
||||||
}
|
}
|
||||||
cout << endl;
|
cout << endl;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user