本文整理匯總了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