Commit e2b1484c authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

[FIX][FEATURE] (foutra): timeseries file format output

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.

c229866 2014-12-03 12:55:43 +0100 Thomas Forbriger <Thomas.Forbriger@kit.edu>
 [FIX] (foutra, testcase): use ascii input format
 src/ts/wf/testcases/Makefile.foutra | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

e62a76d 2014-12-03 12:51:04 +0100 Thomas Forbriger <Thomas.Forbriger@kit.edu>
 [TASK][DOC] (foutrai, testcase): provide time series plot
 src/ts/wf/testcases/Makefile        |  5 ++++-
 src/ts/wf/testcases/Makefile.foutra | 13 +++++++++----
 2 files changed, 13 insertions(+), 5 deletions(-)

1e48dd3 2014-12-03 12:35:30 +0100 Thomas Forbriger <Thomas.Forbriger@kit.edu>
 [FIX] (foutra): set correct sampling interval
 src/ts/wf/foutra.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

3958246 2014-12-03 12:34:23 +0100 Thomas Forbriger <Thomas.Forbriger@kit.edu>
 [FEATURE] (foutra): provide output format selector
 src/ts/wf/foutra.cc | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 5664
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parents f77251a5 e217fa48
......@@ -48,6 +48,7 @@
* and segment (analysis) series
* - 10/01/2011 V1.8b corrected Fourier transformation formula in
* doxygen documentation
* - 03/12/2014 V1.9 provide output file format selector
*
* \note 08/01/2010:
* Scaling for foutra power spectrum was tested against theory.
......@@ -65,7 +66,7 @@
* ============================================================================
*/
#define FOUTRA_VERSION \
"FOUTRA V1.8 Fourier transforms"
"FOUTRA V1.9 Fourier transforms"
#define FOUTRA_CVSID \
"$Id$"
......@@ -89,8 +90,8 @@
#include <tfxx/xcmdline.h>
#include <tfxx/misc.h>
#include <tfxx/handle.h>
#include <sffostream.h>
#include <datrwxx/readany.h>
#include <datrwxx/writeany.h>
#include <fourier/fftwaff.h>
#include <sstream>
......@@ -100,7 +101,7 @@ using std::endl;
struct Options {
bool verbose, overwrite, debug, asciiout, logascii;
std::string inputformat, asciibase;
std::string inputformat, asciibase, outputformat;
bool amplitudespectrum, powerspectrum, boxcartaper;
bool avgconstbw, avgrelbw, avgasciionly;
bool demean, detrend, scalerbw, adjustdivisor;
......@@ -134,7 +135,7 @@ int main(int iargc, char* argv[])
char usage_text[]=
{
FOUTRA_VERSION "\n"
"usage: foutra [-v] [-o] [-type type] [-D] [-ASCII[=base]]" "\n"
"usage: foutra [-v] [-o] [-type type] [-Type type] [-D] [-ASCII[=base]]\n"
" [-amplitude] [-power] [-logascii[=n]]" "\n"
" [-boxcar] [-avg[=n]] [-rbw[=n]] [-avgascii]" "\n"
" [-demean[=n]] [-dtrend[=n]] [-scalerbw[=n]]" "\n"
......@@ -165,7 +166,7 @@ int main(int iargc, char* argv[])
"-amplitude calculate amplitude spectrum" "\n"
"-power calculate power spectrum" "\n"
"-type type select input file type" "\n"
"-type type select input file type" "\n"
"-Type type select output file type" "\n"
"-avg[=n] smooth power spectrum by averaging over n samples" "\n"
"-rbw[=n] smooth power spectrum by averaging over n decades" "\n"
"-demean[=n] remove average (determined from n samples)" "\n"
......@@ -285,6 +286,8 @@ int main(int iargc, char* argv[])
{"nsegments",arg_yes,"1"},
// 21: extended help
{"xhelp",arg_no,"-"},
// 22: input format
{"Type",arg_yes,"sff"},
{NULL}
};
......@@ -308,7 +311,7 @@ int main(int iargc, char* argv[])
{
cerr << usage_text << endl;
cerr << help_text << endl;
datrw::supported_input_data_types(cerr);
datrw::supported_data_types(cerr);
if (cmdline.optset(21)) { datrw::online_help(cerr); }
exit(0);
}
......@@ -344,6 +347,7 @@ int main(int iargc, char* argv[])
opt.padzeroes=cmdline.optset(19);
opt.padfactor=cmdline.int_arg(19);
opt.nsegments=cmdline.int_arg(20);
opt.outputformat=cmdline.string_arg(22);
TFXX_assert((opt.divisor > 0), "illegal value for argument divisor");
TFXX_assert((opt.nsegments > 0), "illegal value for argument nsegments");
......@@ -520,7 +524,7 @@ int main(int iargc, char* argv[])
TFXX_assert((!file.good()),"ERROR: output file exists!");
}
std::ofstream ofs(outfile.c_str());
sff::SFFostream<Tseries> os(ofs, opt.debug);
datrw::oanystream os(ofs, opt.outputformat);
// prepare file FREE block
sff::FREE filefree;
......@@ -908,10 +912,10 @@ int main(int iargc, char* argv[])
/*----------------------------------------------------------------------*/
// adjust sampling interval to frequency interval
wid2.dt=df;
if (opt.amplitudespectrum || opt.powerspectrum || opt.harmonicsignal)
{ wid2.dt=df; }
wid2.nsamples=series.size();
os << series;
os << wid2;
TFXX_debug(opt.debug, "main", " series and WID are written");
if (is.hasinfo()) { sff::INFO info; is >> info; os << info; }
......@@ -924,6 +928,7 @@ int main(int iargc, char* argv[])
tracefree.append(processfree);
os << tracefree;
}
os << series;
// write ASCII output if requested
if (opt.asciiout)
......
......@@ -44,7 +44,7 @@ edit: flist; vim $<
clean: ;
-find . -name \*.bak | xargs --no-run-if-empty /bin/rm -v
-/bin/rm -vf flist *.xxx *.xxx.* *.sff *.TZ *.TR *.grn *.su
-/bin/rm -vf *.ps *.pdf
-/bin/rm -vf *.ps *.pdf *.asc *.ascii
#----------------------------------------------------------------------
......@@ -65,6 +65,9 @@ soutifutests:
noise.xxx.ps: Makefile.foutra
/bin/rm -fv noise.xxx.*
$(MAKE) -f $< $@
noise.sig.xxx.ps: Makefile.foutra
/bin/rm -fv noise.xxx.*
$(MAKE) -f $< $@
harmspec.xxx.ps: Makefile.foutra
/bin/rm -fv sine?.xxx.sff
$(MAKE) -f $< $@
......
......@@ -42,7 +42,7 @@ NOISERMS=70.
NOISEDT=0.01
NOISET=500.
NOISEOPT=-logascii -avgascii -rbw=0.5
NOISEPROG=siggen
NOISEPROG=siggenx
NOISETYPE=14
NOISEDEBUG=
# NOISEOPT=-pad 5 -nsegments 5
......@@ -56,14 +56,16 @@ noise.xxx.fnycalc:
echo -e "0.5\n$(NOISEDT)\n/\np" > $@
noise.xxx.fny: noise.xxx.fnycalc
dc --file=$< > $@
noise.xxx.sff:
noise.xxx.ascii:
$(NOISEPROG) $(NOISETYPE) $@ $(NOISEDEBUG)\
-v -o -T $(NOISET) -d $(NOISEDT) -a $(NOISERMS)
noise.xxx.001.asc: noise.xxx.sff
-v -o -T $(NOISET) -d $(NOISEDT) -a $(NOISERMS) -ot ascii
noise.xxx.001.asc: noise.xxx.ascii
foutra -v -o -rms -ASCII=$(patsubst %.001.asc,%,$@) $(NOISEOPT) \
-power junk.xxx.sff $< \
-type ascii -power junk.xxx.sff $< \
| tee noise.xxx.log | grep rms-value > noise.xxx.rms
cat noise.xxx.log
noise.tap.xxx.ascii: noise.xxx.ascii
foutra -v -o -type ascii -Type ascii $@ $<
noise.xxx.gpt: noise.xxx.001.asc noise.xxx.fny
echo "set output 'noise.xxx.ps'" > $@
echo "set terminal postscript enhanced" >> $@
......@@ -80,6 +82,9 @@ noise.xxx.gpt: noise.xxx.001.asc noise.xxx.fny
echo "PSD t 'expected PSD'" >> $@
noise.xxx.ps: noise.xxx.gpt
gnuplot $<
noise.sig.xxx.ps: noise.xxx.ascii noise.tap.xxx.ascii
stuplox -d $@/ps -g -l 3,2,1 -h 1.2,1.2,1.5,1.2 -ty ascii \
-u counts -s x -i -Y 0.8 -c fin $^
#----------------------------------------------------------------------
# test foutra scaling for harmonic signals
......
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