Код: Выделить всё
centers = np.array([(2.78568, 0.0000), (4.32842, -0.775169), (7.43238, -1.000000)])
ts = np.array([0.1, 0.2, 0.3])
< tr>
сигма
тау
t
2,78568
0,000000
0,1
4,32842
-0,775169
0,1
7,43238
-1,000000
0,1
2,78568
0,000000
0,2
4,32842
-0,7751690,2
7,43238
-1,000000
0,2
2,78568
0,000000
0.3
4.32842
-0.775169
0,3
7,43238
-1,000000
0,3
Я пробовал это, но должен быть лучший способ сделать это?
Код: Выделить всё
sigmas, taus = centers[:,0], centers[:,1]
_inputs = np.array(np.meshgrid(taus, ts)).reshape(2,9).T
inputs = np.append(np.zeros((9,1)), _inputs, 1)
for input in inputs:
center = centers[np.where(centers[:,1]==input[1])]
input[0:2] = center
Подробнее здесь: https://stackoverflow.com/questions/790 ... -variables