Exemplo n.º 1
0
 def run(self):
     self.ping = os.popen('ping' + paramPing + self.host).read()
     nqmWlan = calcNQM(getDelay(onlyTimes(self.ping)),
                       getJitter(onlyTimes(self.ping)),
                       getPacketsLoss(onlyPackets(self.ping)))
     avg = mediaNQM(nqmWlan)
     self.queue.put(avg)
    
    config = json.load(f)
    measurements = config["measurements"]
    for measurement in measurements:
        print("--------------------- PATH LOSS MODEL {} ---------------------".format(measurement))
        output_fig_pgf = os.path.join(
            input_path, 'path_loss_{}.{}'.format(measurement, OUTPUT_IMG_FORMAT))
        CENTER = config[measurement]["center"]
        #d0 = config[measurement]["d0"]
        #pl0 = config[measurement]["pl0"]

        input_file_path = os.path.join(
            input_path, measurement, input_file_name)

        df = pd.read_pickle(input_file_path)
        df = util.onlyPackets(df)

        d0 = 1

        df = df[df.distance > d0]
        df['distance_log'] = 10*np.log10(df.distance/d0)
        
        # df[(df["distance"] < 105) & (df["distance"] > 100)]
        results = smf.ols('pl_db ~ distance_log', data=df).fit()
        print(print(results.summary()))

        fig = plt.figure(figsize=(4, 3))
        ax = fig.add_subplot(1, 1, 1)

        slope, intercept, r_value, p_value, std_err = stats.linregress(
            df['distance_log'], df['pl_db'])
Exemplo n.º 3
0
input_file_name = "preprocessed_data.pkl"

with open(os.path.join(processing_path, "conf.json")) as config_file:
    config_plot = json.load(config_file)["heatmap"]
    grid_size = config_plot["grid_size"]
    plot_snr = config_plot["plot_snr"]
    plot_rss = config_plot["plot_rss"]

    with open(os.path.join(path_to_measurements, "measurements.json")) as f:
        config_measurement = json.load(f)
        measurements = config_measurement["measurements"]
        for measurement in measurements:
            print("--------------------- HEATMAP {} ---------------------".
                  format(measurement))
            #num_bins = config_measurement[measurement]["freq_samples_bins"]
            input_file_path = os.path.join(input_path, measurement,
                                           input_file_name)
            for_map = pd.read_pickle(input_file_path)
            for_map = util.onlyPackets(for_map)

            #dist_in_bins = pd.cut(x=for_map.distance, bins=num_bins)
            #rss_in_bins = pd.cut(x=for_map.rssi, bins=num_bins)
            #
            #ax = sns.heatmap(for_map.pivot_table("distance", "rssi"))
            #plt.show()
            #
            #sns.distplot(for_map.rssi)
            sns.jointplot(x=for_map.distance, y=for_map.rssi, kind="hex")
            plt.show()
            print("--------------------- DONE HEATMAP ---------------------")