mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-31 07:13:03 +00:00 
			
		
		
		
	Share flag --noshow_plots for non-interactive testing
This commit is contained in:
		| @@ -47,7 +47,7 @@ | ||||
| #ifndef GNSS_SDR_GNUPLOT_I_H_ | ||||
| #define GNSS_SDR_GNUPLOT_I_H_ | ||||
|  | ||||
|  | ||||
| #include <gflags/gflags.h> | ||||
| #include <iostream> | ||||
| #include <string> | ||||
| #include <vector> | ||||
| @@ -61,6 +61,7 @@ | ||||
| #include <list>  // for std::list | ||||
| #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__) | ||||
| //defined for 32 and 64-bit environments | ||||
|   | ||||
| @@ -620,7 +620,7 @@ void ObsSystemTest::compute_pseudorange_error( | ||||
|                                 } | ||||
|                             g1.savetops("Pseudorange_error_" + signal_name); | ||||
|                             g1.savetopdf("Pseudorange_error_" + signal_name, 18); | ||||
|                             g1.showonscreen();  // window output | ||||
|                             if (FLAGS_show_plots) g1.showonscreen();  // window output | ||||
|                         } | ||||
|                     catch (const GnuplotException& ge) | ||||
|                         { | ||||
| @@ -711,7 +711,7 @@ void ObsSystemTest::compute_carrierphase_error( | ||||
|                                 } | ||||
|                             g1.savetops("Carrier_phase_error_" + signal_name); | ||||
|                             g1.savetopdf("Carrier_phase_error_" + signal_name, 18); | ||||
|                             g1.showonscreen();  // window output | ||||
|                             if (FLAGS_show_plots) g1.showonscreen();  // window output | ||||
|                         } | ||||
|                     catch (const GnuplotException& ge) | ||||
|                         { | ||||
| @@ -802,7 +802,7 @@ void ObsSystemTest::compute_doppler_error( | ||||
|                                 } | ||||
|                             g1.savetops("Doppler_error_" + signal_name); | ||||
|                             g1.savetopdf("Doppler_error_" + signal_name, 18); | ||||
|                             g1.showonscreen();  // window output | ||||
|                             if (FLAGS_show_plots) g1.showonscreen();  // window output | ||||
|                         } | ||||
|                     catch (const GnuplotException& ge) | ||||
|                         { | ||||
|   | ||||
| @@ -336,7 +336,7 @@ int StaticPositionSystemTest::configure_receiver() | ||||
|             config->set_property("Channel.signal", "1C"); | ||||
|  | ||||
|             // 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.coherent_integration_time_ms", std::to_string(coherent_integration_time_ms)); | ||||
|             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_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.dump", "false); | ||||
|             config->set_property("Acquisition_1C.dump_filename", "./acquisition"); | ||||
|             config->set_property("Acquisition_1C.dump_channel", "1"); | ||||
|  | ||||
|             // Set 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.savetopdf("Position_test_2D", 18); | ||||
|                     g1.showonscreen();  // window output | ||||
|                     if (FLAGS_show_plots) g1.showonscreen();  // window output | ||||
|  | ||||
|                     Gnuplot g2("points"); | ||||
|                     g2.set_title("3D precision"); | ||||
| @@ -653,7 +656,7 @@ void StaticPositionSystemTest::print_results(const std::vector<double>& east, | ||||
|  | ||||
|                     g2.savetops("Position_test_3D"); | ||||
|                     g2.savetopdf("Position_test_3D"); | ||||
|                     g2.showonscreen();  // window output | ||||
|                     if (FLAGS_show_plots) g2.showonscreen();  // window output | ||||
|                 } | ||||
|             catch (const GnuplotException& ge) | ||||
|                 { | ||||
|   | ||||
| @@ -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.savetops("FFT_execution_times_extended"); | ||||
|                             g1.savetopdf("FFT_execution_times_extended", 18); | ||||
|                             g1.showonscreen();  // window output | ||||
|                             if (FLAGS_show_plots) g1.showonscreen();  // window output | ||||
|  | ||||
|                             Gnuplot g2("linespoints"); | ||||
|                             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.savetops("FFT_execution_times"); | ||||
|                             g2.savetopdf("FFT_execution_times", 18); | ||||
|                             g2.showonscreen();  // window output | ||||
|                             if (FLAGS_show_plots) g2.showonscreen();  // window output | ||||
|                         } | ||||
|                     catch (const GnuplotException& ge) | ||||
|                         { | ||||
|   | ||||
| @@ -209,7 +209,7 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid() | ||||
|  | ||||
|                     g1.savetops("Galileo_E1_acq_grid"); | ||||
|                     g1.savetopdf("Galileo_E1_acq_grid"); | ||||
|                     g1.showonscreen(); | ||||
|                     if (FLAGS_show_plots) g1.showonscreen(); | ||||
|                 } | ||||
|             catch (const GnuplotException& ge) | ||||
|                 { | ||||
|   | ||||
| @@ -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_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 ######### | ||||
| class AcqPerfTest_msg_rx; | ||||
|   | ||||
| @@ -210,7 +210,7 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid() | ||||
|  | ||||
|                     g1.savetops("GPS_L1_acq_grid"); | ||||
|                     g1.savetopdf("GPS_L1_acq_grid"); | ||||
|                     g1.showonscreen(); | ||||
|                     if (FLAGS_show_plots) g1.showonscreen(); | ||||
|                 } | ||||
|             catch (const GnuplotException &ge) | ||||
|                 { | ||||
|   | ||||
| @@ -213,7 +213,7 @@ void GpsL2MPcpsAcquisitionTest::plot_grid() | ||||
|  | ||||
|                     g1.savetops("GPS_L2CM_acq_grid"); | ||||
|                     g1.savetopdf("GPS_L2CM_acq_grid"); | ||||
|                     g1.showonscreen(); | ||||
|                     if (FLAGS_show_plots) g1.showonscreen(); | ||||
|                 } | ||||
|             catch (const GnuplotException &ge) | ||||
|                 { | ||||
|   | ||||
| @@ -482,7 +482,7 @@ TEST_F(GpsL1CADllPllTrackingPullInTest, ValidationOfResults) | ||||
|                                                     if (FLAGS_plot_detail_level >= 2) | ||||
|                                                         { | ||||
|                                                             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_grid(); | ||||
|                                                             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); | ||||
|  | ||||
|                                                             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_grid(); | ||||
|                                                             g2.set_xlabel("Inphase"); | ||||
| @@ -519,7 +519,7 @@ TEST_F(GpsL1CADllPllTrackingPullInTest, ValidationOfResults) | ||||
|                                                             g3.set_legend(); | ||||
|                                                             //g3.savetops("CN0_output"); | ||||
|                                                             //g3.savetopdf("CN0_output", 18); | ||||
|                                                             g3.showonscreen();  // window output | ||||
|                                                             if (FLAGS_show_plots) g3.showonscreen();  // window output | ||||
|                                                         } | ||||
|                                                 } | ||||
|                                             catch (const GnuplotException& ge) | ||||
| @@ -568,6 +568,6 @@ TEST_F(GpsL1CADllPllTrackingPullInTest, ValidationOfResults) | ||||
|             g4.set_legend(); | ||||
|             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.showonscreen();  // window output | ||||
|             if (FLAGS_show_plots) g4.showonscreen();  // window output | ||||
|         } | ||||
| } | ||||
|   | ||||
| @@ -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++) | ||||
|                                                 { | ||||
|                                                     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_grid(); | ||||
|                                                     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); | ||||
|                                                 } | ||||
|                                             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), | ||||
|                                                 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++) | ||||
| @@ -840,7 +840,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) | ||||
|                                             g3.set_legend(); | ||||
|                                             g3.savetops("CN0_output"); | ||||
|                                             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) | ||||
| @@ -849,7 +849,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) | ||||
|                                             if (FLAGS_plot_detail_level >= 1) | ||||
|                                                 { | ||||
|                                                     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_grid(); | ||||
|                                                     g5.set_xlabel("Time [s]"); | ||||
| @@ -874,7 +874,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) | ||||
|  | ||||
|  | ||||
|                                                     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_grid(); | ||||
|                                                     g6.set_xlabel("Time [s]"); | ||||
| @@ -898,7 +898,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) | ||||
|                                                     g6.savetopdf("Carrier_phase_error_output", 18); | ||||
|  | ||||
|                                                     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), | ||||
|                                                         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++) | ||||
| @@ -942,7 +942,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) | ||||
|                             //plot metrics | ||||
|  | ||||
|                             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_grid(); | ||||
|                             g7.set_xlabel("CN0 [dB-Hz]"); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Carles Fernandez
					Carles Fernandez