本文整理匯總了Python中plot.Plot.plotGains方法的典型用法代碼示例。如果您正苦於以下問題:Python Plot.plotGains方法的具體用法?Python Plot.plotGains怎麽用?Python Plot.plotGains使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類plot.Plot
的用法示例。
在下文中一共展示了Plot.plotGains方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: plotGains
# 需要導入模塊: from plot import Plot [as 別名]
# 或者: from plot.Plot import plotGains [as 別名]
def plotGains(coordinator_id ,tx_node_id, rx_node_id, year = None, month = None, day = None):
#call the method when you want to plot the results from the file
#open file with measurements and plot results from it
#specify year, month, day if you only want to take into account gain measurements made until that date. If those are not specified, then all measurements will be taken into account.
#first get data from the file
gains = GainCalculations.getFileResults(coordinator_id, tx_node_id, rx_node_id, year=year, month=month, day=day)
#gains will have the following form : [ [gain - linear , received_power[w] , noise_power[w], transmitted_power[w], date ], [gain - linear , received_power[w] , noise_power[w], transmitted_power[w], date ], .. ]
if gains is None:
aux = tx_node_id
tx_node_id = rx_node_id
rx_node_id = aux
print "There are no values available for this combination. Trying with gain_between_tx_%d_and_rx_%d.dat? (yes or no)" %(tx_node_id, rx_node_id)
choice = raw_input("")
if choice.lower() == "no":
print "You have chosen no"
return None
elif choice.lower() == "yes":
gains = GainCalculations.getFileResults(coordinator_id, tx_node_id, rx_node_id, year=year, month=month, day=day)
if gains is None:
print "Sorry, there are no measurements for this combination at all"
return None
else:
print "Invalid input, you were supposed to enter yes or no"
return None
print "Plot gains"
#define a gain_list : [[gain_dB], [date]]
gain_list = [[],[]]
for i in gains:
date = DateTime.strptime((i[4])[0:16], "%Y-%m-%d %H:%M")
gain_list[0].append(10.00 * math.log10(i[0]) )
gain_list[1].append(date)
#plot results
Plot.plotGains(gain_list[1], gain_list[0], "Number of measurements", "Gain [dB]", "Gain between tx%d and rx%d" %(tx_node_id, rx_node_id), False)