Commit 2fd06729 authored by Achim Morschhauser's avatar Achim Morschhauser
Browse files

Modify routines for getting timestamp with filter

- filter_fir_sym_time is removed
- median_time is used for filter_fir_sym
- median_time needs to be updated to use average with even
  number of samples (TODO!!)
- median_time made public to allow setting timestamp without
  filtering the data
parent 029b15d6
......@@ -157,7 +157,7 @@ public: double timediff(data_obs* data) const;
/** Calculate median for odd number of data */
virtual int median_odd(std::vector <data_obs*>* data);
private: virtual int median_odd_time(std::vector <data_obs*>* data);
public: virtual int median_time(std::vector <data_obs*>* data);
private: virtual int median_odd_data(std::vector <data_obs*>* data);
/** Symmetric FIR filter */
......@@ -167,7 +167,6 @@ private: virtual int filter_fir_sym_data(std::vector <data_obs*>* data,
std::vector <double>* win);
private: virtual int filter_fir_sym_supp(std::vector <data_obs*>* data,
std::vector <double>* win);
private: virtual int filter_fir_sym_time(std::vector <data_obs*>* data);
/** Calculate median of even number of data */
//public: virtual int median_even(std::vector <data_obs> data);
......
......@@ -586,22 +586,22 @@ double data_obs::timediff(data_obs* data) const {
***************************************************************************/
int data_obs::median_odd(std::vector<data_obs*>* data){
median_odd_time(data);
median_time(data);
median_odd_data(data);
return(0);
}
int data_obs::median_odd_time(std::vector<data_obs*>* data){
int data_obs::median_time(std::vector<data_obs*>* data){
if (data->size() % 2 == 0){
std::cerr << "Only odd number of points possible!" << std::endl;
return(-1);
}
std::nth_element(data->begin(),data->begin()+data->size()/2,data->end());
// if (data->size() % 2 == 0){
// std::cerr << "Only odd number of points possible!" << std::endl;
// return(-1);
// }
// Return the center time.
// TODO Take average of center samples when even number of data points
this->set_time(data->at(data->size()/2));
return(0);
......@@ -653,7 +653,7 @@ int data_obs::median_odd_data(std::vector <data_obs*>* data){
int data_obs::filter_fir_sym(std::vector <data_obs*>* data,
std::vector <double>* win){
filter_fir_sym_time(data);
median_time(data);
// TODO Code from data and supp can probably be shared
filter_fir_sym_data(data,win);
filter_fir_sym_supp(data,win);
......@@ -662,21 +662,6 @@ int data_obs::filter_fir_sym(std::vector <data_obs*>* data,
}
int data_obs::filter_fir_sym_time(std::vector <data_obs*>* data){
// if (data->size() % 2 == 0){
// std::cerr << "Only odd number of points possible!" << std::endl;
// return(-1);
// }
// Return the center time.
// TODO Take average of center samples when even number of data points
this->set_time(data->at(data->size()/2));
return(0);
}
int data_obs::filter_fir_sym_data(std::vector <data_obs*>* data,
std::vector <double>* win){
......
Supports Markdown
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