예제 #1
0
print("Theta1 (fraction of goodchannels above LT for design channel):" +
      str(theta1))
print("Theta2 (fraction of goodchannels above LT for other channel):" +
      str(theta2))
json.dump("Lambdathreshold:" + str(LT), f1)
f1.write("\n")
json.dump(
    "Theta1 (fraction of goodchannels above LT for design channel):" +
    str(theta1), f1)
f1.write("\n")
json.dump(
    "Theta2 (fraction of goodchannels above LT for other channel):" +
    str(theta2), f1)
f1.write("\n")

#=======================================================Simulation

json.dump("{p:Fraction of good channels abov LT...}", f1)
f1.write("\n")
#-----------------------------------------checking channel
#calculating P_all good could have been seperated for llrdict , but that takes longer time
Fdict = lmb.frac_goodchannel(channel_plist, design_p, I, N, LT, runsim, RI,
                             False)

Pperdict = lmb.PrOffracaboveFT(Fdict, channel_plist, theta1, runsim)

pprint(Fdict)
pprint(Pperdict)
json.dump(Fdict, f1)
json.dump(Pperdict, f1)
예제 #2
0
N = 1024
design_p = 0.2
runsim = 1000
channel_plist = [0.2, 0.25]
C = pl.CapacityBSC(N, design_p)
G = int(C)

#------------------------------------LT
#G=250
LT = float(np.log2(N) / N)
LT = 30

print LT
Fdict = lmb.perc_goodchannel_WD(LLRdict, channel_plist, N, LT, G, runsim)
PT = 44
Ppercdict = lmb.PrOffracaboveFT(Fdict, channel_plist, PT, runsim)
print Ppercdict

color = ["green", "yellow"]
plt.figure(1)
index = range(runsim)
j = 1
for channel_p in channel_plist:
    j += 1
    plt.scatter(index,
                Fdict[str(channel_p)],
                color=color[j - 2],
                label="Channel_p" + str(channel_p))

plt.legend(loc="best")
plt.title("Threshold=" + str(LT) + " design_p=" + str(design_p) + " Rate=" +