16 RFCalculator(5, mysigma, myc, false, themethod)
28 RFCalculator(Old.RFCalculator), Velocities(Old.Velocities), Periods(
38 RFCalculator = source.RFCalculator;
39 Velocities = source.Velocities;
40 Periods = source.Periods;
44 void RFVelCalc::AbsVelCalc(
const double slowness,
50 ttsdata FilteredR(RadRec.
GetData().size()), FilteredZ(
57 assert(FilteredR.size() == FilteredZ.size());
58 assert(fcmp(RadRec.
GetDt(),VerRec.
GetDt(),std::numeric_limits<double>::epsilon())==0);
60 const double relshift = 5.0
64 for (
double width = 0.1; width < 80; width *= 1.1)
67 double sigma = width / (RadRec.
GetDt() * RadRec.
GetData().size());
70 FilteredR.begin(),
TruncCosSq(sigma), relshift);
72 FilteredZ.begin(),
TruncCosSq(sigma), relshift);
74 double rvalue = std::accumulate(FilteredR.begin(), FilteredR.end(), 0.0);
75 double zvalue = std::accumulate(FilteredZ.begin(), FilteredZ.end(), 0.0);
80 double vsapp = sin(0.5 * atan2(rvalue, zvalue)) / slowness;
82 AppVel.push_back(vsapp);
83 Velocities.push_back(vsapp);
84 Periods.push_back(width);
93 RFCalculator.
CalcRecData(VerComp, VerComp, ZRecFunc);
94 AbsVelCalc(slowness, RRec, ZRecFunc, AppVel);
102 RFCalculator.
CalcRecData(RadComp, VerComp, RRecFunc);
103 RFCalculator.
CalcRecData(VerComp, VerComp, ZRecFunc);
104 AbsVelCalc(slowness, RRecFunc, ZRecFunc, AppVel);
109 std::ofstream outfile(filename.c_str());
110 for (
size_t i = 0; i < Velocities.size(); ++i)
111 outfile << Periods.at(i) <<
" " << Velocities.at(i) << std::endl;
trfmethod
There are several ways to calculate receiver functions.
std::vector< double > & GetData()
Access for data vector, for ease of use and efficiency we return a reference.
void WriteVelocities(const std::string filename)
Write the velocity estiamtes and corresponding periods into an ascii file.
void SetNormalize(const bool what)
Change whether the output receiver function is normalized to a maximum amplitude of 1...
void CalcRecData(const SeismicDataComp &RadComp, const SeismicDataComp &VerComp, SeismicDataComp &Receiver)
Calculate Receiver functions from two data components.
RFVelCalc(const double mysigma, const double myc, const RecCalc::trfmethod themethod=RecCalc::specdiv)
The constructor takes three parameters for the receiver function estimation.
This class implements the method to calculate absolute S-Wave velocities from Receiver function data ...
void CalcRFVel(const double slowness, const SeismicDataComp &RadComp, const SeismicDataComp &VerComp, ttsdata &AppVel)
Calculate absolute velocities from the radial and vertical components of the seismogram.
RFVelCalc & operator=(const RFVelCalc &source)
A variable width cosine squared window that is zero outside.
double GetDt() const
Return dt in s.
void CalcRFVelFromRec(const double slowness, const SeismicDataComp &RRec, const SeismicDataComp &VerComp, ttsdata &AppVel)
Calculate absolute velocities from the radial receiver function and the vertical component of the sei...
The basic exception class for all errors that arise in gplib.