当前位置: 首页>>代码示例>>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;未经允许,请勿转载。