1 #ifndef TIMESERIESCOMPONENT_H_
2 #define TIMESERIESCOMPONENT_H_
6 #include <boost/date_time/posix_time/posix_time_types.hpp>
7 #include <boost/operators.hpp>
23 TimeSeriesComponent>, double>
27 std::vector<double> data;
33 boost::posix_time::ptime starttime;
35 typedef std::vector<double>::iterator
tdatait;
41 const std::vector<double> &
GetData()
const
67 return 1. / samplerate;
81 void Resample(
const double newdt);
114 gplib::rvec ubvec(data.size());
115 std::copy(data.begin(), data.end(), ubvec.begin());
std::vector< double > & GetData()
Access for data vector, for ease of use and efficiency we return a reference.
TimeSeriesComponent & operator+=(const double shift)
Add a constant shift to each element of the time series.
void ShiftStart(const int npts)
Shift the start of the recording by npts points.
void ShiftEnd(const int npts)
Shift the end of the recording by npts points.
void SetSamplerate(const double rate)
Set sampling rate in Hz.
TimeSeriesComponent & operator-=(const double shift)
Substract a constant shift from each element of the time series.
virtual ~TimeSeriesComponent()
TimeSeriesComponent & operator/=(const double numerator)
Devide each element of the time series by a constant number.
TimeSeriesComponent is the base storage class for all types of time series data.
std::vector< double >::iterator tdatait
std::string GetName() const
Return name of the component.
void SetDt(const double dt)
Set delta t in s.
double GetSamplerate() const
Return samplerate in Hz.
void SetName(const std::string &n)
Modify name of the component.
TimeSeriesComponent & operator*=(const double factor)
Multiply each element of the time series by a constant factor.
double GetDt() const
Return dt in s.
const std::vector< double > & GetData() const
TimeSeriesComponent & operator=(const TimeSeriesComponent &source)