Commit 85121759 authored by Thomas Edwards's avatar Thomas Edwards
Browse files

cleaned up some debug printing, tweaked some logic

parent ad900b23
...@@ -416,8 +416,9 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in, ...@@ -416,8 +416,9 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
// -------------------------------------------------------------- // --------------------------------------------------------------
// Degbugging monitoring info // Degbugging monitoring info
// -------------------------------------------------------------- // --------------------------------------------------------------
std::cerr << "-----------------------------------" << std::endl; // std::cerr << "-----------------------------------" << std::endl;
std::cerr << "Latest timestamp: " << tofilter1.back()->get_sec() << "." << tofilter1.back()->get_msec() << " | "; // timestamp=tofilter1.back()->get_time("%Y-%m-%d %H:%M:%S",true);
// std::cerr << "Latest timestamp: " << timestamp << " | ";
// std::cerr << "No. Rec: " << tofilter1.size() << " | "; // std::cerr << "No. Rec: " << tofilter1.size() << " | ";
// std::cerr << "Elapsed time: "; // std::cerr << "Elapsed time: ";
// long long check_time_diff = (((time_block_info.back().start.tv_sec - time_block_info.front().start.tv_sec) * 1e9) + (time_block_info.back().start.tv_nsec - time_block_info.front().start.tv_nsec)); // long long check_time_diff = (((time_block_info.back().start.tv_sec - time_block_info.front().start.tv_sec) * 1e9) + (time_block_info.back().start.tv_nsec - time_block_info.front().start.tv_nsec));
...@@ -428,10 +429,7 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in, ...@@ -428,10 +429,7 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
// Assume we can run a filter every 16 blocks // Assume we can run a filter every 16 blocks
// std::cerr << "Filters: " << num_blocks/16 << std::endl; // std::cerr << "Filters: " << num_blocks/16 << std::endl;
std::cerr << "Elapsed time between blocks: " << elapsed_time_last_block << std::endl;
std::cerr << "Blocks since last check: " << round(elapsed_time_last_block/((1./16)*1e9)) << " | ";
total_blocks += round(elapsed_time_last_block/((1./16)*1e9)); total_blocks += round(elapsed_time_last_block/((1./16)*1e9));
std::cerr << "Assumed total blocks: " << total_blocks << " | ";
// std::cerr << "Filters: " << total_blocks/16. << std::endl; // std::cerr << "Filters: " << total_blocks/16. << std::endl;
// -------------------------------------------------------------- // --------------------------------------------------------------
...@@ -440,7 +438,7 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in, ...@@ -440,7 +438,7 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
// -------------------------------------------------------------- // --------------------------------------------------------------
// int check_blocks = check_time_diff/(1e9/16); // int check_blocks = check_time_diff/(1e9/16);
int check_filters = total_blocks/16; int check_filters = total_blocks/16;
std::cerr << "Check Filters: " << check_filters << std::endl; // std::cerr << "Check Filters: " << check_filters << std::endl;
// See if we can run at least one filter // See if we can run at least one filter
if (check_filters >= 1) { if (check_filters >= 1) {
// save information on how many points we need to drop later // save information on how many points we need to drop later
...@@ -448,7 +446,7 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in, ...@@ -448,7 +446,7 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
// Check if we have (8*(blocks) +/- 1) data in the filter que // Check if we have (8*(blocks) +/- 1) data in the filter que
time_block_check = 8*(total_blocks); time_block_check = 8*(total_blocks);
bool run_the_filter = ((tofilter1.size() <= (time_block_check + 1)) && (tofilter1.size() >= (time_block_check - 1))) && (check_filters >= 1); bool run_the_filter = ((tofilter1.size() <= (time_block_check + 1)) && (tofilter1.size() >= (time_block_check - 1))) && (check_filters >= 1);
std::cerr << "Data in que: " << tofilter1.size() << " | blocks*8: " << time_block_check << " | Run the filter?: " << run_the_filter << std::endl; // std::cerr << "Data in que: " << tofilter1.size() << " | blocks*8: " << time_block_check << " | Run the filter?: " << run_the_filter << std::endl;
while (run_the_filter) { while (run_the_filter) {
// std::cerr << "Run the filter! " << std::endl; // std::cerr << "Run the filter! " << std::endl;
// Try to just run as normal // Try to just run as normal
...@@ -460,8 +458,14 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in, ...@@ -460,8 +458,14 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
} catch (const std::out_of_range &oor) { } catch (const std::out_of_range &oor) {
// Use the time_block_check information to assume if we are over or under // Use the time_block_check information to assume if we are over or under
// this is just the +/- part, so we can expand or reduce the filter to match // this is just the +/- part, so we can expand or reduce the filter to match
int filter_jitter = time_block_check - tofilter1.size(); int filter_jitter = tofilter1.size() - time_block_check;
std::cerr << "OOR err, Filter Jitter: " << filter_jitter << std::endl; std::cerr << "-----------------------------------" << std::endl;
std::cerr << "Elapsed time between blocks: " << elapsed_time_last_block << std::endl;
std::cerr << "Blocks since last check: " << round(elapsed_time_last_block/((1./16)*1e9)) << " | ";
std::cerr << "Assumed total blocks: " << total_blocks << " | ";
timestamp=tofilter1.back()->get_time("%Y-%m-%d %H:%M:%S",true);
std::cerr << "Latest timestamp: " << timestamp << " | ";
std::cerr << "OOR err, Filter Jitter: " << filter_jitter << " | ";
// // DEBUG: Test the vector copy constructor // // DEBUG: Test the vector copy constructor
// std::vector <data_obs*> test_vec; // std::vector <data_obs*> test_vec;
...@@ -473,6 +477,7 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in, ...@@ -473,6 +477,7 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
filter1_slice = std::vector<data_obs*>(tofilter1.begin(), tofilter1.begin()+128+filter_jitter); filter1_slice = std::vector<data_obs*>(tofilter1.begin(), tofilter1.begin()+128+filter_jitter);
filter_data_temp->filter_fir_sym(&filter1_slice, filter1_win); filter_data_temp->filter_fir_sym(&filter1_slice, filter1_win);
points_to_drop = 8+filter_jitter; points_to_drop = 8+filter_jitter;
std::cerr << "points_to_drop: " << points_to_drop << std::endl;
} }
// Append this data to the queue for filter 2 // Append this data to the queue for filter 2
tofilter2.push_back(new data_obs_vector(filter_data_temp)); tofilter2.push_back(new data_obs_vector(filter_data_temp));
...@@ -489,7 +494,7 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in, ...@@ -489,7 +494,7 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
total_blocks--; total_blocks--;
time_block_check = 8*(total_blocks); time_block_check = 8*(total_blocks);
check_filters = total_blocks/16; check_filters = total_blocks/16;
std::cerr << "Filter blocks and data check (after filter): " << tofilter1.size() << " " << time_block_check << std::endl; // std::cerr << "Filter blocks and data check (after filter): " << tofilter1.size() << " " << time_block_check << std::endl;
run_the_filter = ((tofilter1.size() <= (time_block_check + 1)) && (tofilter1.size() >= (time_block_check - 1))) && (check_filters >= 1); run_the_filter = ((tofilter1.size() <= (time_block_check + 1)) && (tofilter1.size() >= (time_block_check - 1))) && (check_filters >= 1);
// // Drop the oldest block information // // Drop the oldest block information
......
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