Commit 49c7745e authored by thomas.forbriger's avatar thomas.forbriger
Browse files

croposp/libpsdxx [MERGE]: provide libpsdxx and croposp on master

This provides the program to compute power spectral density and evaluate
coherency properties of pairs and triples of input channels
parents 5848b8bb 313f6c2d
...@@ -3,6 +3,10 @@ this is <CHANGELOG> ...@@ -3,6 +3,10 @@ this is <CHANGELOG>
Recent development in Seitosh (bug fixes, new features, etc) Recent development in Seitosh (bug fixes, new features, etc)
------------------------------------------------------------ ------------------------------------------------------------
06.01.2019: libpsdxx
- a new library for the computation of (cross) power spectral density
is in preparation
01.01.2019: libtsxx 01.01.2019: libtsxx
- commit 47a357e: new feature: provide container TimeSeriesCollection - commit 47a357e: new feature: provide container TimeSeriesCollection
......
...@@ -23,6 +23,7 @@ ts/wf ...@@ -23,6 +23,7 @@ ts/wf
ts/hd ts/hd
ts/refract ts/refract
ts/cal ts/cal
ts/croposp
ts/noise ts/noise
ts/fidase ts/fidase
ts/lisousi ts/lisousi
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
# 31/01/2014 added libtsioxx, re-ordered flist entries # 31/01/2014 added libtsioxx, re-ordered flist entries
# 10/02/2014 thof: use new package installation scheme with install.sh # 10/02/2014 thof: use new package installation scheme with install.sh
# 24/09/2014 thof: add librefpar # 24/09/2014 thof: add librefpar
# 06/01/2019 thof: add libpsdxx
# #
# ============================================================================ # ============================================================================
# #
...@@ -84,7 +85,8 @@ LIBDIRS= \ ...@@ -84,7 +85,8 @@ LIBDIRS= \
libstfinv \ libstfinv \
libttsynt \ libttsynt \
libserialxx \ libserialxx \
libtsioxx libtsioxx \
libpsdxx
# libraries with snapshot package make rules # libraries with snapshot package make rules
PACKAGEDIRS=libaff \ PACKAGEDIRS=libaff \
......
...@@ -28,6 +28,8 @@ Actively maintained libraries ...@@ -28,6 +28,8 @@ Actively maintained libraries
C++ interface to use LAPACK with libaff arrays. C++ interface to use LAPACK with libaff arrays.
libpgplot++: libpgplot++:
C++ interface to PGPLOT. C++ interface to PGPLOT.
libpsdxx:
compute (cross) power spectral density.
librheology: librheology:
Rheology library. Rheology library.
libseife: libseife:
......
...@@ -94,6 +94,13 @@ C++ libraries ...@@ -94,6 +94,13 @@ C++ libraries
libraries: libfapidxx.a, libfapidxx.so libraries: libfapidxx.a, libfapidxx.so
external dependencies: - external dependencies: -
internal dependencies: libdatrwxx libaff libgsexx libtime++ libsffxx internal dependencies: libdatrwxx libaff libgsexx libtime++ libsffxx
libpsdxx
language: C++
libraries: libpsdxx.a
external dependencies: fftw3
internal dependencies: libaff libfourierxx libtsxx
test program dependency: libtfxx
checked: 06.01.2019 (tforb)
libtsxx libtsxx
language: C++ language: C++
libraries: libtsxx.a libraries: libtsxx.a
...@@ -273,8 +280,8 @@ must be rightmost. ...@@ -273,8 +280,8 @@ must be rightmost.
C++ C++
--- ---
libfapidxx liblinearxx libpgplotxx libtsioxx libtsxx libdatrwxx libsffxx libfapidxx liblinearxx libpgplotxx libtsioxx libpsdxx libtsxx libdatrwxx
libstfinv libfourierxx libsffxx libstfinv libfourierxx
C and Fortran C and Fortran
------------- -------------
......
this is <COPYING>
============================================================================
LIBPSDXX - compute (cross) power spectral density
-------------------------------------------------
Copyright (c) 2019 by Thomas Forbriger
The source code in this directory is part of libpsdxx which compiles to
libpsdxx.a
----
libpsdxx 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.
libpsdxx 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, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
----
----- END OF COPYING -----
# this is <Makefile>
# ----------------------------------------------------------------------------
#
# Copyright (c) 2019 by Thomas Forbriger (BFO Schiltach)
#
# create library for power spectral density analysis (libpsdxx)
#
# ----
# 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
# 01/01/2019 V1.0 Thomas Forbriger
#
# ============================================================================
#
.PHONY: all
all: install doxydoc
.PHONY: doc
doc: doxydoc
LIBRARIES=libpsdxx.a
.PHONY: install
install: $(addprefix $(LOCLIBDIR)/,$(LIBRARIES))
$(LOCLIBDIR)/%: install-include %
mkdir -pv $(LOCLIBDIR)
/bin/mv -fv $(word 2,$^) $(LOCLIBDIR)
# ============================================================================
# select groups of files
# they are used for editing and to create object file lists and dependencies
# whereever we find a README, we will use it
README=$(filter-out %.bak,$(shell find . -name README\*))
# the frame of doxygen documentation is palced in text files
DOXYTXT=$(shell find . -name doxygen\*.txt)
# C++ and C source code
SOURCEFILES=$(filter-out %usage.h, $(filter-out %usage.cc, \
$(wildcard *.h *.cc *.c)))
# editional files to be edited
EDITFILES=Makefile $(README) \
$(DOXYTXT) \
$(SOURCEFILES) \
$(wildcard *.cfg *.gpt) \
COPYING
# ============================================================================
# check for settings expected in the environment
# ----------------------------------------------
#
CHECKVAR=$(if $($(1)),,$(error ERROR: missing variable $(1)))
CHECKVARS=$(foreach var,$(1),$(call CHECKVAR,$(var)))
#
$(call CHECKVARS,LOCINCLUDEDIR LOCLIBDIR LOCBINDIR)
$(call CHECKVARS,TF_BROWSER TF_WWWBASEDIR)
# ======================================================================
#
LIBHEADERS=debug.h error.h function_template_log_sampling.h psd.h helper.h
LIBCCSRC= \
dpsdcomputer_coherency.cc \
dpsdcomputer_cross_psd.cc \
dpsdcomputer_parameters.cc \
dpsdcomputer_processor.cc \
dpsdcomputer_psd.cc \
error.cc \
function_abs.cc \
function_arg.cc \
function_conj.cc \
function_lin_frequency.cc \
function_log_frequency.cc \
function_log_sampling_c.cc \
function_log_sampling_r.cc \
function_lin_log_sampling.cc \
function_sqrt.cc \
log_index.cc \
log_taper.cc \
testpsdxx.cc
INCINSTALLPATH=$(LOCINCLUDEDIR)/psdxx
LIBINSTALLPATH=$(LOCLIBDIR)
# name of installed (exported) header files
INSTHEADER=$(addprefix $(INCINSTALLPATH)/,$(notdir $(LIBHEADERS)))
#
# compiler flags
# --------------
FLAGS=
FLAGS+=-fPIC $(MYFLAGS)
CXXFLAGS+=-Wall $(FLAGS)
LDFLAGS+=-L$(LOCLIBDIR)
CPPFLAGS+=-I$(LOCINCLUDEDIR) $(FLAGS)
#
# source code editing and directory clean-up
# ------------------------------------------
flist: $(EDITFILES) $(TF_EDIT)
echo $(filter-out $(SOURCEFILES),$(EDITFILES)) \
| tr ' ' '\n' | sort > $@
echo '----' >> $@
echo $(SOURCEFILES) | tr ' ' '\n' | sort >> $@
echo '----' >> $@
echo $(TF_EDIT) | tr ' ' '\n' | sort >> $@
.PHONY: edit
edit: flist; vim $<
.PHONY: clean
clean: ;
-find . -name \*.bak | xargs --no-run-if-empty /bin/rm -v
-find . -name \*.o | xargs --no-run-if-empty /bin/rm -v
-find . -name \*.d | xargs --no-run-if-empty /bin/rm -v
-find . -name \*.hd | xargs --no-run-if-empty /bin/rm -v
-/bin/rm -vf flist *.a *.so *.xxx
-/bin/rm -vf testpsdxx *.ps
#======================================================================
# pattern rules
# -------------
%.d: %.cc
$(SHELL) -ec '$(CXX) -M $(CPPFLAGS) $< \
| sed '\''s,\($(notdir $*)\)\.o[ :]*,$(dir $@)\1.o $@ : ,g'\'' \
> $@; \
[ -s $@ ] || rm -f $@'
%.d: %.c
$(SHELL) -ec '$(CC) -M $(CPPFLAGS) $< \
| sed '\''s,\($(notdir $*)\)\.o[ :]*,$(dir $@)\1.o $@ : ,g'\'' \
> $@; \
[ -s $@ ] || rm -f $@'
#======================================================================
# library part
# ------------
include $(patsubst %.cc,%.d,$(LIBCCSRC))
libpsdxx.a: $(patsubst %.cc,%.o,$(LIBCCSRC))
ar rcv $@ $^
ranlib $@
#----------------------------------------------------------------------
$(INCINSTALLPATH)/%.h: %.h
mkdir -p $(INCINSTALLPATH)
-rm -fv $@
/bin/cp -vpd $< $@
.PHONY: install-include
install-include: $(INSTHEADER)
#======================================================================
# reinstall target
# is necessary in case of header file problems (e.g. remcmmnt not installed)
.PHONY: clean-include
clean-include:
/bin/rm -fv $(INSTHEADER)
.PHONY: reinstall
reinstall:
$(MAKE) clean
$(MAKE) clean-include
$(MAKE) install
# ======================================================================
# source code generators
# ======================
#
# description and online texts
# ----------------------------
# The following rules convert ordinary ASCII text files into C++ source code,
# providing functions to output usage information (online help)
#
# Such text files use names with the pattern *usage.txt
# Automatically generated source code is excluded from editing and versioning
#
%usage.cc %usage.h: usage/%usage.txt
echo "// DO NOT EDIT: this file is automatically derived from $<" \
> $(patsubst usage/%.txt,%.h,$<)
echo "extern char $(patsubst usage/%.txt,%,$<)[];" \
>> $(patsubst usage/%.txt,%.h,$<)
echo "// DO NOT EDIT: this file is automatically derived from $<" \
> $(patsubst usage/%.txt,%.cc,$<)
echo "#include \"$(patsubst usage/%.txt,%.h,$<)\"" \
>> $(patsubst usage/%.txt,%.cc,$<)
echo "char $(patsubst usage/%.txt,%,$<)[]=" \
>> $(patsubst usage/%.txt,%.cc,$<)
echo "{" >> $(patsubst usage/%.txt,%.cc,$<)
cat $< | egrep -v '^#' | sed -e 's/\\/\\\\/g' | sed -e 's/"/\\"/g' \
| sed -e 's/$$/\\n"/' | sed -e 's/^/ "/'\
>> $(patsubst usage/%.txt,%.cc,$<)
echo "};" >> $(patsubst usage/%.txt,%.cc,$<)
#======================================================================
# documentation part
# ------------------
#
# targets commonly used:
# ----------------------
#
# make doxyclean removes all documentation
# make doxydoc creates doxygen documentation in the DOXYWWWPATH
# make doxyview creates doxygen documentation and launches netscape to
# browse in the documentation
# make doxyconf edit the doxygen configuration file
#
# If you launch "make doxydoc" the documentation will be written to
# DOXYWWWPATH (see below). This is meant to export the documentation through
# your homepage. The doxyfull directory is just a symbolic link to this
# directory.
#
$(call CHECKVARS,TF_WWWBASEDIR TF_BROWSER)
DOXYWWWPATH=$(TF_WWWBASEDIR)/libpsdxx
.PHONY: doxyclean doxyview doxydoc doxyconf
doxyclean: ;/bin/rm -rfv $(DOXYWWWPATH) doxydoc.xxx
DOXYSRC=$(DOXYTXT) $(LIBCCSRC) $(LIBHEADERS)\
$(TESTCCSRC) Makefile
PWD=$(shell env pwd)
# create doxygen intermediate configuration
doxydoc.xxx: doxydoc.cfg
sed 's,<OUTPUTDIRECTORY>,$(DOXYWWWPATH),g;s,<STRIPFROMPATH>,$(PWD),g' \
$< > $@
# create commented version of doxygen configuration
doxycomm.xxx: doxydoc.cfg
/bin/cp -vf $< $@; doxygen -u $@
$(DOXYWWWPATH)/html/index.html: doxydoc.xxx $(DOXYSRC)
mkdir -vp $(DOXYWWWPATH)
doxygen $<
doxydoc: $(DOXYWWWPATH)/html/index.html
doxyview: $(DOXYWWWPATH)/html/index.html
$(TF_BROWSER) file:$< &
#======================================================================
# test code
# ---------
testpsdxx: testpsdxx.cc install
$(CXX) -o $@ $< -I$(LOCINCLUDEDIR) -lpsdxx -ltsxx -lfourierxx -laff \
-ltfxx -lfftw3 \
-L$(LOCLIBDIR) $(CXXFLAGS) $(FLAGS)
# ----------------------------------------------------------------------
# test LogTaper
LOGTAPERINDEX=3
logtaper.xxx: testpsdxx
./$< -lt=$(LOGTAPERINDEX) > $@
logtaper.ps: testlogtaper.gpt logtaper.xxx
gnuplot $<
%.psp: %.ps; gv $<; /bin/rm -fv $<
# ----- END OF Makefile -----
this is <README>
============================================================================
LIBPSDXX - compute (cross) power spectral density
-------------------------------------------------
Purpose
-------
Compute cross power spectral density and power spectral density.
Description
-----------
This library (libpsdxx) provides a C++ class to compute the cross power
spectral density of two time series, the power spectral density of a single
time series and the coherency of two time series.
Documentation
=============
doxygen source code documentation
---------------------------------
Detailed documentation of concept and implementation is provided in the source
code. doxygen can be used to create appropriate html files. See target
doxydoc in the Makefile. The libraries API is described there.
Introductory texts are provided in doxygen.txt and are used in the doxygen
documentation.
Installation
============
See README.md and INSTALL.md in the root directory of the repository for
general installation instructions.
environment variables:
LOCINCLUDEDIR Defines the path where header files will be copied for
usage in your own projects. You will pass this path to
the precompiler with the -I option.
LOCLIBDIR Defines the path where the binary library will be
placed.
TF_WWWBASEDIR Defines the path to your personal homepage. That's the
place where doxygen output will be written too (see
in the Makefile).
make all installs headers, binary libraries and documentation
Dependencies
------------
This library requires code from libaff, libtsxx, libfourierxx.
An external dependency is fftw3
The test program requires libtfxx additionally.
----- END OF README -----
/*! \file debug.h
* \brief suport debugging in libpsdxx (prototypes)
*
* ----------------------------------------------------------------------------
*
* \author Thomas Forbriger
* \date 05/05/2011
*
* support debugging in libpsdxx (prototypes)
*
* Copyright (c) 2011 by Thomas Forbriger (BFO Schiltach)
*
* ----
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
* REVISIONS and CHANGES
* - 05/05/2011 V1.0 Thomas Forbriger
* - 01/01/2019 V1.1 copied from libstfinv
*
* ============================================================================
*/
// include guard
#ifndef PSDXX_DEBUG_H_VERSION
#define PSDXX_DEBUG_H_VERSION \
"PSDXX_DEBUG_H V1.1"
#include<iostream>
/*! \brief produce debug output
* \ingroup group_debug
*
* \param C output will be generated if C == true
* \param N name of function
* \param M message to print
*/
#define PSDXX_debug(C,N,M) \
if (C) { \
std::cerr << "DEBUG (" << N << ", " \
<< __FILE__ << " line #" << __LINE__ << "):" << std::endl \
<< " " << M << std::endl; \
std::cerr.flush(); \
}
/*! \brief report value in a sequence of output operators
* \ingroup group_debug
*
* \param P parameter to dump
*/
#define PSDXX_value( P ) #P << "=" << P
/*! \brief report value of expression
* \ingroup group_debug
*
* \param P parameter to dump
*/
#define PSDXX_DUMP( P ) \
std::cerr << "DEBUG: " \
<< __FILE__ << " line #" << __LINE__ << " " \
<< #P << "=" << P << std::endl;
#endif // PSDXX_DEBUG_H_VERSION (includeguard)
/* ----- END OF debug.h ----- */
# Doxyfile 1.8.11
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "LIBPSDXX: compute (cross) power spectral density"
PROJECT_NUMBER =
PROJECT_BRIEF =
PROJECT_LOGO =
OUTPUT_DIRECTORY = <OUTPUTDIRECTORY>
CREATE_SUBDIRS = NO
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = YES
INLINE_INHERITED_MEMB = YES
FULL_PATH_NAMES = YES
STRIP_FROM_PATH = <STRIPFROMPATH>
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = YES
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = YES
TAB_SIZE = 8
ALIASES =
TCL_SUBST =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
AUTOLINK_SUPPORT = YES
BUILTIN_STL_SUPPORT = YES
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = YES
GROUP_NESTED_COMPOUNDS = NO
SUBGROUPING = YES
INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = NO
TYPEDEF_HIDES_STRUCT = NO
LOOKUP_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_PACKAGE = NO
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = YES
EXTRACT_ANON_NSPACES = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = YES
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
HIDE_COMPOUND_REFERENCE= NO
SHOW_INCLUDE_FILES = YES
SHOW_GROUPED_MEMB_INC = NO
FORCE_LOCAL_INCLUDES = NO
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = YES
SORT_MEMBERS_CTORS_1ST = YES
SORT_GROUP_NAMES = YES
SORT_BY_SCOPE_NAME = YES
STRICT_PROTO_MATCHING = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS = internal
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE =
CITE_BIB_FILES =
#---------------------------------------------------------------------------
# Configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO