本文整理汇总了Python中Message.generate_messages方法的典型用法代码示例。如果您正苦于以下问题:Python Message.generate_messages方法的具体用法?Python Message.generate_messages怎么用?Python Message.generate_messages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message.generate_messages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: receivers
# 需要导入模块: import Message [as 别名]
# 或者: from Message import generate_messages [as 别名]
## Parameters
num_nodes = 16
min_eps = .1
num_msgs = 2
#
eps_vec = np.random.uniform(low=min_eps,size=num_nodes)
print 'Number of receivers(nodes): ', num_nodes
print
print 'Erasures are: ', eps_vec
# generate random messages. Each row i is desired by receiver i
message_matrix = np.random.random_integers(1, 255, [num_nodes, num_msgs])
Messages = Message.generate_messages(message_matrix)
# store final received messages. goal is to "de-NaN" by the end
final_messages = np.empty((num_nodes, num_msgs))
## Round Robin to start
msg_vec = Messages[:,0] # first round of messages
sym_vec = np.empty(num_nodes, dtype=object)
for i in range(num_nodes):
sym_vec[i] = Message.Symbol([1], [msg_vec[i]])
print
print 'Round Robin symbols are: ', sym_vec
R = transmission.transmit_symbols(sym_vec, eps_vec)
#print