Commit ba361d40 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

libpsdxx [WP][FEATURE]: implement member functions of DPSDComputer

Implement:
  DPSDComputer.coherency (with water level normalization)
  DPSDComputer.psd
  DPSDComputer.cross_psd
parent a41d1a90
......@@ -34,13 +34,29 @@
"PSDXX_DPSDCOMPUTER_COHERENCY_CC V1.0"
#include <psdxx/psd.h>
#include <aff/iterator.h>
#include <aff/functions/max.h>
namespace psd {
TDISeries DPSDComputer::coherency(const TDISeries::Tcoc& s1,
const TDISeries::Tcoc& s2) const
{
TDISeries retval;
SpectralValues sv=this->processor(s1, s2, true, true);
TDISeries retval=psd::abs(sv.cpsd);
aff::Iterator<TDISeries::Tseries> S(retval.data);
double psdmax1=aff::func::max(sv.psd1.data);
double psdmax2=aff::func::max(sv.psd2.data);
double psdlim=std::sqrt(psdmax1*psdmax2)*1.e-10;
aff::Browser<TDISeries::Tseries> P1(sv.psd1.data);
aff::Browser<TDISeries::Tseries> P2(sv.psd2.data);
while(S.valid() && P1.valid() && P2.valid())
{
double psd=std::sqrt(*P1)*std::sqrt(*P2);
psd = psd > psdlim? psd : psdlim;
*S /= psd;
++S; ++P1; ++P2;
}
return(retval);
} // TDISeries DPSDComputer::coherency(...) const
......
......@@ -41,7 +41,8 @@ namespace psd {
DPSDComputer::cross_psd(const TDISeries::Tcoc& s1,
const TDISeries::Tcoc& s2) const
{
TDCISeries retval;
SpectralValues sv=this->processor(s1, s2, true, false);
TDCISeries retval(sv.cpsd);
return(retval);
} // TDCISeries DPSDComputer::cross_psd(...) const
......
......@@ -39,7 +39,8 @@ namespace psd {
TDISeries DPSDComputer::psd(const TDISeries::Tcoc& s) const
{
TDISeries retval;
SpectralValues sv=this->processor(s, s, false, true);
TDISeries retval(sv.psd1);
return(retval);
} // TDISeries DPSDComputer::psd(const TDISeries::Tcoc& s) const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment