38 #ifndef UncertaintyPIU_H
39 #define UncertaintyPIU_H
48 #include "IFStreamAscii.h"
49 #include "IFStreamBinary.h"
240 virtual bool operator != (
const UncertaintyPIU& other)
const {
return !(*
this == other); } ;
272 string getPhaseStr();
286 string getAttributeStr();
348 switch(attributeIndex)
363 if (phase ==
"Pn")
return Pn;
364 if (phase ==
"Sn")
return Sn;
365 if (phase ==
"Pg")
return Pg;
366 if (phase ==
"Lg")
return Lg;
372 if (attribute ==
"TT")
return TT;
373 if (attribute ==
"Sh")
return SH;
374 if (attribute ==
"Az")
return AZ;
426 double getUncertainty(
double f,
int idist,
int idepth);
436 double getVariance(
double f,
int idist,
int idepth);
450 void getIndex(
double x,
const vector<double>& v,
int& index,
double& w);
457 void readFile(
const string& filename);
483 vector<double> errDistances;
490 vector<double> errDepths;
497 vector<vector<double> > errVal;
501 inline int UncertaintyPIU::getPhase()
506 inline int UncertaintyPIU::getAttribute()
511 inline string UncertaintyPIU::getPhaseStr()
513 return getPhase(phaseNum);
516 inline string UncertaintyPIU::getAttributeStr()
518 return getAttribute(attributeNum);
521 inline double UncertaintyPIU::getUncertainty(
double f,
int idist,
int idepth)
523 return (f * (errVal[idepth][idist+1] - errVal[idepth][idist]) +
524 errVal[idepth][idist]);
527 inline double UncertaintyPIU::getVariance(
double f,
int idist,
int idepth)
529 return (f * (errVal[idepth][idist+1] * errVal[idepth][idist+1] -
530 errVal[idepth][idist] * errVal[idepth][idist]) +
531 errVal[idepth][idist] * errVal[idepth][idist]);
A UncertaintyPIU object contains the raw data to calculate a modeling error in seconds as a function ...
void writeFile(geotess::IFStreamAscii &output)
virtual ~UncertaintyPIU()
Destructor.
static UncertaintyPIU * getUncertaintyPIU(util::DataBuffer &input, const int &phase, const int &attribute)
UncertaintyPIU(util::DataBuffer &buffer)
Parameterized constructor that loads uncertainty data from the input DataBuffer.
UncertaintyPIU(const UncertaintyPIU &u)
Copy constructor.
static UncertaintyPIU * getUncertaintyPIU(geotess::IFStreamBinary &input, const int &phase, const int &attribute)
void deserialize(util::DataBuffer &buffer)
Reads the uncertainty object from the input DataBuffer.
static UncertaintyPIU * getUncertaintyPIU(ifstream &input, const string &phase, const string &attribute)
vector< double > & getDepths()
A vector of doubles representing the depths.
vector< double > & getDistances()
A vector of doubles representing the angular distances (in degrees)
void writeFile(geotess::IFStreamBinary &fout)
UncertaintyPIU(string modelPath, const string &phase, int phasenum)
static UncertaintyPIU * getUncertaintyPIU(geotess::IFStreamAscii &input, const int &phase, const int &attribute)
bool operator!=(const UncertaintyPIU &other)
static UncertaintyPIU * getUncertaintyPIU(geotess::IFStreamBinary &input, const string &phase, const string &attribute)
void readFile(ifstream &fin)
UncertaintyPIU(const int &phase, const int &attribute)
Parameterized constructor that loads model error from a specified file.
vector< vector< double > > & getValues()
A vector of doubles representing the model errors (in seconds)
double getUncertainty(const double &distance, double depth=0.0)
Returns the model uncertainty as a function of angular distance (radians) and depth.
static UncertaintyPIU * getUncertaintyPIU(util::DataBuffer &input, const string &phase, const string &attribute)
UncertaintyPIU()
Default constructor.
int getBufferSize()
Returns the model uncertainty DataBuffer size storage requirement.
UncertaintyPIU & operator=(const UncertaintyPIU &u)
Assignment operator.
static UncertaintyPIU * getUncertaintyPIU(geotess::IFStreamAscii &input, const string &phase, const string &attribute)
double getVariance(const double &distance, double depth=0.0)
Returns the model variance as a function of angular distance (radians) and depth.
static string getAttribute(const int &attributeIndex)
void serialize(util::DataBuffer &buffer)
Writes the uncertainty object into the input DataBuffer.
UncertaintyPIU(const string &phase, const string &attribute)
Parameterized constructor that loads model error from a specified file.
void writeFile(const string &directoryName)
static UncertaintyPIU * getUncertaintyPIU(const string &directoryName, const int &phase, const int &attribute)
void readFile(geotess::IFStreamBinary &fin)
static string getPhase(const int &phaseIndex)
static int getAttribute(const string &attribute)
static UncertaintyPIU * getUncertaintyPIU(ifstream &input, const int &phase, const int &attribute)
void readFile(geotess::IFStreamAscii &fin)
static int getPhase(const string &phase)
UncertaintyPIU(string modelPath, const int &phase, const int &attribute)
Parameterized constructor that loads model error from a specified file.
A byte array container used to hold binary data in the same manner as disk based file system.