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
7925ead4
Commit
7925ead4
authored
Nov 14, 2017
by
thomas.forbriger
Browse files
libtsxx [WP]: provide debug output for interpolator class and function resamp
parent
9e893568
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/libs/libtsxx/ipo.cc
View file @
7925ead4
...
...
@@ -40,6 +40,7 @@
"TF_IPO_CC V1.2"
#include <tsxx/ipo.h>
#include <tsxx/debug.h>
namespace
ts
{
...
...
@@ -53,6 +54,9 @@ namespace ts {
:
Exception
(
message
,
file
,
line
,
cond
)
{
}
/* ----------------------------------------------------------------------
*/
// exception constructor
ExceptionTimeWindowEmpty
::
ExceptionTimeWindowEmpty
(
const
char
*
message
,
const
char
*
file
,
...
...
@@ -61,6 +65,9 @@ namespace ts {
:
Exception
(
message
,
file
,
line
,
cond
)
{
}
/* ======================================================================
*/
//! resample a time series
ts
::
TDsfftimeseries
resample
(
const
Interpolator
&
ip
,
const
libtime
::
TAbsoluteTime
&
first
,
...
...
@@ -101,6 +108,14 @@ namespace ts {
"new time window is empty"
,
ExceptionTimeWindowEmpty
);
}
TSXX_debug
(
ip
.
debug
(),
"resample"
,
"window covered by input series:
\n
"
<<
old_first
.
timestring
()
<<
" - "
<<
old_last
.
timestring
());
TSXX_debug
(
ip
.
debug
(),
"resample"
,
"window requested for output series:
\n
"
<<
new_first
.
timestring
()
<<
" - "
<<
new_last
.
timestring
());
TRange
inputwindow
(
old_first
,
old_last
);
TRange
outputwindow
(
new_first
,
new_last
);
TSXX_Xassert
((
inputwindow
.
includes
(
outputwindow
)),
...
...
@@ -113,7 +128,7 @@ namespace ts {
TAbsoluteTime
it
=
new_first
;
for
(
int
i
=
0
;
i
<
nsamples
;
++
i
)
{
retval
(
i
)
=
ip
(
it
);
it
+=
dt
;
}
return
(
retval
);
}
}
// ts::TDsfftimeseries resample(...)
}
// namespace ipo
...
...
src/libs/libtsxx/ipo.h
View file @
7925ead4
...
...
@@ -122,10 +122,16 @@ namespace ts {
Theader
header
()
const
{
return
(
Mts
.
header
);
}
Tconst_series
series
()
const
{
return
(
Mts
);
}
Tconst_timeseries
timeseries
()
const
{
return
(
Mts
);
}
//! indicate whether interpolator is in debug mode
bool
debug
()
const
{
return
(
Mdebug
);
}
protected:
Interpolator
(
Tconst_timeseries
ts
)
:
Mts
(
ts
)
{
}
Interpolator
(
Tconst_timeseries
ts
,
const
bool
&
debug
=
false
)
:
Mts
(
ts
),
Mdebug
(
debug
)
{
}
//! here we hold a copy
Tconst_timeseries
Mts
;
private:
//! produce debug output
bool
Mdebug
;
};
// class Interpolator
/*! \brief function to resample data
...
...
src/libs/libtsxx/ipolin.cc
View file @
7925ead4
...
...
@@ -45,8 +45,7 @@ namespace ts {
*/
LinearInterpolator
::
LinearInterpolator
(
const
Tconst_timeseries
&
ts
,
const
bool
&
debug
)
:
Tbase
(
ts
),
Mdebug
(
debug
),
Tbase
(
ts
,
debug
),
Mlast
(
sff
::
wid2lastsample
(
Mts
.
header
)),
Mdt
(
libtime
::
double2time
(
Mts
.
header
.
dt
)),
Madjustedfirst
(
Mts
.
header
.
date
+
(
Mdt
/
2
)),
...
...
@@ -79,7 +78,7 @@ namespace ts {
"requested sample lies outside time series"
);
aff
::
Tsubscript
iright
=
(
ileft
<
s
.
l
())
?
ileft
+
1
:
ileft
;
double
f
=
libtime
::
time2double
(
t
-
sff
::
wid2isample
(
hd
,
ileft
))
/
hd
.
dt
;
if
(
M
debug
)
if
(
this
->
debug
()
)
{
std
::
cout
<<
"DEBUG: LinearInterpolator::operator():"
<<
std
::
endl
;
std
::
cout
<<
TF_IPOLIN_CC_VERSION
<<
std
::
endl
;
...
...
src/libs/libtsxx/ipolin.h
View file @
7925ead4
...
...
@@ -62,7 +62,6 @@ namespace ts {
~
LinearInterpolator
()
{
}
Tvalue
operator
()(
const
libtime
::
TAbsoluteTime
&
t
)
const
;
private:
bool
Mdebug
;
libtime
::
TAbsoluteTime
Mlast
;
libtime
::
TRelativeTime
Mdt
;
libtime
::
TAbsoluteTime
Madjustedfirst
;
...
...
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