def display(oneSimulation,pathString ,saveOnly=True): ''' show/save figures ''' self = oneSimulation pylab.rc('axes', linewidth=2) # make the axes boundary lines bold #fig, ax = plt.subplots() fig = plt.figure() ax = fig.add_axes([0.1, 0.1, 0.7, 0.7]) # left, bottom, width, height (range 0 to 1) rr.plot( self.df_Region, 'red', lw=6, axes=ax, label='DF') rr.plot( self.cf_Region, 'blue', lw=4, axes=ax, label='CF') fig.suptitle('$g ={},{},{},{}$'.format(self.g13, self.g14, self.g23, self.g24), fontsize=14, fontweight='bold') ax.set_title(r'$P_s=P_1=P_2={}, \, N=1$'.format(self.Ps),fontdict=self.font) ax.set_xlabel('$R_1$', fontdict=self.font) ax.set_ylabel('$R_2$', fontdict=self.font) #ax.set_xlim(xmin=0, xmax=3.5) #ax.set_ylim(ymin=0, ymax=3.5) ax.legend(loc=0) nameStr = 'Ps_{}_g13g14g23g24_{}_{}_{}_{}'.format(self.Ps, self.g13, self.g14, self.g23, self.g24) savefig.save(path='{}/plots_DF_CF/{}'.format(pathString, nameStr), ext='pdf', close=saveOnly, verbose=True)
def display_TwoHopSchemes(two_hop_schemes, pathString): ''' Produce a graph that compare ... ''' self = two_hop_schemes pylab.rc('axes', linewidth=2) # make the axes boundary lines bold #fig, ax = plt.subplots() fig = plt.figure() ax = fig.add_axes([0.1, 0.1, 0.7, 0.7]) # left, bottom, width, height (range 0 to 1) rr.plot( self.region_CF_ICFsch3, 'red', lw=8, axes=ax, label='CF + ICF') rr.plot( self.region_DFIntegerCoeff_FCo, 'c', lw=4, axes=ax, label='DF + FCo') rr.plot( self.region_noInterference, 'blue', lw=2, axes=ax, label='Free Interf.') fig.suptitle('$g ={},{},{},{}$'.format(self.g13, self.g14, self.g23, self.g24), fontsize=14, fontweight='bold') ax.set_title(r'$P_s=P_1=P_2={}, \, P_3={}, \, P_4={}, \, N=1$'.format(self.Ps, self.P3, self.P4),fontdict=self.font) ax.set_xlabel('$R_1$', fontdict=self.font) ax.set_ylabel('$R_2$', fontdict=self.font) #ax.set_xlim(xmin=0, xmax=3.5) #ax.set_ylim(ymin=0, ymax=3.5) ax.legend(loc=0) # savefig.save(path='{}compare_TwoHop_Schemes/PsP3P4_{}_{}_{}_g_{}_{}_{}_{}'.format(pathString, self.Ps, self.P3, self.P4, self.g13, self.g14, self.g23, self.g24), ext='pdf', close=False, verbose=True) nameStr = 'PsP3P4_{}_{}_{}_g13g14g23g24_{}_{}_{}_{}'.format(self.Ps, self.P3, self.P4, self.g13, self.g14, self.g23, self.g24) savefig.save(path='{}compare_TwoHop_Schemes/{}'.format(pathString, nameStr), ext='pdf', close=False, verbose=True)
def display(oneSimulation,pathString ,saveOnly=True): ''' Produce a graph that compare three ICF schemes ''' self = oneSimulation # get the union rate region for plotting icf_sch1 = rr.union( [self.icf_sch1_bigR1, self.icf_sch1_bigR2] ) icf_sch2 = rr.union( [self.icf_sch2_bigR1, self.icf_sch2_bigR2] ) icf_sch3 = rr.union( [self.icf_sch3_bigR1, self.icf_sch3_bigR2] ) pylab.rc('axes', linewidth=2) # make the axes boundary lines bold fig, ax = plt.subplots() rr.plot( icf_sch1, 'g', axes=ax, label='Scheme 1') rr.plot( icf_sch2, 'b', axes=ax, label='Scheme 2') rr.plot( icf_sch3, 'r', axes=ax, label='Scheme 3') # plot the line: R2 = R1 tmp = np.asarray(self.icf_sch1_bigR1._geometry.boundary) tmp2 = [[0, tmp[1, 0]], [0, tmp[1, 1] ] ] ax.plot( [0, tmp[1, 0]], [0, tmp[1, 1] ] , 'k--', lw=2) ax.set_title(r'$ P_3={}, \, P_4={}, \, N=1$'.format(self.P3, self.P4) , fontdict=self.font) ax.set_xlabel('$R_1$', fontdict=self.font) ax.set_ylabel('$R_2$', fontdict=self.font) ax.set_xlim(xmin=0, xmax=3.5) ax.set_ylim(ymin=0, ymax=3.5) ax.legend(loc='upper right') savefig.save(path='{}/compare_three_ICF_Schemes/P3P4_{}_{}'.format(pathString, self.P3, self.P4 ), ext='pdf', close=saveOnly, verbose=True) if (0): # add annotations for 3 regions plt.text(0.7, 2.3, 'capacity region by coherent coding with cardinality-bounding', color='red') plt.text(1, 1.8, 'non-coherent coding with cardinality-bounding', color='blue') plt.text(1.3, 1.4, 'capacity region by coherent coding with cardinality-bounding', color='green') bbox_props = dict(boxstyle="round,pad=0.1", fc="white", ec="g", lw=1) plt.text(1, 0.5, r'$1$', color='black', bbox=bbox_props) bbox_props = dict(boxstyle="round,pad=0.1", fc="white", ec="b", lw=1) plt.text(1.7, 0.4, r'$2$', color='black', bbox=bbox_props) bbox_props = dict(boxstyle="round,pad=0.1", fc="white", ec="r", lw=1) plt.text(2.2, 0.3, r'$3$', color='black', bbox=bbox_props)
def display(oneSimulation,pathString, separate=False ,saveOnly=True): ''' show/save figures ''' self = oneSimulation pylab.rc('axes', linewidth=2) # make the axes boundary lines bold #fig, ax = plt.subplots() fig = plt.figure() ax = fig.add_axes([0.1, 0.1, 0.7, 0.7]) # left, bottom, width, height (range 0 to 1) if separate: rr.plot( self.df_region, 'red', lw=6, axes=ax, label='DF') rr.plot( self.cf_region, 'blue', lw=4, axes=ax, label='CF') rr.plot( self.fco_region, 'red', lw=6, axes=ax, label='DF') rr.plot( self.icf_region_bigR1, 'blue', lw=4, axes=ax, label='ICF') rr.plot( self.icf_region_bigR2, 'blue', lw=4, axes=ax) rr.plot(self.cf_icf01_region, 'green', lw=2, label='CF+ICF Scheme 1' ) rr.plot(self.cf_icf02_region, 'blue', lw=2, label='CF+ICF Scheme 2' ) rr.plot(self.cf_icf_region, 'red', lw=4, label='CF+ICF Scheme 3') # fig.suptitle('$g ={},{},{},{}$'.format(self.g13, self.g14, self.g23, self.g24), fontsize=14, fontweight='bold') ax.set_title(r'$P_s=P_1=P_2={}, \, P_3={}, \, P_4={}, \, N=1$'.format(self.Ps, self.P3, self.P4),fontdict=self.font) ax.set_xlabel('$R_1$', fontdict=self.font) ax.set_ylabel('$R_2$', fontdict=self.font) #ax.set_xlim(xmin=0, xmax=3.5) #ax.set_ylim(ymin=0, ymax=3.5) ax.legend(loc=0) nameStr = 'PsP3P4_{}_{}_{}_g13g14g23g24_{}_{}_{}_{}'.format(self.Ps, self.P3, self.P4, self.g13, self.g14, self.g23, self.g24) savefig.save(path='{}/plots__CF_ICF_1_2_3/{}'.format(pathString, nameStr), ext='pdf', close=saveOnly, verbose=True)