|
7 | 7 | shifts = [] |
8 | 8 | left_threshold = [] |
9 | 9 | right_threshold = [] |
10 | | -HeighAdjustment = [0,-200,-100,-100,-50,-20,-20,0,0,-50]; # should always be non-positive |
11 | | -weights = [0.8,0.15,0.05] #must sum up to 1.0 |
| 10 | +HeighAdjustment = np.ones(shape=(10,),dtype=int)*-15; # should always be non-positive |
| 11 | +HeighAdjustment[0] = 0 |
| 12 | +weights = [0.6,0.25,0.15] #must sum up to 1.0 |
12 | 13 | exceptions = {} #needs to be populated first before calling form_groups_from_tables function |
| 14 | + |
13 | 15 | def form_groups_from_tables(Keys,Lookup,LHeightsData,RHeightsData,LCollisionList,RCollisionList,VTGFilePath,VTLFilePath): |
14 | 16 | lu_len = len(Lookup) |
15 | 17 | #table sorting |
@@ -101,17 +103,22 @@ def form_groups_from_tables(Keys,Lookup,LHeightsData,RHeightsData,LCollisionList |
101 | 103 | TLst = np.zeros(shape=(L0,3),dtype=int) |
102 | 104 | for i in range(0,L0): |
103 | 105 | TLst[i,0] = RTable[j][i] |
104 | | - TLst[i,1] = RHeightsData[RTable[j][i],j+1]*weights[0] + \ |
105 | | - RHeightsData[RTable[j][i],3]*weights[1] + \ |
106 | | - RHeightsData[RTable[j][i],4]*weights[2] |
| 106 | + if j == 0: |
| 107 | + TLst[i,1] = RHeightsData[RTable[j][i],j+1]*0.4 + \ |
| 108 | + RHeightsData[RTable[j][i],j+2]*0.6 |
| 109 | + else: |
| 110 | + TLst[i,1] = RHeightsData[RTable[j][i],j+1]*weights[0]*0.5+ \ |
| 111 | + RHeightsData[RTable[j][i],j+2]*weights[0]*0.5 + \ |
| 112 | + RHeightsData[RTable[j][i],3]*weights[1]+ \ |
| 113 | + RHeightsData[RTable[j][i],4]*weights[2] |
107 | 114 | TLst[i,2] = RHeightsData[RTable[j][i],j+2] |
108 | 115 | RMaster[j]=np.flipud(TLst[TLst[:,1].argsort(),]) |
109 | 116 |
|
110 | 117 | cushion = np.zeros(shape=(10,1),dtype=int) |
111 | 118 | for j in range(0,nCols): |
112 | 119 | if RMaster[j][:,1].any(): |
113 | 120 | cushion[j] = np.mean(RMaster[j][:,1] - np.mean(RMaster[j][:,2])) |
114 | | - |
| 121 | + cushion[0:1] = 0 |
115 | 122 | #height thresholds to form vertical groups |
116 | 123 | thresh = np.zeros(shape=(nRows,nCols),dtype=int) |
117 | 124 | dT = 0 |
@@ -144,7 +151,7 @@ def form_groups_from_tables(Keys,Lookup,LHeightsData,RHeightsData,LCollisionList |
144 | 151 |
|
145 | 152 | for j in range(0,nRows-1): |
146 | 153 | for k in range(0,nCols): |
147 | | - a = np.argwhere(RMaster[k][:,1] < thresh[j,k]) |
| 154 | + a = np.argwhere(RMaster[k][:,1] + 0.5*cushion[j] < thresh[j,k]) |
148 | 155 | if a.any(): |
149 | 156 | indR[j,k] = a[0] |
150 | 157 | for k in range(0,nCols): |
|
0 commit comments