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

copde review; extended number of supported samples

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.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 4722
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 6637c6b3
......@@ -36,13 +36,15 @@ c 20/04/2011 V1.8 provide better control for sweep
c 16/02/2012 V1.9 added cosine function (damb)
c 25/05/2012 V2.0 Support different output file type (libfapidxx
c interface in use) (damb)
c 03/06/2012 V2.1 Use new function from libsffu to support
c arbitrary many samples
c
c==============================================================================
c
program siggen
c
character*(*) version
parameter(version='SIGGEN V2.0 SIGnal GENerator')
parameter(version='SIGGEN V2.1 SIGnal GENerator')
character*(*) SIGGEN_CVS_ID
parameter(SIGGEN_CVS_ID=
& '$Id$')
......@@ -64,7 +66,7 @@ c internal parameters
parameter(lu=10)
c data space
integer maxsamples
parameter(maxsamples=100000)
parameter(maxsamples=10000000)
real series(maxsamples)
double precision dseries(maxsamples)
c commandline
......@@ -327,6 +329,7 @@ c
do i=1,nsamples
series(i)=a*sin(2*pi*(i-1)*d*f)
enddo
c------------
elseif (nsig.eq.2) then
if (verbose) then
print *,'Mueller-Bruestle function'
......@@ -352,6 +355,7 @@ c
series(i)=a
endif
enddo
c------------
elseif (nsig.eq.3) then
if (verbose) then
print *,'first order derivative of Mueller-Bruestle function'
......@@ -376,6 +380,7 @@ c
series(i)=0.
endif
enddo
c------------
elseif (nsig.eq.4) then
if (verbose) then
print *,'second order derivative of Mueller-Bruestle function'
......@@ -402,6 +407,7 @@ c
series(i)=0.
endif
enddo
c------------
elseif (nsig.eq.5) then
if (verbose) then
print *,'modulated and damped sine wave'
......@@ -437,6 +443,7 @@ c
series(i)=0.
endif
enddo
c------------
elseif (nsig.eq.6) then
if (verbose) then
print *,'asymmetric sine pulse'
......@@ -471,6 +478,7 @@ c
series(i)=0.
endif
enddo
c------------
elseif (nsig.eq.7) then
if (verbose) then
print *,'asymmetric cosine pulse'
......@@ -501,6 +509,7 @@ c
series(i)=0.
endif
enddo
c------------
elseif (nsig.eq.8) then
if (verbose) then
print *,'boxcar'
......@@ -526,6 +535,7 @@ c
series(i)=0.
endif
enddo
c------------
elseif (nsig.eq.9) then
if (verbose) then
print *,'Gerhards weight drop'
......@@ -553,6 +563,7 @@ c
& exp(-(ti-Tm)/(Te-Tm))
endif
enddo
c------------
elseif (nsig.eq.10) then
if (verbose) then
print *,'Gerhards weight drop (spike version)'
......@@ -581,6 +592,7 @@ c
series(i)=0
endif
enddo
c------------
elseif (nsig.eq.11) then
if (verbose) then
print *,'sine, first half-period'
......@@ -605,6 +617,7 @@ c
series(i)=0.
endif
enddo
c------------
elseif (nsig.eq.12) then
if (verbose) then
print *,'white noise'
......@@ -613,19 +626,22 @@ c
print 50,'sampling interval','d',d,'s'
print 50,'time series lentgh','T',t,'s'
print 51,'random seed','s',s,' '
print 52,'drop','n',ncyc,' '
print 51,'drop','n',ncyc,' '
endif
call tf_srand(s)
do i=1,ncyc
bx=tf_rand()
bx=dble(tf_rand())
if (debug) print *,'DEBUG: tf_rand: ',bx
enddo
if (verbose) then
print *,'derived parameters:'
print 52,'number of samples',nsamples,' '
endif
do i=1,nsamples
series(i)=a*(2.*tf_rand()-1.)
bx=dble(tf_rand())
series(i)=a*(2.*bx-1.)
enddo
c------------
elseif (nsig.eq.13) then
if (verbose) then
print *,'triangle with trend and offset superimposed'
......@@ -657,6 +673,7 @@ c slope
endif
series(i)=dx*(ti-tx)+b+c*ti
enddo
c------------
elseif (nsig.eq.14) then
if (verbose) then
print *,'white gaussian noise noise (GSL generator)'
......@@ -674,6 +691,7 @@ c slope
do i=1,nsamples
series(i)=a*dseries(i)
enddo
c------------
elseif (nsig.eq.15) then
if (verbose) then
print *,'sweep with constant number of cycles per ',
......@@ -694,6 +712,7 @@ c slope
do i=1,nsamples
series(i)=a*sin((g+log10(i*d+h))*2*pi*ncyc)
enddo
c------------
elseif (nsig.eq.16) then
if (verbose) then
print *,'cosine wave'
......@@ -714,6 +733,13 @@ c slope
stop 'ERROR: unknown signal'
endif
if (debug) then
print *,'DEBUG: display samples'
do i=1,nsamples
print *, i, series(i)
enddo
endif
if (overwrite) then
call sff_new(lu,filename,i)
if (i.ne.0) stop 'ERROR: deleting output file'
......@@ -725,7 +751,8 @@ c call sff_wopens(lu,filename,'NSP',)
c call sff_close(lu,i)
c if (i.ne.0) stop 'ERROR: closing output file'
call sffu_simpleopen(lu,filename)
call sffu_simplewrite(lu, .true., series, nsamples, sngl(d), 0.)
call sffu_simplewrite_external_ws(lu, .true., series, nsamples,
& sngl(d), 0., series, maxsamples)
stop
50 format(3x,a30,1x,a3,1x,f10.3,a4)
......
......@@ -8,6 +8,7 @@
#
# REVISIONS and CHANGES
# 24/06/2011 V1.0 Thomas Forbriger
# 03/06/2012 V1.1 extended test case to adjust number of samples
#
# ============================================================================
#
......@@ -24,6 +25,9 @@ NOISERMS=70.
NOISEDT=0.01
NOISET=500.
NOISEOPT=-logascii -avgascii -rbw=0.5
NOISEPROG=siggen
NOISETYPE=14
NOISEDEBUG=
# NOISEOPT=-pad 5 -nsegments 5
#
# NOISERMS: rms value for white noise to be analysed
......@@ -36,7 +40,8 @@ noise.xxx.fnycalc:
noise.xxx.fny: noise.xxx.fnycalc
dc --file=$< > $@
noise.xxx.sff:
siggen 14 $@ -v -o -T $(NOISET) -d $(NOISEDT) -a $(NOISERMS)
$(NOISEPROG) $(NOISETYPE) $@ $(NOISEDEBUG)\
-v -o -T $(NOISET) -d $(NOISEDT) -a $(NOISERMS)
noise.xxx.001.asc: noise.xxx.sff
foutra -v -o -rms -ASCII=$(patsubst %.001.asc,%,$@) $(NOISEOPT) \
-power junk.xxx.sff $< \
......
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