10 namespace ublas = boost::numeric::ublas;
15 MultiRecCalc::MultiRecCalc(
const int myshift,
const double mysigma,
17 c(myc), sigma(mysigma), shift(myshift)
30 if (RadComp.size() != VerComp.size())
32 "Not the same number of stations for vertical and radial components !");
33 const unsigned int compsize = RadComp.front()->GetData().size();
34 const unsigned int ncomp = RadComp.size();
35 const double omegastep = 2. * PI / (RadComp.front()->GetDt()
36 * RadComp.front()->GetData().size());
37 gplib::rvec ConcatRad(compsize * ncomp), ConcatVer(compsize * ncomp);
38 for (
unsigned int i = 0; i < ncomp; ++i)
40 if (RadComp.at(i)->GetData().size() != compsize
41 || VerComp.at(i)->GetData().size() != compsize)
43 "Incompatible sizes for Vertical or Radial component.");
44 copy(RadComp.at(i)->GetData().begin(),
45 RadComp.at(i)->GetData().end(), ConcatRad.begin() + i
47 copy(VerComp.at(i)->GetData().begin(),
48 VerComp.at(i)->GetData().end(), ConcatVer.begin() + i
52 ConcatRad.end(), compsize,
Steep());
54 ConcatVer.end(), compsize,
Steep());
55 gplib::cvec RecSpec(compsize / 2 + 1);
57 for (
unsigned int i = 0; i < radtfspectrum.size1(); ++i)
59 complex<double> delta = *max_element(
60 column(vertfspectrum, i).begin(),
61 column(vertfspectrum, i).end(), gplib::absLess<tcomp, tcomp>())
65 for (
unsigned int j = 0; j < radtfspectrum.size2(); ++j)
71 const double denom = 1. / (4.0 * sigma * sigma);
72 for (
unsigned int i = 0; i < RecSpec.size(); ++i)
74 double freq = omegastep * i;
75 RecSpec(i) *= exp(-(freq * freq) * denom);
77 Receiver.
SetB(-shift);
78 Receiver.
SetDt(RadComp.front()->GetDt());
79 Receiver.
GetData().assign(compsize, 0.0);
83 const int shiftpoints = boost::numeric_cast<
size_t>(shift
84 / RadComp.front()->GetDt());
86 - shiftpoints, Receiver.
GetData().end());
std::vector< double > & GetData()
Access for data vector, for ease of use and efficiency we return a reference.
std::vector< boost::shared_ptr< SeismicDataComp > > tseiscompvector
This functor rises steeply at the edges and then has a wide range where it is unity.
void SetB(const double theb)
The class CTsSpectrum is used to calculate spectra from (real) time series data.
void SetDt(const double dt)
Set delta t in s.
This class calculates one spectral element of the receiver function from the two input spectral eleme...
void CalcRecData(const SeismicStationList::tseiscompvector &RadComp, const SeismicStationList::tseiscompvector &VerComp, SeismicDataComp &Receiver)
Calculate the receiver function by spectral division.
The basic exception class for all errors that arise in gplib.