time_diffs = numpy.ma.array(time_diffs, mask = mask).compressed() clock_drifts_deriv = differences / time_diffs logging.info("Plotting") error_histogram = plt.figure().add_subplot(1, 1, 1) mu, sigma, outliers = matplotlib_settings.plot_hist(error_histogram, all_errors, arguments.outlier_threshold) print("Mean: {}".format(mu)) print("Sigma: {}".format(sigma)) print("Outlier probability: {}".format(outliers)) error_histogram.set_title('Measurement errors') error_histogram.set_xlabel(r'Error/\si{\meter}') error_histogram.set_ylabel(r'Count') matplotlib_settings.maybe_save_plot(error_histogram, arguments.save_pseudorange_histogram) fig2 = plt.figure() velocity_error_histogram = fig2.add_subplot(1, 1, 1) mu, sigma, outliers = matplotlib_settings.plot_hist(velocity_error_histogram, all_velocity_errors, arguments.velocity_outlier_threshold) print("Velocity mean: {}".format(mu)) print("Velocity sigma: {}".format(sigma)) print("Outlier probability: {}".format(outliers)) velocity_error_histogram.set_title('Velocity errors') velocity_error_histogram.set_xlabel(r'Error/\si{\meter\per\second}') velocity_error_histogram.set_ylabel(r'Count') matplotlib_settings.maybe_save_plot(velocity_error_histogram, arguments.save_velocity_histogram)
logging.info("Plotting") error_plot = plt.figure().add_subplot(1, 1, 1) error_plot.scatter( times[:: arguments.plot_thinning], errors[:: arguments.plot_thinning], marker=".", s=40, alpha=0.7, edgecolors="none", rasterized=True, ) error_plot.set_title("Measurement errors for SV {}".format(sv_id)) error_plot.set_xlabel(r"Time/\si{\second}") error_plot.set_ylabel(r"Error/\si{\meter}") matplotlib_settings.maybe_save_plot(error_plot, arguments.save_pseudorange_errors) error_histogram = plt.figure().add_subplot(1, 1, 1) mu, sigma, offsets = matplotlib_settings.plot_hist(error_histogram, errors, arguments.outlier_threshold) print("Mean: {}".format(mu)) print("Sigma: {}".format(sigma)) error_histogram.set_title("Measurement errors for SV {}".format(sv_id)) error_histogram.set_xlabel(r"Error/\si{\meter}") error_histogram.set_ylabel(r"Count") drifts_plot = plt.figure().add_subplot(1, 1, 1) drifts_plot.plot(times[:: arguments.plot_thinning], clock_drifts[:: arguments.plot_thinning], "-", alpha=0.7) drifts_plot.set_title("Receiver clock drifts for SV {}".format(sv_id)) drifts_plot.set_xlabel(r"Time/\si{\second}") drifts_plot.set_ylabel(r"Drift/\si{\meter\per\second}") matplotlib_settings.common_plot_settings(drifts_plot, set_limits=False)
errors = data['errors'][::arguments.plot_thinning] clock_offsets = data['clock_offsets'][::arguments.plot_thinning] clock_drifts = data['clock_drifts'][::arguments.plot_thinning] errors -= clock_offsets velocity_errors = data['velocity_errors'][::arguments.plot_thinning] velocity_errors -= clock_drifts logging.info("Plotting") error_plot = plt.figure().add_subplot(1, 1, 1) error_plot.scatter(times, errors, c=sv_ids, marker='.', s=40, alpha=0.7, edgecolors='none', rasterized=True) error_plot.set_title('Measurement errors') error_plot.set_xlabel(r'Time/\si{\second}') error_plot.set_ylabel(r'Error/\si{\meter}') matplotlib_settings.maybe_save_plot(error_plot, arguments.save_pseudorange_errors) error_histogram = plt.figure().add_subplot(1, 1, 1) mu, sigma, outliers = matplotlib_settings.plot_hist(error_histogram, errors, arguments.outlier_threshold) print("Mean: {}".format(mu)) print("Sigma: {}".format(sigma)) error_histogram.set_title('Measurement errors') error_histogram.set_xlabel(r'Error/\si{\meter}') error_histogram.set_ylabel(r'Count') matplotlib_settings.maybe_save_plot(error_histogram, arguments.save_pseudorange_histogram) drifts_plot = plt.figure().add_subplot(1, 1, 1) drifts_plot.plot(times, clock_drifts, '-', alpha=0.7)
logging.basicConfig( format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s", level = logging.INFO ) arg_parser = argparse.ArgumentParser( description="Plot clock offsets from the preprocessed data.") arg_parser.add_argument('fixes', help="Data obtained from clock_offsets_to_numpy.py") arg_parser.add_argument('--no-show', action='store_true', help="Don't show the plots, only save them.") arg_parser.add_argument('--save-plot', default=None, help="Filename, optionally followed by comma separated (x0, y0, x1, y1) coordinates.") arguments = arg_parser.parse_args() logging.info("Retreiving fixes") data = numpy.load(arguments.fixes) logging.info("Plotting") plot = plt.figure().add_subplot(1, 1, 1) plot.plot(data['times'], data['clock_offsets'] / gps.measurement_error.C, alpha=0.7, rasterized=True) plot.set_title('Clock offsets') plot.set_xlabel(r'Time/\si{\second}') plot.set_ylabel(r'Clock offset/\si{\second}') matplotlib_settings.maybe_save_plot(plot, arguments.save_plot) if not arguments.no_show: plt.show()