1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 12:40:35 +00:00

Share flag --noshow_plots for non-interactive testing

This commit is contained in:
Carles Fernandez 2018-06-29 21:53:39 +02:00
parent 5e96e531e4
commit ccacc9fe3e
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
10 changed files with 39 additions and 36 deletions

View File

@ -47,7 +47,7 @@
#ifndef GNSS_SDR_GNUPLOT_I_H_ #ifndef GNSS_SDR_GNUPLOT_I_H_
#define GNSS_SDR_GNUPLOT_I_H_ #define GNSS_SDR_GNUPLOT_I_H_
#include <gflags/gflags.h>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <vector> #include <vector>
@ -61,6 +61,7 @@
#include <list> // for std::list #include <list> // for std::list
#include <sys/stat.h> #include <sys/stat.h>
DEFINE_bool(show_plots, true, "Show plots on screen. Disable for non-interactive testing.");
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__)
//defined for 32 and 64-bit environments //defined for 32 and 64-bit environments
@ -2089,19 +2090,19 @@ std::string Gnuplot::create_tmpfile(std::ofstream &tmp)
throw GnuplotException(except.str()); throw GnuplotException(except.str());
} }
// int mkstemp(char *name); // int mkstemp(char *name);
// shall replace the contents of the string pointed to by "name" by a unique // shall replace the contents of the string pointed to by "name" by a unique
// filename, and return a file descriptor for the file open for reading and // filename, and return a file descriptor for the file open for reading and
// writing. Otherwise, -1 shall be returned if no suitable file could be // writing. Otherwise, -1 shall be returned if no suitable file could be
// created. The string in template should look like a filename with six // created. The string in template should look like a filename with six
// trailing 'X' s; mkstemp() replaces each 'X' with a character from the // trailing 'X' s; mkstemp() replaces each 'X' with a character from the
// portable filename character set. The characters are chosen such that the // portable filename character set. The characters are chosen such that the
// resulting name does not duplicate the name of an existing file at the // resulting name does not duplicate the name of an existing file at the
// time of a call to mkstemp() // time of a call to mkstemp()
// //
// open temporary files for output // open temporary files for output
// //
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__)
if (_mktemp(name) == NULL) if (_mktemp(name) == NULL)

View File

@ -620,7 +620,7 @@ void ObsSystemTest::compute_pseudorange_error(
} }
g1.savetops("Pseudorange_error_" + signal_name); g1.savetops("Pseudorange_error_" + signal_name);
g1.savetopdf("Pseudorange_error_" + signal_name, 18); g1.savetopdf("Pseudorange_error_" + signal_name, 18);
g1.showonscreen(); // window output if (FLAGS_show_plots) g1.showonscreen(); // window output
} }
catch (const GnuplotException& ge) catch (const GnuplotException& ge)
{ {
@ -711,7 +711,7 @@ void ObsSystemTest::compute_carrierphase_error(
} }
g1.savetops("Carrier_phase_error_" + signal_name); g1.savetops("Carrier_phase_error_" + signal_name);
g1.savetopdf("Carrier_phase_error_" + signal_name, 18); g1.savetopdf("Carrier_phase_error_" + signal_name, 18);
g1.showonscreen(); // window output if (FLAGS_show_plots) g1.showonscreen(); // window output
} }
catch (const GnuplotException& ge) catch (const GnuplotException& ge)
{ {
@ -802,7 +802,7 @@ void ObsSystemTest::compute_doppler_error(
} }
g1.savetops("Doppler_error_" + signal_name); g1.savetops("Doppler_error_" + signal_name);
g1.savetopdf("Doppler_error_" + signal_name, 18); g1.savetopdf("Doppler_error_" + signal_name, 18);
g1.showonscreen(); // window output if (FLAGS_show_plots) g1.showonscreen(); // window output
} }
catch (const GnuplotException& ge) catch (const GnuplotException& ge)
{ {

View File

@ -336,7 +336,7 @@ int StaticPositionSystemTest::configure_receiver()
config->set_property("Channel.signal", "1C"); config->set_property("Channel.signal", "1C");
// Set Acquisition // Set Acquisition
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition"); config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition");
config->set_property("Acquisition_1C.item_type", "gr_complex"); config->set_property("Acquisition_1C.item_type", "gr_complex");
config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(coherent_integration_time_ms)); config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(coherent_integration_time_ms));
config->set_property("Acquisition_1C.threshold", std::to_string(threshold)); config->set_property("Acquisition_1C.threshold", std::to_string(threshold));
@ -347,6 +347,9 @@ int StaticPositionSystemTest::configure_receiver()
config->set_property("Acquisition_1C.tong_init_val", std::to_string(tong_init_val)); config->set_property("Acquisition_1C.tong_init_val", std::to_string(tong_init_val));
config->set_property("Acquisition_1C.tong_max_val", std::to_string(tong_max_val)); config->set_property("Acquisition_1C.tong_max_val", std::to_string(tong_max_val));
config->set_property("Acquisition_1C.tong_max_dwells", std::to_string(tong_max_dwells)); config->set_property("Acquisition_1C.tong_max_dwells", std::to_string(tong_max_dwells));
config->set_property("Acquisition_1C.dump", "false);
config->set_property("Acquisition_1C.dump_filename", "./acquisition");
config->set_property("Acquisition_1C.dump_channel", "1");
// Set Tracking // Set Tracking
config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_Tracking"); config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_Tracking");
@ -632,7 +635,7 @@ void StaticPositionSystemTest::print_results(const std::vector<double>& east,
g1.savetops("Position_test_2D"); g1.savetops("Position_test_2D");
g1.savetopdf("Position_test_2D", 18); g1.savetopdf("Position_test_2D", 18);
g1.showonscreen(); // window output if (FLAGS_show_plots) g1.showonscreen(); // window output
Gnuplot g2("points"); Gnuplot g2("points");
g2.set_title("3D precision"); g2.set_title("3D precision");
@ -653,7 +656,7 @@ void StaticPositionSystemTest::print_results(const std::vector<double>& east,
g2.savetops("Position_test_3D"); g2.savetops("Position_test_3D");
g2.savetopdf("Position_test_3D"); g2.savetopdf("Position_test_3D");
g2.showonscreen(); // window output if (FLAGS_show_plots) g2.showonscreen(); // window output
} }
catch (const GnuplotException& ge) catch (const GnuplotException& ge)
{ {

View File

@ -124,7 +124,7 @@ TEST(FFTLengthTest, MeasureExecutionTime)
g1.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2"); g1.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2");
g1.savetops("FFT_execution_times_extended"); g1.savetops("FFT_execution_times_extended");
g1.savetopdf("FFT_execution_times_extended", 18); g1.savetopdf("FFT_execution_times_extended", 18);
g1.showonscreen(); // window output if (FLAGS_show_plots) g1.showonscreen(); // window output
Gnuplot g2("linespoints"); Gnuplot g2("linespoints");
g2.set_title("FFT execution times for different lengths (up to 2^{14}=16384)"); g2.set_title("FFT execution times for different lengths (up to 2^{14}=16384)");
@ -136,7 +136,7 @@ TEST(FFTLengthTest, MeasureExecutionTime)
g2.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2"); g2.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2");
g2.savetops("FFT_execution_times"); g2.savetops("FFT_execution_times");
g2.savetopdf("FFT_execution_times", 18); g2.savetopdf("FFT_execution_times", 18);
g2.showonscreen(); // window output if (FLAGS_show_plots) g2.showonscreen(); // window output
} }
catch (const GnuplotException& ge) catch (const GnuplotException& ge)
{ {

View File

@ -209,7 +209,7 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid()
g1.savetops("Galileo_E1_acq_grid"); g1.savetops("Galileo_E1_acq_grid");
g1.savetopdf("Galileo_E1_acq_grid"); g1.savetopdf("Galileo_E1_acq_grid");
g1.showonscreen(); if (FLAGS_show_plots) g1.showonscreen();
} }
catch (const GnuplotException& ge) catch (const GnuplotException& ge)
{ {

View File

@ -67,7 +67,6 @@ DEFINE_int32(acq_test_fake_PRN, 33, "PRN number of a non-present satellite");
DEFINE_int32(acq_test_iterations, 1, "Number of iterations (same signal, different noise realization)"); DEFINE_int32(acq_test_iterations, 1, "Number of iterations (same signal, different noise realization)");
DEFINE_bool(plot_acq_test, false, "Plots results with gnuplot, if available"); DEFINE_bool(plot_acq_test, false, "Plots results with gnuplot, if available");
DEFINE_bool(show_plots, true, "Show plots on screen. Disable for non-interactive testing.");
// ######## GNURADIO BLOCK MESSAGE RECEVER ######### // ######## GNURADIO BLOCK MESSAGE RECEVER #########
class AcqPerfTest_msg_rx; class AcqPerfTest_msg_rx;

View File

@ -210,7 +210,7 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid()
g1.savetops("GPS_L1_acq_grid"); g1.savetops("GPS_L1_acq_grid");
g1.savetopdf("GPS_L1_acq_grid"); g1.savetopdf("GPS_L1_acq_grid");
g1.showonscreen(); if (FLAGS_show_plots) g1.showonscreen();
} }
catch (const GnuplotException &ge) catch (const GnuplotException &ge)
{ {

View File

@ -213,7 +213,7 @@ void GpsL2MPcpsAcquisitionTest::plot_grid()
g1.savetops("GPS_L2CM_acq_grid"); g1.savetops("GPS_L2CM_acq_grid");
g1.savetopdf("GPS_L2CM_acq_grid"); g1.savetopdf("GPS_L2CM_acq_grid");
g1.showonscreen(); if (FLAGS_show_plots) g1.showonscreen();
} }
catch (const GnuplotException &ge) catch (const GnuplotException &ge)
{ {

View File

@ -482,7 +482,7 @@ TEST_F(GpsL1CADllPllTrackingPullInTest, ValidationOfResults)
if (FLAGS_plot_detail_level >= 2) if (FLAGS_plot_detail_level >= 2)
{ {
Gnuplot g1("linespoints"); Gnuplot g1("linespoints");
g1.showonscreen(); // window output if (FLAGS_show_plots) g1.showonscreen(); // window output
g1.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, " + "PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); g1.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, " + "PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
g1.set_grid(); g1.set_grid();
g1.set_xlabel("Time [s]"); g1.set_xlabel("Time [s]");
@ -496,7 +496,7 @@ TEST_F(GpsL1CADllPllTrackingPullInTest, ValidationOfResults)
//g1.savetopdf("Correlators_outputs" + std::to_string(generator_CN0_values.at(current_cn0_idx)), 18); //g1.savetopdf("Correlators_outputs" + std::to_string(generator_CN0_values.at(current_cn0_idx)), 18);
Gnuplot g2("points"); Gnuplot g2("points");
g2.showonscreen(); // window output if (FLAGS_show_plots) g2.showonscreen(); // window output
g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
g2.set_grid(); g2.set_grid();
g2.set_xlabel("Inphase"); g2.set_xlabel("Inphase");
@ -519,7 +519,7 @@ TEST_F(GpsL1CADllPllTrackingPullInTest, ValidationOfResults)
g3.set_legend(); g3.set_legend();
//g3.savetops("CN0_output"); //g3.savetops("CN0_output");
//g3.savetopdf("CN0_output", 18); //g3.savetopdf("CN0_output", 18);
g3.showonscreen(); // window output if (FLAGS_show_plots) g3.showonscreen(); // window output
} }
} }
catch (const GnuplotException& ge) catch (const GnuplotException& ge)
@ -568,6 +568,6 @@ TEST_F(GpsL1CADllPllTrackingPullInTest, ValidationOfResults)
g4.set_legend(); g4.set_legend();
g4.savetops("trk_pull_in_grid_" + std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx))))); g4.savetops("trk_pull_in_grid_" + std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))));
g4.savetopdf("trk_pull_in_grid_" + std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))), 12); g4.savetopdf("trk_pull_in_grid_" + std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))), 12);
g4.showonscreen(); // window output if (FLAGS_show_plots) g4.showonscreen(); // window output
} }
} }

View File

@ -795,7 +795,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++) for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
{ {
Gnuplot g1("linespoints"); Gnuplot g1("linespoints");
g1.showonscreen(); // window output if (FLAGS_show_plots) g1.showonscreen(); // window output
g1.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, " + "PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); g1.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, " + "PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
g1.set_grid(); g1.set_grid();
g1.set_xlabel("Time [s]"); g1.set_xlabel("Time [s]");
@ -809,7 +809,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
g1.savetopdf("Correlators_outputs" + std::to_string(generator_CN0_values.at(current_cn0_idx)), 18); g1.savetopdf("Correlators_outputs" + std::to_string(generator_CN0_values.at(current_cn0_idx)), 18);
} }
Gnuplot g2("points"); Gnuplot g2("points");
g2.showonscreen(); // window output if (FLAGS_show_plots) g2.showonscreen(); // window output
g2.set_multiplot(ceil(static_cast<float>(generator_CN0_values.size()) / 2.0), g2.set_multiplot(ceil(static_cast<float>(generator_CN0_values.size()) / 2.0),
ceil(static_cast<float>(generator_CN0_values.size()) / 2)); ceil(static_cast<float>(generator_CN0_values.size()) / 2));
for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++) for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
@ -840,7 +840,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
g3.set_legend(); g3.set_legend();
g3.savetops("CN0_output"); g3.savetops("CN0_output");
g3.savetopdf("CN0_output", 18); g3.savetopdf("CN0_output", 18);
g3.showonscreen(); // window output if (FLAGS_show_plots) g3.showonscreen(); // window output
} }
//PLOT ERROR FIGURES (only if it is used the signal generator) //PLOT ERROR FIGURES (only if it is used the signal generator)
@ -849,7 +849,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
if (FLAGS_plot_detail_level >= 1) if (FLAGS_plot_detail_level >= 1)
{ {
Gnuplot g5("points"); Gnuplot g5("points");
g5.showonscreen(); // window output if (FLAGS_show_plots) g5.showonscreen(); // window output
g5.set_title("Code delay error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); g5.set_title("Code delay error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
g5.set_grid(); g5.set_grid();
g5.set_xlabel("Time [s]"); g5.set_xlabel("Time [s]");
@ -874,7 +874,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
Gnuplot g6("points"); Gnuplot g6("points");
g6.showonscreen(); // window output if (FLAGS_show_plots) g6.showonscreen(); // window output
g6.set_title("Accumulated carrier phase error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); g6.set_title("Accumulated carrier phase error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
g6.set_grid(); g6.set_grid();
g6.set_xlabel("Time [s]"); g6.set_xlabel("Time [s]");
@ -898,7 +898,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
g6.savetopdf("Carrier_phase_error_output", 18); g6.savetopdf("Carrier_phase_error_output", 18);
Gnuplot g4("points"); Gnuplot g4("points");
g4.showonscreen(); // window output if (FLAGS_show_plots) g4.showonscreen(); // window output
g4.set_multiplot(ceil(static_cast<float>(generator_CN0_values.size()) / 2.0), g4.set_multiplot(ceil(static_cast<float>(generator_CN0_values.size()) / 2.0),
ceil(static_cast<float>(generator_CN0_values.size()) / 2)); ceil(static_cast<float>(generator_CN0_values.size()) / 2));
for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values_sweep_copy.at(config_idx).size(); current_cn0_idx++) for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values_sweep_copy.at(config_idx).size(); current_cn0_idx++)
@ -942,7 +942,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
//plot metrics //plot metrics
Gnuplot g7("linespoints"); Gnuplot g7("linespoints");
g7.showonscreen(); // window output if (FLAGS_show_plots) g7.showonscreen(); // window output
g7.set_title("Doppler error metrics (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); g7.set_title("Doppler error metrics (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
g7.set_grid(); g7.set_grid();
g7.set_xlabel("CN0 [dB-Hz]"); g7.set_xlabel("CN0 [dB-Hz]");