Commit 18494e4e authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

added weights

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 3980
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent ca3666a8
......@@ -47,13 +47,32 @@ namespace stfinv {
STFBaseEngine::STFBaseEngine(const stfinv::Tvectoroftriples& triples,
const stfinv::Waveform& stf,
const std::string& parameters)
: Mtriples(triples), Mstf(stf)
: Mtriples(triples), Mstf(stf), Mweights(0,triples.size()-1)
{
this->checkconsistency();
this->parseparameters(parameters);
std::istringstream is(this->parameter("DEBUG","0"));
is >> Mdebug;
// extract parameters
{
std::istringstream is(this->parameter("DEBUG","0"));
is >> Mdebug;
}
Mverbose=(this->parameter("verbose","false")=="true");
if (this->parameterisset("exp"))
{
double k;
std::istringstream is(this->parameter("exp","0."));
is >> k;
for (unsigned int i=0; i<Mtriples.size(); ++i)
{
double offset=Mtriples[i].offset();
Mweights(i)=pow(offset,k);
}
}
else
{
Mweights=1.;
}
} // STFBaseEngine::STFBaseEngine(const stfinv::Tvectoroftriples& triples,
/*----------------------------------------------------------------------*/
......@@ -78,8 +97,22 @@ namespace stfinv {
void STFBaseEngine::help(std::ostream& os) const
{
os << "online help is not implemented for this engine" << std::endl;
}
STFBaseEngine::classhelp(os);
} // void STFBaseEngine::help(std::ostream& os) const
/*----------------------------------------------------------------------*/
void STFBaseEngine::classhelp(std::ostream& os)
{
os << "Options and parameters in common for all engines:\n"
<< "verbose produce verbose output (if implemented)\n"
<< "DEBUG=l produce debug output with level l\n"
<< "exp=k apply offset dependent weights to signals\n"
<< "If implemented in the engine in use then setting the parameter\n"
<< "exp=k will give a weight factor of ((r/1m)**k) to each signal\n"
<< "in order to compensate the decrease in signal energy."
<< std::endl;
} // void STFBaseEngine::classhelp(std::ostream& os)
/*----------------------------------------------------------------------*/
......@@ -175,6 +208,15 @@ namespace stfinv {
"ERROR: receiver index out of range");
}
/*======================================================================*/
double WaveformTriple::offset() const
{
double dx=header.rx-header.sx;
double dy=header.ry-header.sy;
return (sqrt(dx*dx+dy*dy));
} // double WaveformTriple::offset() const
} // namespace stfinv
/* ----- END OF stfinvbase.cc ----- */
......@@ -79,6 +79,9 @@ namespace stfinv {
* time function as a result of a call to the library functions.
*/
Tseries convolvedsynthetics;
/*! \brief Return source offset of this waveform
*/
double offset() const;
}; // class WaveformTriple
/*----------------------------------------------------------------------*/
......@@ -170,6 +173,8 @@ namespace stfinv {
virtual void help(std::ostream& os=std::cout) const;
//! \brief return name of engine
virtual const char* name() const;
//! \brief print online help
static void classhelp(std::ostream& os=std::cout);
//@}
/*! \name Shape query functions
......@@ -211,10 +216,12 @@ namespace stfinv {
bool parameterisset(const std::string& key) const;
//! \brief check for vaid receiver index
void checkreceiverindex(const unsigned int& i) const;
//@}
//! \brief Virtual function to run engine
virtual void exec() { STFINV_baseillegal; }
//! \brief return weight for signal at receiver i
double weight(const unsigned int& i) const
{ return(Mweights(i)); }
//@}
private:
/*! \name Functions implementing base class operation
......@@ -224,6 +231,8 @@ namespace stfinv {
void parseparameters(std::string parameters);
//! \brief Check consistency of data members.
void checkconsistency() const;
//! \brief Set weights according to exponent
void setweights(const double& k);
//@}
// member data
......@@ -245,6 +254,8 @@ namespace stfinv {
* const read function.
*/
mutable stfinv::tools::Tparamap Mparamap;
//! \brief Weights
aff::Series<double> Mweights;
}; // class STFBaseEngine
} // namespace stfinv
......
......@@ -74,20 +74,24 @@ extern "C" {
* \ingroup cinterface
*/
struct CTripleHeader {
/*! \brief Source coordinates in meters.
/*! \name Source coordinates in meters.
*
* - \c sx: x-coordinate
* - \c sy: y-coordinate
* - \c sz: z-coordinate
*/
//@{
double sx, sy, sz;
/*! \brief Receiver coordinates in meters.
//@}
/*! \name Receiver coordinates in meters.
*
* - \c rx: x-coordinate
* - \c ry: y-coordinate
* - \c rz: z-coordinate
*/
//@{
double rx, ry, rz;
//@}
/*! \brief Temporal sampling of all three waveforms.
*/
struct CWaveformHeader sampling;
......
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