Commit 192c8d8b authored by thomas.forbriger's avatar thomas.forbriger
Browse files

croposp [WP][FEATURE]: support setting of label prefix

parent c8d33fc9
......@@ -59,7 +59,11 @@ struct Options {
unsigned int nsegments, divisor, padfactor;
double overlap;
bool compute_psd, compute_npsd, compute_coherency, compute_transfer;
bool compute_phase;
std::string outfile_psd, outfile_npsd, outfile_coherency, outfile_transfer;
std::string outfile_phase;
std::string prefix_psd, prefix_npsd, prefix_transfer;
std::string prefix_phase, prefix_coherency;
}; // struct Options
// a struct to hold meta data
......@@ -207,7 +211,9 @@ int main(int iargc, char* argv[])
"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"
" [-psd f] [-npsd f] [-transfer f] [-phase f] [-coherency f]" "\n"
" [-prefixpsd s] [-prefixnpsd s] [-prefixtransfer s]\n"
" [-prefixphase s] [-prefixcoherency s]" "\n"
" file [t:sel] [f:format] [n:label] [file [t:s] [f:f] [n:l]] [...]\n"
" or: croposp --help|-h" "\n"
};
......@@ -230,6 +236,11 @@ int main(int iargc, char* argv[])
" %N: label set for file name\n"
" %F: file name\n"
" %NT: number of trace in file\n"
"-prefixpsd s set label prefix for psd output to \"s\"\n"
"-prefixnpsd s set label prefix for incoherent psd output to \"s\"\n"
"-prefixtransfer s set label prefix for amplitude ratio output to \"s\"\n"
"-prefixphase s set label prefix for phase delay output to \"s\"\n"
"-prefixcoherency s set label prefix for coherency output to \"s\"\n"
"\n"
"computation options:\n"
"-log n map averages to logarithmic scale with \"n\"\n"
......@@ -249,6 +260,9 @@ int main(int iargc, char* argv[])
"-transfer f compute amplitude transfer function for pairs of\n"
" signals and write to file \"f\"\n"
" Sleeman et al (2006, eq. 13)\n"
"-phase f compute phase transfer function for pairs of\n"
" signals and write to file \"f\"\n"
" Sleeman et al (2006, eq. 13)\n"
"-coherency f compute coherecy for pairs of signals\n"
" and write to file \"f\"\n"
"\n"
......@@ -296,6 +310,18 @@ int main(int iargc, char* argv[])
{"padfactor",arg_yes,"1"},
// 16: set overlap fraction
{"overlap",arg_yes,"0.5"},
// 17: compute phase delay
{"phase",arg_yes,"-"},
// 18: set psd prefix
{"prefixpsd",arg_yes,"PSD"},
// 19: set npsd prefix
{"prefixnpsd",arg_yes,"NPSD"},
// 20: set transfer prefix
{"prefixtransfer",arg_yes,"AMP"},
// 21: set phase prefix
{"prefixphase",arg_yes,"PHA"},
// 22: set coherency prefix
{"prefixcoherency",arg_yes,"COH"},
{NULL}
};
......@@ -359,6 +385,15 @@ int main(int iargc, char* argv[])
opt.padfactor=cmdline.int_arg(15);
opt.overlap=cmdline.double_arg(16);
opt.compute_phase=cmdline.optset(17);
opt.outfile_phase=cmdline.string_arg(17);
opt.prefix_psd=cmdline.string_arg(18);
opt.prefix_npsd=cmdline.string_arg(19);
opt.prefix_transfer=cmdline.string_arg(20);
opt.prefix_phase=cmdline.string_arg(21);
opt.prefix_coherency=cmdline.string_arg(22);
TFXX_assert(opt.n_per_decade>0,
"number of samples per decade must be finite and positive");
TFXX_assert(opt.nsegments>0,
......@@ -475,6 +510,7 @@ int main(int iargc, char* argv[])
TFXX_assert(!opt.compute_npsd, "-npsd is not yet implemented");
TFXX_assert(!opt.compute_transfer, "-transfer is not yet implemented");
TFXX_assert(!opt.compute_phase, "-phase is not yet implemented");
TFXX_assert(!opt.compute_coherency, "-coherency is not yet implemented");
// provide container for frequency values (will be filled upon computation
......@@ -489,7 +525,7 @@ int main(int iargc, char* argv[])
// provide container for PSD values
TNamedSeriesVector PSD_vector;
if (opt.compute_psd || opt.compute_npsd || opt.compute_transfer ||
if (opt.compute_psd || opt.compute_npsd ||
opt.compute_coherency)
{
psd::DPSDComputer psd_computer;
......@@ -537,7 +573,7 @@ int main(int iargc, char* argv[])
named_psd.series=psd.data;
} // if (opt.logscale) ... else
named_psd.label=i_meta->label;
named_psd.label=opt.prefix_psd+" "+i_meta->label;
PSD_vector.push_back(named_psd);
++i_series;
......
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