Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Seitosh
Seitosh
Commits
45c1a95e
Commit
45c1a95e
authored
Mar 19, 2016
by
thomas.forbriger
Browse files
Merge branch 'master' into stf_issue12
parents
58bb24b1
d4190892
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/libs/libtsxx/filter.cc
View file @
45c1a95e
...
...
@@ -4,11 +4,11 @@
* ----------------------------------------------------------------------------
*
* \author Thomas Forbriger
* \date
3
1/0
7
/201
5
* \date 1
9
/0
3
/201
6
*
* some time series filter classes (implementation)
*
* Copyright (c) 2005, 2015 by Thomas Forbriger (BFO Schiltach)
* Copyright (c) 2005, 2015
, 2016
by Thomas Forbriger (BFO Schiltach)
*
* ----
* This program is free software; you can redistribute it and/or modify
...
...
@@ -51,15 +51,18 @@
* - take usage text from text file
* - 31/07/2015 V1.10
* - add filter Powerof
* - 19/03/2016 V1.11
* - add filter GaussianNoise
*
* ============================================================================
*/
#define TF_FILTER_CC_VERSION \
"TF_FILTER_CC V1.1
0
"
"TF_FILTER_CC V1.1
1
"
#include <cmath>
#include <sstream>
#include <algorithm>
#include <tsxx/random.h>
#include <tsxx/filter.h>
#include <tsxx/filter_usage_text.h>
#include <aff/functions/avg.h>
...
...
@@ -195,6 +198,18 @@ namespace ts {
/*----------------------------------------------------------------------*/
//! add Gaussian noise
Ttimeseries
GaussianNoise
::
operator
()(
const
Ttimeseries
&
s
,
const
bool
&
debug
)
const
{
Tseries
x
=
s
;
Tseries
n
=
ts
::
rnd
::
dugauss
(
x
.
size
())
*
Ma
;
x
+=
n
;
return
s
;
}
/*----------------------------------------------------------------------*/
//! rectification
Ttimeseries
Rectifier
::
operator
()(
const
Ttimeseries
&
s
,
const
bool
&
debug
)
const
...
...
@@ -434,6 +449,9 @@ namespace ts {
}
else
if
(
ID
==
"del"
)
{
is
>>
v
;
fh
=
Tfh
(
new
Delay
(
v
));
}
else
if
(
ID
==
"noi"
)
{
is
>>
v
;
fh
=
Tfh
(
new
GaussianNoise
(
v
));
}
else
if
(
ID
==
"nrm"
)
{
is
>>
v
;
fh
=
Tfh
(
new
Normalize
(
v
));
...
...
src/libs/libtsxx/filter.h
View file @
45c1a95e
...
...
@@ -4,11 +4,11 @@
* ----------------------------------------------------------------------------
*
* \author Thomas Forbriger
* \date
3
1/0
7
/201
5
* \date 1
9
/0
3
/201
6
*
* some time series filter classes (prototypes)
*
* Copyright (c) 2005, 2015 by Thomas Forbriger (BFO Schiltach)
* Copyright (c) 2005, 2015
, 2016
by Thomas Forbriger (BFO Schiltach)
*
* ----
* This program is free software; you can redistribute it and/or modify
...
...
@@ -43,6 +43,8 @@
* - added cumsum
* - 31/07/2015 V1.7
* - add filter Powerof
* - 19/03/2016 V1.8
* - add filter GaussianNoise
*
* ============================================================================
*/
...
...
@@ -51,7 +53,7 @@
#ifndef TF_FILTER_H_VERSION
#define TF_FILTER_H_VERSION \
"TF_FILTER_H V1.
7
"
"TF_FILTER_H V1.
8
"
#include<tsxx/filterbase.h>
...
...
@@ -306,6 +308,22 @@ namespace ts {
/*----------------------------------------------------------------------*/
/*! \brief Add random Gaussian noise.
* \ingroup filter
*
* \param a rms amplitude of noise to be added
*/
class
GaussianNoise
:
public
ts
::
filter
::
BasicFilter
{
public:
GaussianNoise
(
const
double
&
a
)
:
Ma
(
a
)
{
}
Ttimeseries
operator
()(
const
Ttimeseries
&
s
,
const
bool
&
debug
=
false
)
const
;
private:
double
Ma
;
};
// class GaussianNoise
/*----------------------------------------------------------------------*/
/*! create a filter
* \ingroup filter
*/
...
...
src/libs/libtsxx/filter_usage_text.txt
View file @
45c1a95e
...
...
@@ -6,7 +6,7 @@
# description of filters provided in namespace ts::filter
# as provided through filter.h and defined in filter.cc
#
available filters (version 201
5
/0
7/31
):
available filters (version 201
6
/0
3/19
):
tre n remove trend found in first n samples
(n=0: use all samples)
avg n remove average found in first n samples
...
...
@@ -31,5 +31,6 @@ rec rectify signal
cus calculate cumulative sum
iset n1,n2,v
set samples n1-n2 to value v
noi a add Gaussian random noise of rms amplitude a
#
# ----- END OF filter_usage_text.txt -----
src/ts/wf/Makefile
View file @
45c1a95e
# this is <Makefile>
# ----------------------------------------------------------------------------
# $Id$
#
# Copyright (c) 2005 by Thomas Forbriger (BFO Schiltach)
#
...
...
@@ -48,6 +47,7 @@
# 02/01/2014 V1.11 removed signal generators, added tisli suspect
# 01/02/2014 thof: rewrite all linker rules with libraries in
# proper order
# 19/03/2016 thof: tidofi requires libgsl for filter GaussianNoise
#
# ============================================================================
...
...
@@ -202,7 +202,7 @@ sigval sigscale geophone gatherdiff cross autocorr: \
tidofi
:
\
%: %.o
$(LINK.cpp)
$^
$(LOADLIBES)
$(LDLIBS)
-o
$@
\
-ltsxx
-lcseife
$(LIBDATRWXX)
-ltfxx
-ltsxx
-lcseife
$(LIBDATRWXX)
-ltfxx
-lgsl
-lgslcblas
fidasexx
:
\
%: %.o
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment