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

Merge branch 'master' of ssh://gitserver/home/tforb/NFSspace/distrib/TFSoftware

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.
parents d3daab93 7b1c348f
......@@ -35,6 +35,7 @@ c
c REVISIONS and CHANGES
c 06/06/2005 V1.0 Thomas Forbriger
c 26/06/2013 V1.1 check definition of PSD values
c 04/12/2014 V1.2 fix: declare return type of function fnlnm
c
c ============================================================================
c
......@@ -42,14 +43,14 @@ c
c
character*(*) version
parameter(version=
& 'NLNMTAB V1.1 write table of NLNM values')
& 'NLNMTAB V1.2 write table of NLNM values')
character*(*) NLNMTAB_CVS_ID
parameter(NLNMTAB_CVS_ID=
& '$Id$')
c
c
logical useperiod, uselog
double precision f,p,f1,f2,df
double precision f,p,f1,f2,df,fnlnm
integer k,n
character*80 outstring
c commandline
......
......@@ -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
......
Supports Markdown
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