當前位置: 首頁>>代碼示例>>Python>>正文


Python Plot.plotGains方法代碼示例

本文整理匯總了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)
開發者ID:avian2,項目名稱:logatec-games,代碼行數:42,代碼來源:gainCalculations.py


注:本文中的plot.Plot.plotGains方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。