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

croposp [WP]: place test cases in subdirectory

parent 9a9e5b85
......@@ -84,17 +84,21 @@ DOXYTXT=$(wildcard doxygen*.txt */doxygen*txt)
EDITFILES=Makefile README $(wildcard *.cfg) COPYING $(DOXYTXT) \
$(filter-out %.bak,$(wildcard README* Makefile*))
EDITSRC=$(wildcard *.cc *.h *.py)
EDITTESTS=$(filter-out %.bak,$(wildcard tests/Makefile*))
flist: $(EDITFILES) $(TF_EDIT) $(EDITSRC)
flist: $(EDITFILES) $(TF_EDIT) $(EDITSRC) $(EDITTESTS)
echo $(filter $(EDITFILES),$^) | tr ' ' '\n' | sort > $@
echo "---- source code ----" >> $@
echo $(filter $(EDITSRC),$^) | tr ' ' '\n' | sort >> $@
echo "---- tests ----" >> $@
echo $(filter $(EDITTESTS),$^) | tr ' ' '\n' | sort >> $@
echo "----" >> $@
echo $(filter-out $(EDITFILES) $(EDITSRC),$^) \
echo $(filter-out $(EDITFILES) $(EDITSRC) $(EDITTESTS),$^) \
| tr ' ' '\n' | sort >> $@
.PHONY: edit
edit: flist; vim $<
#----------------------------------------------------------------------
# pattern rules
......@@ -146,177 +150,7 @@ croposptest croposp: \
%: %.o $(OBJFILES)
$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@ \
-lpsdxx -lfourierxx $(LIBTSIOXX) -lfftw3
#======================================================================
# test case
# ---------
alldata: cpsd1.bin cpsd2.bin cpsd3.bin cpsd4.bin
CPSD_NSAMPLESRAW=100000
#CPSD_NSAMPLESRAW=1000
CPSD_DT=0.1
CPSD_DUR=8640.
#CPSD_DUR=864.
# create raw time series
CPSD_SIGGENOPT=-v -o -n $(CPSD_NSAMPLESRAW) -d $(CPSD_DT) -T $(CPSD_DUR) -ot bin
CPSD_AMP1=1.e-3
CPSD_AMP2=1.e-4
CPSD_AMP3=3.e-3
CPSD_AMP4=5.e-5
CPSD_AMPBG=2.
# location of plot tool
CROPOSPLOT=./croposplot.py
cpsd1raw.bin:
/bin/bash -c 'export GSL_RNG_SEED=$$(date +"%N"); \
siggenx 14 $@ $(CPSD_SIGGENOPT); \
echo seed: $$GSL_RNG_SEED'
cpsd2raw.bin:
/bin/bash -c 'export GSL_RNG_SEED=$$(date +"%N"); \
siggenx 14 $@ $(CPSD_SIGGENOPT); \
echo seed: $$GSL_RNG_SEED'
cpsd3raw.bin:
/bin/bash -c 'export GSL_RNG_SEED=$$(date +"%N"); \
siggenx 14 $@ $(CPSD_SIGGENOPT); \
echo seed: $$GSL_RNG_SEED'
cpsd4raw.bin:
/bin/bash -c 'export GSL_RNG_SEED=$$(date +"%N"); \
siggenx 14 $@ $(CPSD_SIGGENOPT); \
echo seed: $$GSL_RNG_SEED'
# create time series for common noise signal
cpsdbgraw.bin:
/bin/bash -c 'export GSL_RNG_SEED=$$(date +"%N"); \
siggenx 14 $@ $(CPSD_SIGGENOPT); \
echo seed: $$GSL_RNG_SEED'
rawsig.ps: cpsd1raw.bin cpsd2raw.bin cpsd3raw.bin cpsd4raw.bin cpsdbgraw.bin
stuplox -d $@/cps -s x -i -ty bin $^
# modify white noise to channel specific frequency characteristic
cpsd1mod.bin: cpsd1raw.bin
printf "fac $(CPSD_AMP1)\nlpb 1.,2.\ndif 0\nend\n" \
| tidofi -type bin -Type bin -v -o -cs $@ $<
cpsd2mod.bin: cpsd2raw.bin
printf "fac $(CPSD_AMP2)\nint 0\navg 0end\n" \
| tidofi -type bin -Type bin -v -o -cs $@ $<
cpsd3mod.bin: cpsd3raw.bin
printf "fac $(CPSD_AMP3)\nlpb 10.,2\nend\n" \
| tidofi -type bin -Type bin -v -o -cs $@ $<
cpsd4mod.bin: cpsd4raw.bin
printf "fac $(CPSD_AMP4)\nhpb 100.0,2\nend\n" \
| tidofi -type bin -Type bin -v -o -cs $@ $<
cpsdbgmod.bin: cpsdbgraw.bin
printf "fac $(CPSD_AMPBG)\nlpb 2.,4\navg 0\nhpb 200.,2\nend\n" \
| tidofi -type bin -Type bin -v -o -cs $@ $<
# add common noise signal to channel specific noise floor
cpsd%addraw.bin: cpsd%mod.bin cpsdbgmod.bin
teseco -v -o -a -type bin -Type bin $@ $^
# modify sensor response
cpsd1add.bin: cpsd1addraw.bin
printf "fac 1.\nend\n" \
| tidofi -type bin -Type bin -v -o -cs $@ $<
cpsd2add.bin: cpsd2addraw.bin
printf "fac 1.\nend\n" \
| tidofi -type bin -Type bin -v -o -cs $@ $<
cpsd3add.bin: cpsd3addraw.bin
printf "fac 1.\nend\n" \
| tidofi -type bin -Type bin -v -o -cs $@ $<
cpsd4add.bin: cpsd4addraw.bin
printf "lpb 10.,2\nend\n" \
| tidofi -type bin -Type bin -v -o -cs $@ $<
# set header fields to reasonable time an channel identifiers
CPSD_DATE=2018/12/16_14:24:16
CPSD_DATE1=$(CPSD_DATE).010980
CPSD_DATE2=$(CPSD_DATE).011050
CPSD_DATE3=$(CPSD_DATE).010760
CPSD_DATE4=$(CPSD_DATE).010760
CPSD_HDOPTS=-verbose -overwrite -itype bin -otype bin -ss TST -sa XX -sc BHZ
cpsd1hd.bin: cpsd1add.bin
sehefixx $< $@ $(CPSD_HDOPTS) -st $(CPSD_DATE1) -si SYN1
cpsd2hd.bin: cpsd2add.bin
sehefixx $< $@ $(CPSD_HDOPTS) -st $(CPSD_DATE2) -si SYN2
cpsd3hd.bin: cpsd3add.bin
sehefixx $< $@ $(CPSD_HDOPTS) -st $(CPSD_DATE3) -si SYN3
cpsd4hd.bin: cpsd4add.bin
sehefixx $< $@ $(CPSD_HDOPTS) -st $(CPSD_DATE4) -si SYN4
# extract inconsistent time windows
CPSD_TOPT1=-samplesf 3 -samplesl 7
CPSD_TOPT2=-samplesf 25
CPSD_TOPT3=-samplesl 81
CPSD_TOPT4=-samplesl 1
cpsd1.bin: cpsd1hd.bin
tijerasxx -verbose -overwrite -iformat bin -oformat bin \
$(CPSD_TOPT1) $@ $<
cpsd2.bin: cpsd2hd.bin
tijerasxx -verbose -overwrite -iformat bin -oformat bin \
$(CPSD_TOPT2) $@ $<
cpsd3.bin: cpsd3hd.bin
tijerasxx -verbose -overwrite -iformat bin -oformat bin \
$(CPSD_TOPT3) $@ $<
cpsd4.bin: cpsd4hd.bin
tijerasxx -verbose -overwrite -iformat bin -oformat bin \
$(CPSD_TOPT4) $@ $<
CPSD_NSEGMENTS=1
CPSD_OVERLAP=0.5
CPSD_DIVISOR=100
CPSD_PADFACTOR=1
CPSD_NLOG=20
CPSD_LOG=--log $(CPSD_NLOG)
CPSD_OPT=--DEBUG
CPSD_OPT=
OUTPUTS=psd npsd coherency transfer phase
CPSD_SET=1 2 3 4
CPSD_SET=1 2 3
CPSD_BINFILES=$(addprefix cpsd,$(addsuffix .bin,$(CPSD_SET)))
CPSD_CROPOSP_OPT=--nsegments=$(CPSD_NSEGMENTS) \
--divisor=$(CPSD_DIVISOR) \
--padfactor=$(CPSD_PADFACTOR) \
--overlap=$(CPSD_OVERLAP) $(CPSD_LOG)
$(addsuffix _out.xxx,$(OUTPUTS)): $(CPSD_BINFILES)
croposp $(CPSD_OPT) --verbose --overwrite --itype bin --trim \
--pattern="%I" \
$(CPSD_CROPOSP_OPT) \
--datetolerance 0.1 \
--psd psd_out.xxx \
--npsd npsd_out.xxx \
--coherency coherency_out.xxx \
--transfer transfer_out.xxx \
--phase phase_out.xxx \
$^
psd%.001.asc: cpsd%.bin
foutra -v -o -type bin -ASCII=$(patsubst cpsd%.bin,psd%,$<) \
-power -rbw=0.1 -demean -detrend -logascii=0.1 -avgascii \
-nsegments=20 junk.xxx $^
psd%foutra.xxx: psd%.001.asc
printf "# #1: foutra (reference): %s\n" $< > $@
cat $< >> $@
CPSD_REFFILES=$(addprefix psd,$(addsuffix foutra.xxx,$(CPSD_SET)))
PSD.pdf: psd_out.xxx $(CPSD_REFFILES)
$(CROPOSPLOT) --title="$@ $(CPSD_CROPOSP_OPT)" -v --grid -o $@ $^
%.pdf: %_out.xxx
$(CROPOSPLOT) --title="$@ $(CPSD_CROPOSP_OPT)" -v --grid -o $@ $<
%_lin.pdf: %_out.xxx
$(CROPOSPLOT) --title="$@ $(CPSD_CROPOSP_OPT)" -v --grid --nology -o \
$@ $<
%.pdp: %.pdf; evince $<; /bin/rm -fv $<
%.psp: %.ps; gv $<; /bin/rm -fv $<
#
#======================================================================
# documentation part
......
# this is <Makefile>
# ----------------------------------------------------------------------------
#
# Copyright (c) 2019 by Thomas Forbriger (BFO Schiltach)
#
# compile croposp
#
# ----
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ----
#
# REVISIONS and CHANGES
# 06/02/2019 V1.0 Thomas Forbriger
#
# ============================================================================
#
alldata: cpsd1.bin cpsd2.bin cpsd3.bin cpsd4.bin
CPSD_NSAMPLESRAW=100000
#CPSD_NSAMPLESRAW=1000
CPSD_DT=0.1
CPSD_DUR=8640.
#CPSD_DUR=864.
# create raw time series
CPSD_SIGGENOPT=-v -o -n $(CPSD_NSAMPLESRAW) -d $(CPSD_DT) -T $(CPSD_DUR) -ot bin
CPSD_AMP1=1.e-3
CPSD_AMP2=1.e-4
CPSD_AMP3=3.e-3
CPSD_AMP4=5.e-5
CPSD_AMPBG=2.
# location of plot tool
CROPOSPLOT=./croposplot.py
cpsd1raw.bin:
/bin/bash -c 'export GSL_RNG_SEED=$$(date +"%N"); \
siggenx 14 $@ $(CPSD_SIGGENOPT); \
echo seed: $$GSL_RNG_SEED'
cpsd2raw.bin:
/bin/bash -c 'export GSL_RNG_SEED=$$(date +"%N"); \
siggenx 14 $@ $(CPSD_SIGGENOPT); \
echo seed: $$GSL_RNG_SEED'
cpsd3raw.bin:
/bin/bash -c 'export GSL_RNG_SEED=$$(date +"%N"); \
siggenx 14 $@ $(CPSD_SIGGENOPT); \
echo seed: $$GSL_RNG_SEED'
cpsd4raw.bin:
/bin/bash -c 'export GSL_RNG_SEED=$$(date +"%N"); \
siggenx 14 $@ $(CPSD_SIGGENOPT); \
echo seed: $$GSL_RNG_SEED'
# create time series for common noise signal
cpsdbgraw.bin:
/bin/bash -c 'export GSL_RNG_SEED=$$(date +"%N"); \
siggenx 14 $@ $(CPSD_SIGGENOPT); \
echo seed: $$GSL_RNG_SEED'
rawsig.ps: cpsd1raw.bin cpsd2raw.bin cpsd3raw.bin cpsd4raw.bin cpsdbgraw.bin
stuplox -d $@/cps -s x -i -ty bin $^
# modify white noise to channel specific frequency characteristic
cpsd1mod.bin: cpsd1raw.bin
printf "fac $(CPSD_AMP1)\nlpb 1.,2.\ndif 0\nend\n" \
| tidofi -type bin -Type bin -v -o -cs $@ $<
cpsd2mod.bin: cpsd2raw.bin
printf "fac $(CPSD_AMP2)\nint 0\navg 0end\n" \
| tidofi -type bin -Type bin -v -o -cs $@ $<
cpsd3mod.bin: cpsd3raw.bin
printf "fac $(CPSD_AMP3)\nlpb 10.,2\nend\n" \
| tidofi -type bin -Type bin -v -o -cs $@ $<
cpsd4mod.bin: cpsd4raw.bin
printf "fac $(CPSD_AMP4)\nhpb 100.0,2\nend\n" \
| tidofi -type bin -Type bin -v -o -cs $@ $<
cpsdbgmod.bin: cpsdbgraw.bin
printf "fac $(CPSD_AMPBG)\nlpb 2.,4\navg 0\nhpb 200.,2\nend\n" \
| tidofi -type bin -Type bin -v -o -cs $@ $<
# add common noise signal to channel specific noise floor
cpsd%addraw.bin: cpsd%mod.bin cpsdbgmod.bin
teseco -v -o -a -type bin -Type bin $@ $^
# modify sensor response
cpsd1add.bin: cpsd1addraw.bin
printf "fac 1.\nend\n" \
| tidofi -type bin -Type bin -v -o -cs $@ $<
cpsd2add.bin: cpsd2addraw.bin
printf "fac 1.\nend\n" \
| tidofi -type bin -Type bin -v -o -cs $@ $<
cpsd3add.bin: cpsd3addraw.bin
printf "fac 1.\nend\n" \
| tidofi -type bin -Type bin -v -o -cs $@ $<
cpsd4add.bin: cpsd4addraw.bin
printf "lpb 10.,2\nend\n" \
| tidofi -type bin -Type bin -v -o -cs $@ $<
# set header fields to reasonable time an channel identifiers
CPSD_DATE=2018/12/16_14:24:16
CPSD_DATE1=$(CPSD_DATE).010980
CPSD_DATE2=$(CPSD_DATE).011050
CPSD_DATE3=$(CPSD_DATE).010760
CPSD_DATE4=$(CPSD_DATE).010760
CPSD_HDOPTS=-verbose -overwrite -itype bin -otype bin -ss TST -sa XX -sc BHZ
cpsd1hd.bin: cpsd1add.bin
sehefixx $< $@ $(CPSD_HDOPTS) -st $(CPSD_DATE1) -si SYN1
cpsd2hd.bin: cpsd2add.bin
sehefixx $< $@ $(CPSD_HDOPTS) -st $(CPSD_DATE2) -si SYN2
cpsd3hd.bin: cpsd3add.bin
sehefixx $< $@ $(CPSD_HDOPTS) -st $(CPSD_DATE3) -si SYN3
cpsd4hd.bin: cpsd4add.bin
sehefixx $< $@ $(CPSD_HDOPTS) -st $(CPSD_DATE4) -si SYN4
# extract inconsistent time windows
CPSD_TOPT1=-samplesf 3 -samplesl 7
CPSD_TOPT2=-samplesf 25
CPSD_TOPT3=-samplesl 81
CPSD_TOPT4=-samplesl 1
cpsd1.bin: cpsd1hd.bin
tijerasxx -verbose -overwrite -iformat bin -oformat bin \
$(CPSD_TOPT1) $@ $<
cpsd2.bin: cpsd2hd.bin
tijerasxx -verbose -overwrite -iformat bin -oformat bin \
$(CPSD_TOPT2) $@ $<
cpsd3.bin: cpsd3hd.bin
tijerasxx -verbose -overwrite -iformat bin -oformat bin \
$(CPSD_TOPT3) $@ $<
cpsd4.bin: cpsd4hd.bin
tijerasxx -verbose -overwrite -iformat bin -oformat bin \
$(CPSD_TOPT4) $@ $<
CPSD_NSEGMENTS=1
CPSD_OVERLAP=0.5
CPSD_DIVISOR=100
CPSD_PADFACTOR=1
CPSD_NLOG=20
CPSD_LOG=--log $(CPSD_NLOG)
CPSD_OPT=--DEBUG
CPSD_OPT=
OUTPUTS=psd npsd coherency transfer phase
CPSD_SET=1 2 3 4
CPSD_SET=1 2 3
CPSD_BINFILES=$(addprefix cpsd,$(addsuffix .bin,$(CPSD_SET)))
CPSD_CROPOSP_OPT=--nsegments=$(CPSD_NSEGMENTS) \
--divisor=$(CPSD_DIVISOR) \
--padfactor=$(CPSD_PADFACTOR) \
--overlap=$(CPSD_OVERLAP) $(CPSD_LOG)
$(addsuffix _out.xxx,$(OUTPUTS)): $(CPSD_BINFILES)
croposp $(CPSD_OPT) --verbose --overwrite --itype bin --trim \
--pattern="%I" \
$(CPSD_CROPOSP_OPT) \
--datetolerance 0.1 \
--psd psd_out.xxx \
--npsd npsd_out.xxx \
--coherency coherency_out.xxx \
--transfer transfer_out.xxx \
--phase phase_out.xxx \
$^
psd%.001.asc: cpsd%.bin
foutra -v -o -type bin -ASCII=$(patsubst cpsd%.bin,psd%,$<) \
-power -rbw=0.1 -demean -detrend -logascii=0.1 -avgascii \
-nsegments=20 junk.xxx $^
psd%foutra.xxx: psd%.001.asc
printf "# #1: foutra (reference): %s\n" $< > $@
cat $< >> $@
CPSD_REFFILES=$(addprefix psd,$(addsuffix foutra.xxx,$(CPSD_SET)))
PSD.pdf: psd_out.xxx $(CPSD_REFFILES)
$(CROPOSPLOT) --title="$@ $(CPSD_CROPOSP_OPT)" -v --grid -o $@ $^
%.pdf: %_out.xxx
$(CROPOSPLOT) --title="$@ $(CPSD_CROPOSP_OPT)" -v --grid -o $@ $<
%_lin.pdf: %_out.xxx
$(CROPOSPLOT) --title="$@ $(CPSD_CROPOSP_OPT)" -v --grid --nology -o \
$@ $<
%.pdp: %.pdf; evince $<; /bin/rm -fv $<
%.psp: %.ps; gv $<; /bin/rm -fv $<
# ----- END OF Makefile -----
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