Commit b94fbde1 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

croposp [WP][FEATURE]: support arguments to adjust computation parameters

parent 87284c78
......@@ -56,6 +56,8 @@ struct Options {
double datetolerance;
bool logscale;
unsigned int n_per_decade;
unsigned int nsegments, divisor, padfactor;
double overlap;
bool compute_psd, compute_npsd, compute_coherency, compute_transfer;
std::string outfile_psd, outfile_npsd, outfile_coherency, outfile_transfer;
}; // struct Options
......@@ -204,6 +206,7 @@ int main(int iargc, char* argv[])
CROPOSP_VERSION "\n"
"usage: croposp [-verbose] [-itype f] [-trim] [-datetolerance t]" "\n"
" [-label p] [-overwrite] [-DEBUG]" "\n"
" [-nsegments n] [-divisor n] [-padfactor n] [-overlap f]\n"
" [-psd f] [-npsd f] [-transfer f] [-coherency f]" "\n"
" file [t:sel] [f:format] [n:label] [file [t:s] [f:f] [n:l]] [...]\n"
" or: croposp --help|-h" "\n"
......@@ -227,11 +230,18 @@ int main(int iargc, char* argv[])
" %N: label set for file name\n"
" %F: file name\n"
" %NT: number of trace in file\n"
"-log n map averages to logarithmic scale with \"n\"\n"
" samples pre decade\n"
"-overwrite overwrite existing output files\n"
"\n"
"computation options:\n"
"-log n map averages to logarithmic scale with \"n\"\n"
" samples pre decade\n"
"-nsegments n set number of segments to be used for each input signal\n"
"-divisor n set number of samples to an integer multiple of \"n\"\n"
"-padfactor n pad with zeroes to increase length of series by a factor\n"
" of \"n\"\n"
"-overlap f let segments overlap by a fraction of \"f\"\n"
"\n"
"output options:\n"
"-overwrite overwrite existing output files\n"
"-psd f compute power spectral density and write to file \"f\"\n"
"-npsd f compute power spectral density of incoherent component\n"
" and write to file \"f\"\n"
......@@ -278,6 +288,14 @@ int main(int iargc, char* argv[])
{"log",arg_yes,"1"},
// 12: overwrite existing output files
{"overwrite",arg_no,"-"},
// 13: set number of segments
{"nsegments",arg_yes,"1"},
// 14: set number of divisor for selection of number of samples
{"divisor",arg_yes,"1"},
// 15: set padding factor
{"padfactor",arg_yes,"1"},
// 16: set overlap fraction
{"overlap",arg_yes,"0.5"},
{NULL}
};
......@@ -336,10 +354,22 @@ int main(int iargc, char* argv[])
opt.logscale=cmdline.optset(11);
opt.n_per_decade=cmdline.int_arg(11);
opt.overwrite=cmdline.optset(12);
opt.nsegments=cmdline.int_arg(13);
opt.divisor=cmdline.int_arg(14);
opt.padfactor=cmdline.int_arg(15);
opt.overlap=cmdline.double_arg(16);
TFXX_assert(opt.n_per_decade>0,
"number of samples per decade must be finite and positive");
TFXX_assert(opt.nsegments>0,
"number of segments must be finite and positive");
TFXX_assert(opt.divisor>0,
"divisor must be finite and positive");
TFXX_assert(opt.padfactor>0,
"padding factor must be finite and positive");
TFXX_assert(((opt.overlap > 0.) && (opt.overlap <1.)),
"overlap fraction is out of accepted range");
TFXX_assert(((opt.datetolerance >= 0.) && (opt.datetolerance <=1.)),
"datetolerance is out of accepted range");
......@@ -465,6 +495,11 @@ int main(int iargc, char* argv[])
psd::DPSDComputer psd_computer;
psd_computer.set_debug(opt.debug);
psd_computer.set_verbose(opt.verbose);
psd_computer.set_nsegments(opt.nsegments);
psd_computer.set_divisor(opt.divisor);
psd_computer.set_padfactor(opt.padfactor);
psd_computer.set_overlap(opt.overlap);
TCollection::const_iterator i_series=collection_of_series.begin();
TMetaVector::const_iterator i_meta=vector_of_metadata.begin();
while (i_series != collection_of_series.end() &&
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment