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
5f268bab
Commit
5f268bab
authored
Apr 08, 2019
by
thomas.forbriger
Browse files
libpsdxx [FEATURE]: provide additional function to map complex data
parent
747c6949
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libs/libpsdxx/function_lin_log_sampling.cc
View file @
5f268bab
...
...
@@ -28,11 +28,12 @@
*
* REVISIONS and CHANGES
* - 14/02/2019 V1.0 Thomas Forbriger
* - 08/04/2019 V1.1 provide version for complex data too
*
* ============================================================================
*/
#define PSDXX_FUNCTION_LIN_LOG_SAMPLING_CC_VERSION \
"PSDXX_FUNCTION_LIN_LOG_SAMPLING_CC V1.
0
"
"PSDXX_FUNCTION_LIN_LOG_SAMPLING_CC V1.
1
"
#include <psdxx/psd.h>
#include <psdxx/error.h>
...
...
@@ -60,6 +61,29 @@ namespace psd {
// const TDseries::Tcoc& flin,
// const TDseries::Tcoc& flog)
/* ---------------------------------------------------------------------- */
TDCseries
log_sampling
(
const
TDCseries
::
Tcoc
&
s
,
const
TDseries
::
Tcoc
&
flin
,
const
TDseries
::
Tcoc
&
flog
)
{
// consistency checks
PSDXX_assert
(
s
.
size
()
>
1
,
"input series must contain at least 2 values"
);
PSDXX_assert
(
s
.
size
()
==
flin
.
size
(),
"series of frequencies does not match data series"
);
double
df1
=
flin
(
flin
.
f
()
+
1
)
-
flin
(
flin
.
f
());
double
df2
=
flin
(
flin
.
l
())
-
flin
(
flin
.
l
()
-
1
);
PSDXX_assert
(
std
::
abs
((
df2
/
df1
)
-
1.
)
<
1.e-8
,
"input frequency scale is not linear"
);
TDCISeries
::
Tcoc
data
;
data
.
interval
=
df1
;
data
.
data
=
s
;
TDCseries
retval
=
log_sampling
(
data
,
flog
);
return
(
retval
);
}
// TDCseries log_sampling(const TDCseries::Tcoc& s,
// const TDseries::Tcoc& flin,
// const TDseries::Tcoc& flog)
}
// namespace psd
/* ----- END OF function_lin_log_sampling.cc ----- */
src/libs/libpsdxx/psd.h
View file @
5f268bab
...
...
@@ -27,6 +27,7 @@
*
* REVISIONS and CHANGES
* - 01/01/2019 V1.0 Thomas Forbriger
* - 08/04/2019 V1.1 provide additional version to map complex data
*
* ============================================================================
*/
...
...
@@ -35,7 +36,7 @@
#ifndef PSDXX_PSD_H_VERSION
#define PSDXX_PSD_H_VERSION \
"PSDXX_PSD_H V1.
0
"
"PSDXX_PSD_H V1.
1
"
#include<complex>
#include<aff/series.h>
...
...
@@ -356,6 +357,21 @@ namespace psd {
const
TDseries
::
Tcoc
&
flin
,
const
TDseries
::
Tcoc
&
flog
);
/*! sample complex values on a logarithmic frequency axis
*
* \param s spectral values with uniform sampling along frequency axis
* \param flin frequency values on a linear scale, matching the input
* series \p s
* \param flog frequency values on a logarithmic scale like returned by
* function log_frequency()
* \return series of sampled spectral values, where each sample of the
* returned series corresponds to the frequency with the
* corresponding index in \p flog
*/
TDCseries
log_sampling
(
const
TDCseries
::
Tcoc
&
s
,
const
TDseries
::
Tcoc
&
flin
,
const
TDseries
::
Tcoc
&
flog
);
}
// namespace psd
#endif // PSDXX_PSD_H_VERSION (includeguard)
...
...
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