def interd_quiet_grids(): graphs.GRAPH_OUTPUT_FORMAT = 'png' def init_simwrap(): sim = SimWrap(ctrl, p, cdict, pdict); sim.set_all_nodisp() sim.TO_show_clusters = False sim.ctrl.saveall = False return sim def graph_mods(): ax.set_xlabel('Meters') ax.set_ylabel('Meters') ax.set_aspect('equal') # Random grid graphs.change_fontsize(graphs.FONTSIZE + 2) ctrl, p, cdict, pdict = dec_grids() ctrl.quiet_selection = 'random' ctrl.quiet_nodes = ctrl.nodecount - 5 ctrl.steps = 1 sim = init_simwrap() with warnings.catch_warnings(): warnings.filterwarnings("ignore") sim.simulate() ax = graphs.spatial_grid(ctrl, unit='m', s=12, show_broadcast=True) graph_mods() graphs.save('interd_grid_random') graphs.show() # cluster grid ctrl, p, cdict, pdict = dec_grids() ctrl.quiet_selection = 'kmeans' ctrl.quiet_nodes = ctrl.nodecount - 5 ctrl.steps = 1 sim = init_simwrap() with warnings.catch_warnings(): warnings.filterwarnings("ignore") sim.simulate() ax = graphs.spatial_grid(ctrl, unit='m', s=12, show_broadcast=True) graph_mods() graphs.save('interd_grid_kmeans') graphs.show() # sensing grid ctrl, p, cdict, pdict = dec_grids() ctrl.quiet_selection = 'contention' ctrl.steps = 40 sim = SimWrap(ctrl, p, cdict, pdict); sim.TO_show_clusters = False sim.ctrl.saveall = False with warnings.catch_warnings(): warnings.filterwarnings("ignore") sim.simulate() ax = graphs.spatial_grid(ctrl, unit='m', s=12, show_broadcast=True) graph_mods() graphs.save('interd_grid_sensing') graphs.show()
def zero_padded_crosscorr(): fontsize_tmp = graphs.FONTSIZE graphs.change_fontsize(15) p = pinit64_no_pulse_shape() ax = graphs.crosscorr(p, savename='latex_figures/discrete_crosscorr'); graphs.show() graphs.change_fontsize(fontsize_tmp) return ax
def thesis_cavg_vs_noise(): # 150 sample per point alldates = db.fetch_dates([20160830143035701, 20160830162947428]) # zc vs noise_power dates = [alldates[0], alldates[-1]] graphs.change_fontsize(15) ax = graphs.scatter_range(dates, ['noise_power', 'good_link_ratio'], color='b') ax.set_xlabel("Noise Power (dBm)") ax.set_ylabel("$C$") #ax.set_ylim((0.25,0.85)) graphs.save('latex_figures/thesis_cavg_vs_noise')
def thesis_cavg_vs_zc(): # 150 sample per point alldates = db.fetch_dates([20160825232333852, 20160826024432633]) # cavg vs zclen dates = [alldates[0], alldates[-1]] graphs.change_fontsize(15) ax = graphs.scatter_range(dates, ['zc_len', 'good_link_ratio'], color='b') ax.set_xlabel("Length of ZC sequence $N$") ax.set_ylabel("$C$") ax.set_ylim((0.25,0.85)) graphs.save('latex_figures/thesis_cavg_vs_zc')
def interd_cavg_vs_nodecount(): # 150 sample per point graphs.GRAPH_OUTPUT_FORMAT = 'png' graphs.change_fontsize(graphs.FONTSIZE + 2) alldates = db.fetch_dates([20160825101515414, 20160825135628487]) # cavg vs nodecount dates = [alldates[0], alldates[-1]] ax = graphs.scatter_range(dates, ['nodecount', 'good_link_ratio'], color='k') ax.set_xlabel("Number of nodes $M$") ax.set_ylabel("$C$") graphs.save('interd_cavg_vs_nodecount') graphs.show()
def thesis_cavg_vs_nodecount(): # 180 sample per point alldates = db.fetch_dates([20160824001859759, 20160824034043274]) # nodecount vs cavg dates = [alldates[0], alldates[-1]] graphs.change_fontsize(15) ax = graphs.scatter_range(dates, ['nodecount', 'good_link_ratio'], color='b') ax.set_xlabel("Number of nodes $M$") ax.set_ylabel("$C$") ax.set_ylim((0.37,0.92)) graphs.save('latex_figures/thesis_cavg_vs_nodecount')
def thesis_cavg_vs_distance(): # 180 sample per point alldates = db.fetch_dates([20160824125623027, 20160824143207623]) # dist vs cavg alldates += db.fetch_dates([20160824155429863, 20160824170025866]) # dist vs cavg (extra) dates = [alldates[0], alldates[-1]] graphs.change_fontsize(15) ax = graphs.scatter_range(dates, ['max_dist_from_origin', 'good_link_ratio'], color='b') ax.set_xlabel("Side of square area (Meters)") ax.set_ylabel("$C$") tick_locs = [500,750,1000,1250,1500] tick_lbls = list(map(str, tick_locs)) ax.set_xticks(tick_locs)#, minor=False) ax.set_xticklabels(tick_lbls) graphs.save('latex_figures/thesis_cavg_vs_distance')
def interd_compare_quiet(): graphs.GRAPH_OUTPUT_FORMAT = 'png' graphs.change_fontsize(graphs.FONTSIZE + 2) alldates = db.fetch_dates([20160822172521531, 20160822215536865]) # 960sims quiet compare dates = [alldates[0], alldates[-1]] labels = [] labels.append('Random') labels.append('Clustering') labels.append('Sensing') ax = graphs.scatter_range(dates, ['max_dist_from_origin', 'good_link_ratio'], multiplot='quiet_selection', legend_labels=labels); ax.set_xlabel("Side of square area (m)") ax.set_ylabel("$C$") graphs.save('interd_compare_quiet') graphs.show()
def interd_compare_r12(): graphs.change_fontsize(graphs.FONTSIZE + 2) ctrl, p, cdict, pdict = dec_dpll() sim = SimWrap(ctrl, p, cdict, pdict) sim.TO_show_clusters = False sim.ctrl.saveall = False sim.simulate() sim.post_sim_plots(save_TO='dpll_theta_evol') ctrl, p, cdict, pdict = dec_r12() sim = SimWrap(ctrl, p, cdict, pdict) sim.TO_show_clusters = False sim.ctrl.saveall = False sim.simulate() sim.post_sim_plots(save_TO='r12_theta_evol')
def interd_dpll_vs_r12(): # 150 sample per point graphs.GRAPH_OUTPUT_FORMAT = 'png' graphs.change_fontsize(graphs.FONTSIZE + 2) alldates = db.fetch_dates([20160828200017740, 20160828205450849]) # r12 vs dpll dates = [alldates[0], alldates[-1]] labels = [] labels.append('R12') labels.append('DPLL') ax = graphs.scatter_range(dates, ['nodecount', 'good_link_ratio'], multiplot='peak_detect', legend_labels=labels) ax.set_xlabel("Number of nodes (M)") ax.set_ylabel("$C$") graphs.save('interd_dpll_vs_r12') graphs.show()
def interd_cavg_vs_distance(): # 150 sample per point graphs.GRAPH_OUTPUT_FORMAT = 'png' graphs.change_fontsize(graphs.FONTSIZE + 2) alldates = db.fetch_dates([20160825141108531, 20160825183253474]) # cavg vs dist dates = [alldates[0], alldates[-1]] ax = graphs.scatter_range(dates, ['max_dist_from_origin', 'good_link_ratio'], color='k') ax.set_xlabel("Side of square area (Meters)") ax.set_ylabel("$C$") tick_locs = [500,750,1000,1250,1500] tick_lbls = list(map(str, tick_locs)) ax.set_xticks(tick_locs)#, minor=False) ax.set_xticklabels(tick_lbls) graphs.save('interd_cavg_vs_distance') graphs.show()
def interd_dpll_final_compare(): #alldates = db.fetch_dates([20160829122809568, 20160829152128098]) # plain dpll vs contention graphs.GRAPH_OUTPUT_FORMAT = 'png' graphs.change_fontsize(15) alldates = db.fetch_dates([20160828200017740, 20160828205450849]) # r12 vs dpll dates = [alldates[0], alldates[-1]] #extra ( add to scatter_range) #sens_dates = db.fetch_dates([20160829122809568, 20160829152128098]) # plain dpll vs contention #new_fetch_dict = {'date':sens_dates, 'quiet_selection':['contention']} #raw_data = db.fetch_matching(new_fetch_dict, collist) #datalist.append(np.array(raw_data)) #labels.append('Sensing') labels = [] labels.append('R12') labels.append('DPLL') labels.append('DPLL-S') ax = graphs.scatter_range(dates, ['nodecount', 'good_link_ratio'], multiplot='peak_detect', legend_labels=labels) ax.set_xlabel("Number of nodes (M)") ax.set_ylabel("$C$") graphs.save('interd_dpll_final_compare') graphs.show()
def highlited_regimes(): """Highlights the converging vs the drift regime""" compare_fontsize = 15 compare_aspect=12 props = dict(boxstyle='round', facecolor='wheat', alpha=0.5) fontsize_tmp = graphs.FONTSIZE def run_hair_graph(aspect='auto'): hair_kwargs = {'y_label':r'$\theta_i$ $(T_0)$', 'show_clusters':False, 'savename':''} hair_args = ( (ctrl.sample_inter , ctrl.theta_inter, ctrl), hair_kwargs, ) ax = graphs.hair(*hair_args[0], **hair_args[1]) ax.set_aspect(aspect) return ax # DRIFT REGIME graphs.change_fontsize(compare_fontsize) ctrl, p, cdict, pdict = dec_sample_theta() sim = SimWrap(ctrl, p, cdict, pdict) sim.conv_min_slope_samples = 15 sim.ctrl.keep_intermediate_values = True sim.simulate() ax = run_hair_graph(aspect=compare_aspect) ax.text(0.85, 0.9, 'No DC', transform=ax.transAxes, fontsize=compare_fontsize, verticalalignment='top', bbox=props) xmid = 12 xmax = ctrl.steps-13 xmin = 0 ymin, ymax = ax.get_ylim() ya = ymin-0.06 ax.set_xlim([xmin,xmax]) ax.set_ylim([ya,ymax]) fname = 'latex_figures/init_theta' graphs.save(fname) graphs.show() del ax graphs.change_fontsize(15) ax = run_hair_graph() # Draw biarrows ax.annotate('', xy=(xmid, ya), xycoords='data', xytext=(xmin, ya), textcoords='data', arrowprops=dict(arrowstyle="<->")) ax.annotate('', xy=(xmax, ya), xycoords='data', xytext=(xmid, ya), textcoords='data', arrowprops=dict(arrowstyle="<->")) ax.plot([xmid, xmid], [ya-1, ymax], 'k--') # text ax.text(xmid/2, ya, 'Transient', ha='center', va='bottom' ) ax.text((xmax-xmid)/2 +xmid, ya, 'Drifting', ha='center', va='bottom' ) ax.set_xlim([xmin,xmax]) ax.set_ylim([ya-0.03,ymax]) fname = 'latex_figures/highlighted_regimes' graphs.save(fname) graphs.show() # THETA EXAMPLE graphs.change_fontsize(compare_fontsize) ctrl, p, cdict, pdict = dec_sample_theta() ctrl.prop_correction = True sim = SimWrap(ctrl, p, cdict, pdict) sim.conv_min_slope_samples = 15 sim.ctrl.keep_intermediate_values = True sim.show_CFO = False sim.show_TO = False sim.make_cat = False sim.simulate() ax = run_hair_graph(aspect=compare_aspect) ax.text(0.85, 0.9, 'Q = 7', transform=ax.transAxes, fontsize=compare_fontsize, verticalalignment='top', bbox=props) ax.set_xlim([xmin,xmax]) ax.set_ylim([ya,ymax]) fname = 'latex_figures/example_theta' graphs.save(fname) graphs.show() # THETA EXAMPLE with Q=14 graphs.change_fontsize(compare_fontsize) ctrl, p, cdict, pdict = dec_sample_theta() ctrl.prop_correction = True ctrl.pc_b, ctrl.pc_a = lib.hipass_avg(14) sim = SimWrap(ctrl, p, cdict, pdict) sim.conv_min_slope_samples = 15 sim.ctrl.keep_intermediate_values = True sim.show_CFO = False sim.show_TO = False sim.make_cat = False sim.simulate() ax = run_hair_graph(aspect=compare_aspect) ax.text(0.85, 0.9, 'Q = 14', transform=ax.transAxes, fontsize=compare_fontsize, verticalalignment='top', bbox=props) ax.set_xlim([xmin,xmax]) ax.set_ylim([ya,ymax]) fname = 'latex_figures/example_theta_q14' graphs.save(fname) graphs.show() graphs.change_fontsize(fontsize_tmp)