Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Seitosh
Seitosh
Commits
d67e8ae6
Commit
d67e8ae6
authored
Feb 25, 2019
by
thomas.forbriger
Browse files
libtsxx [FEATURE]: provide filter Pad
parent
48e8d952
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/libs/libtsxx/filter.cc
View file @
d67e8ae6
...
...
@@ -53,11 +53,13 @@
* - add filter Powerof
* - 19/03/2016 V1.11
* - add filter GaussianNoise
* - 25/02/2019 V1.12
* - add filter Pad
*
* ============================================================================
*/
#define TF_FILTER_CC_VERSION \
"TF_FILTER_CC V1.1
1
"
"TF_FILTER_CC V1.1
2
"
#include
<cmath>
#include
<sstream>
...
...
@@ -427,6 +429,19 @@ namespace ts {
/*----------------------------------------------------------------------*/
//! append additional samples
Ttimeseries
Pad
::
operator
()(
const
Ttimeseries
&
s
,
const
bool
&
debug
)
const
{
Ttimeseries
::
Tseries
padded
(
s
.
f
(),
s
.
l
()
+
this
->
Mn
);
padded
=
0.
;
Ttimeseries
::
Tseries
subseries
=
aff
::
subarray
(
padded
)(
s
.
f
(),
s
.
l
());
subseries
.
copyin
(
s
);
Ttimeseries
retval
(
padded
,
s
.
header
);
return
retval
;
}
/*----------------------------------------------------------------------*/
//! function to generate filter class
Tfilterhandle
make_filter
(
std
::
string
s
,
const
bool
&
debug
)
...
...
@@ -488,6 +503,9 @@ namespace ts {
fh
=
Tfh
(
new
RemoveFirst
());
}
else
if
(
ID
==
"rsf"
)
{
fh
=
Tfh
(
new
RestoreFirst
());
}
else
if
(
ID
==
"pad"
)
{
is
>>
n
;
fh
=
Tfh
(
new
Pad
(
n
));
}
else
{
TSXX_debug
(
debug
,
"make_filter"
,
" filter ID "
+
ID
+
" is unknown"
);
TSXX_UnknownFilterAbort
(
"ts::filter::make_filter"
,
ID
.
c_str
());
...
...
src/libs/libtsxx/filter.h
View file @
d67e8ae6
...
...
@@ -45,6 +45,8 @@
* - add filter Powerof
* - 19/03/2016 V1.8
* - add filter GaussianNoise
* - 25/02/2019 V1.9
* - add filter Pad
*
* ============================================================================
*/
...
...
@@ -53,9 +55,10 @@
#ifndef TF_FILTER_H_VERSION
#define TF_FILTER_H_VERSION \
"TF_FILTER_H V1.
8
"
"TF_FILTER_H V1.
9
"
#include
<tsxx/filterbase.h>
#include
<tsxx/error.h>
namespace
ts
{
...
...
@@ -361,6 +364,28 @@ namespace ts {
/*----------------------------------------------------------------------*/
/*! pad time series
* \ingroup filter
*
* pad time series by adding addtional samples which are set to zero.
*
* \param n number of samples to append
*/
class
Pad
:
public
ts
::
filter
::
BasicFilter
{
public:
Pad
(
const
int
&
n
)
:
Mn
(
static_cast
<
unsigned
int
>
(
n
))
{
TSXX_assert
(
n
>=
0
,
"number of samples to be appended must be positive"
);
}
Ttimeseries
operator
()(
const
Ttimeseries
&
s
,
const
bool
&
debug
=
false
)
const
;
private:
unsigned
int
Mn
;
};
// class Pad
/*----------------------------------------------------------------------*/
/*! create a filter
* \ingroup filter
*/
...
...
src/libs/libtsxx/filter_usage_text.txt
View file @
d67e8ae6
...
...
@@ -12,6 +12,7 @@ tre n remove trend found in first n samples
avg n remove average found in first n samples
(n=0: use all samples)
han apply hanning taper
pad n pad time series by appending n samples of value zero
fac f scale with factor f
del t delay by t seconds
nrm v normalize to maximum amplitude v
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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