-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrial&error.py
86 lines (61 loc) · 2.22 KB
/
trial&error.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import numpy as np
class idk:
def __init__ (self, name):
self.name = name
class hello:
def __init__ (self, num, num_2, num_3):
self.num = [num, num_2, num_3]
xx = np.array([[1,2,3],[4,5,6],[7,8,9],[10,11,12],[4,5,6]])
f = np.array([[[1,2,3],[4,5,6],[7,2,9],[1,2,3],[10,11,12]],
[[1,0,3],[7,5,6],[7,8,9],[1,2,3],[10,11,12]]])
print(np.unique(xx))
#return = np.array([[[1,2,3], [4,5,6], [1,2,3], [10,11,12]],
# [[7,8,9], [1,2,3], [10,11,12]]])
#y = np.repeat(x, len(x[0]),axis=0)
#trans_y = np.repeat(np.reshape(x,(len(x[0]),1,3)),len(x[0]),axis=1)
#dist = np.linalg.norm(y-trans_y,axis=2)
#nearest = [y[i][dist[i]==0] for i,r in enumerate(y)]
#other = np.concatenate(y[i][dist[i]==0])
hi = idk('X')
new = hello(idk('Ga'),idk('N'),idk('Si'))
for value in new.num:
if value.name == 'Ga':
value = hi
a = np.array([[1,6,3],[6,8,9]])
b = np.array([[6,3,5],[2,35,8]])
output = np.concatenate((a,b), axis=1)
print(output)
new_xx = np.tile(xx,(len(f),1))
n_xx = np.array([",".join(item) for item in new_xx.astype(str)])
n_f = np.array([",".join(item) for item in f.reshape(10,3).astype(str)])
print(n_xx)
print(len(n_f))
sorter = n_xx.argsort(kind='mergesort')
i = sorter[np.searchsorted(n_xx, n_f,sorter=sorter)]
print(i-1)
#sorter = n_xx.argsort()
#print(sorter)
#rint(n_xx[sorter])
#i = sorter[np.searchsorted(n_xx,n_x, side='left', sorter=sorter)]
#rint(new_xx[i])
#i_newshape = i.reshape(2,5,3)
#rint(i_newshape)
#_bool = (i_newshape[:,:,2]-i_newshape[:,:,1])==1
#i_bool1 = (i_newshape[:,:,1]-i_newshape[:,:,0])==1
#otal_bool = i_bool*i_bool1
#new_i = (((i_newshape[total_bool][:,2]+1)/3)-1).astype(int)
#print(new_i)
rofae = np.array([[1,2,3,4,5,6],[6,5,4,3,2,1],[8,5,2,7,9,4]])
ello = np.array([[3,0,0],[0,1,0],[0,0,2]])
ello_new = np.tile(ello, (len(rofae),1,1))
uhhh = rofae[:,:3]-rofae[:,3:]
solve = np.linalg.solve(ello_new,uhhh)
print(uhhh)
print(solve)
print(np.min(rofae,axis=1, initial=10, where=(rofae!=2)))
print(np.reshape(np.repeat(np.min(rofae,axis=1, initial=10, where=(rofae!=2)),6), (3,6)))
print(rofae[:,0]==1)
flux = np.array([[1,2,3],[4,5,6],[3,1,6]])
concentration = np.array([1,2,3])
print(np.sqrt(flux[:,0]**2 + flux[:,1]**2 + flux[:,2]**2))
print(sum(flux))