SeisTools.h

Go to the documentation of this file.
00001 #ifndef SEISTOOLS_H_
00002 #define SEISTOOLS_H_
00003 
00004 #include <algorithm>
00005 #include <cassert>
00006 #include <boost/bind.hpp>
00007 #include <vector>
00008 namespace gplib
00009   {
00010     /** \addtogroup seistools Seismic data analysis and modeling */
00011     /* @{ */
00012 
00013     //! Calculate density from a given S-velocity, the formula is taken from Owen et al. JGR 89,7783-7795 and modified for vs
00014     struct CalcDensity
00015       {
00016       double operator()(const double svel)
00017         {
00018           return (0.77 + 0.554 * svel);
00019         }
00020       };
00021 
00022     inline void Normalize(std::vector<double> &Trace)
00023       {
00024         const double maxtrace = *max_element(Trace.begin(), Trace.end());
00025         assert(std::abs(maxtrace) > 0.0 );
00026         const double maxamp = 1. / maxtrace;
00027         std::transform(Trace.begin(), Trace.end(), Trace.begin(), boost::bind(
00028             std::multiplies<double>(), _1, maxamp));
00029       }
00030   /* @} */
00031   }
00032 #endif /*SEISTOOLS_H_*/

Generated on Tue May 4 16:52:15 2010 for GPLIB++ by  doxygen 1.5.8