def Provisional(self, N, provis, unknowns): j = 0 finalX = Points('New Provisional Points') orientations = {} for i in unknowns: name = i[0:-2] variable = i[-1] if variable == "o": orientations[name] = float64(N[j]) j += 1 continue x = provis[name].x y = provis[name].y h = provis[name].h if not finalX.has_key(name): finalX[name] = Point(0, 0, 0, False, name) if variable == "x": finalX[name].ChangeVariable(variable, float64(x + N[j])) j += 1 continue if variable == "y": finalX[name].ChangeVariable(variable, float64(y + N[j])) j += 1 continue if variable == "h": finalX[name].ChangeVariable(variable, float64(h + N[j])) j += 1 continue return finalX
def Distances(point1, known1, point2, known2, identity): if point1.known and point2.known: return 0 x1 = point1.x y1 = point1.y h1 = point1.h name1 = point1.name name2 = point2.name x2 = point2.x y2 = point2.y k1 = point1.known k2 = point2.known poi = Point(x1, y1, h1, k1, name1) d21 = float64(poi.joinS(point2)) a = (y2 - y1) / d21 b = (x2 - x1) / d21 if point2.known and not point1.known: if identity[-1] == "y": return -a if identity[-1] == "x": return -b elif point1.known and not point2.known: if identity[-1] == "y": return a if identity[-1] == "x": return b elif not point1.known and not point2.known: if identity[0:-2] == name1: if identity[-1] == "y": return -a if identity[-1] == "x": return -b if identity[0:-2] == name2: if identity[-1] == "y": return a if identity[-1] == "x": return b # def Orientation():
def inter(y0, x0, a0, y1, x1, a1, u): NX = x0 + ((y1 - y0) - (x1 - x0) * math.tan(a1)) / (math.tan(a0) - math.tan(a1)) NY = y0 + (NX - x0) * math.tan(a0) NH = 0 p = Point(NX, NY, NH, False, u) return p
def Directions(point1, known1, point2, known2, identity): if point1.known and point2.known: return 0 p = 3600. * 180. / pi x1 = point1.x name1 = point1.name name2 = point2.name y1 = point1.y h1 = point1.h x2 = point2.x y2 = point2.y k1 = point1.known k2 = point2.known poi = Point(x1, y1, h1, k1, name1) d21 = float64(poi.joinS(point2))**2 a = p * (x2 - x1) / d21 b = p * (y2 - y1) / d21 if point2.known and not point1.known: if identity[-1] == "y": return -a if identity[-1] == "x": return b elif point1.known and not point2.known: if identity[-1] == "y": return a if identity[-1] == "x": return -b elif not point1.known and not point2.known: if identity[0:-2] == name1: if identity[-1] == "y": return -a if identity[-1] == "x": return b if identity[0:-2] == name2: if identity[-1] == "y": return a if identity[-1] == "x": return -b
def LeastSqrRead(inputControl, inputObservations): control = Points() control.read(inputControl) provis = Points() np.set_printoptions(precision=12) np.set_printoptions(suppress=True) np.set_printoptions(linewidth=2000) numpy.set_printoptions(threshold=1000) print "Reading Obs" obs = SurveyData() count = obs.read( inputObservations ) #reads in file into the surveyData dictionary which contains Target object with two variables # determine adjustment information unknowns2 = set() # set of text items obsList = [] for i, sta in obs.iteritems(): for j, k in sta.iteritems(): if k.type == 'both': obsList.append(i + "-" + "direction-" + " " + j) obsList.append(i + "-" + "distance-" + " " + j) else: obsList.append(i + "-" + k.type + " " + j) print obsList # knowns = [] for station_name, station in obs.iteritems(): unknowns2.add(station_name + '_o') for target_name, target in station.iteritems(): if not control.has_key(target_name): unknowns2.add(target_name + '_x') unknowns2.add(target_name + '_y') pass #print target_name, target.direction. unknowns = [] for i in unknowns2: unknowns.append(i) print unknowns G = nx.MultiGraph() G.add_node(2) G.add_node(5) G.add_edge(2, 3) nx.draw(G) # Means all distances between points print "=== Calculate Mean Distance Observations ==================" # for sn1,station1 in obs.iteritems(): # for sn2,station2 in obs.iteritems(): # for tn1,target1 in station1.iteritems(): # for tn2,target2 in station2.iteritems(): # if (not target2.distance==None) and (not target1.distance==None) : # if tn1==sn2 and tn2==sn1: # print tn1,sn1,tn2,sn2 # print "distance 1: "+ str(target1.distance) + "\ndistance 2 :" + str(target2.distance) # temp=target1.distance # target1.distance = (target1.distance+target2.distance)/2.0 # target2.distance = (temp+target2.distance)/2.0 # print "mean: "+ str(target2.distance) print "=================================================================================" print "=== Calculate Provisional Coordinates ==================" #give stations coordinates if they're control points for name, obj in control.iteritems(): if obs.has_key(name): obs[name].setPoint(obj) for sn1, station1 in obs.iteritems(): for tn1, target1 in station1.iteritems(): if not control.has_key(tn1) and not station1[ tn1].distance == None and not station1.point == None: # print "station :"+sn1 d = station1[tn1].distance t = station1[tn1].direction x, y, h = station1.point.polar(d, t) # print "target :" + tn1 provis.add(tn1, x, y, h, False) obs[tn1].setPoint(provis[tn1]) # print str(obs[tn1].point) # print str(tn1) + str(provis[tn1]) for i, j in provis.iteritems(): print i print j print "=================================================================================" print "====== Truncate Distances ===========================================================================" # temp=Points() # for i,obj in provis.iteritems(): # temp.add(i,obj.x,obj.y,obj.h,False) # for p,obj in temp.iteritems(): # provis.replace(p,floor(obj.x),floor(obj.y),floor(obj.h),False) # print provis[p] # # print "====================== TESTING =====================================================" # # provis.add('U1',58961.,49666.4,0.,False) # print provis['U1'] # provis.add('U2',59120.6,49687.0,0.,False) # print provis['U2'] # provis.add('U3',59295.0,49732.0,0.,False) # print provis['U3'] # # # # print Directions(control['SUR09'],'known',provis['U1trunc'],'unknown','y') # print Distances(control['SUR09'],'known',provis['U1trunc'],'unknown','x') # print obs['SUR09'].point.joinS(provis['test']) print "=================================================================================" print "====== Calculate Misclosure L ===========================================" L = numpy.zeros(shape=(count, 1)) i = 0 for sn1, station in obs.iteritems(): for tn1, target in station.iteritems(): if target.type == "both": if control.has_key(tn1): calc = obs[sn1].point.join(control[tn1]) elif provis.has_key(tn1): calc = obs[sn1].point.join(provis[tn1]) else: print "error" observed = obs[sn1][tn1].direction target.setMisclosure(observed - calc) L[i][0] = (observed - calc) * 180. * 3600. / pi i += 1 L[i][0] = obs[sn1][tn1].distance - floor( obs[sn1][tn1].distance) print L[i][0] i += 1 continue else: if control.has_key(tn1): calc = obs[sn1].point.join(control[tn1]) elif provis.has_key(tn1): calc = obs[sn1].point.join(provis[tn1]) else: print "error" observed = obs[sn1][tn1].direction target.setMisclosure(observed - calc) L[i][0] = (observed - calc) * 180. * 3600. / pi i += 1 print str(sn1) + " " + str(tn1) # print observed print('%0.1f' % float64(target.misclosure * 180. / math.pi * 3600.)) print "============== A Matrix =========================================" print count A = numpy.zeros(shape=(count, len(unknowns))) A[0][0] = 3 i = 0 j = 0 doub = False print unknowns for at, station in obs.iteritems(): print at if control.has_key(at): station.point.setKnown(True) for atObserved, observ in station.iteritems(): print "target : " + atObserved + " " + observ.type j = 0 if observ.type == 'both': doub = True for at_wrt in unknowns: if at_wrt[-1] == 'o': if at == at_wrt[0:-2]: A[i][j] = -1. print str(i) + " " + str(j) + " :" + str(A[i][j]) j += 1 continue else: A[i][j] = 0 print str(i) + " " + str(j) + " :" + str(A[i][j]) j += 1 continue if not atObserved == at_wrt[0:-2] and not at == at_wrt[ 0:-2]: # print t # print at_wrt[0:-2] A[i][j] = 0 print str(i) + " " + str(j) + " :" + str(A[i][j]) j += 1 continue if control.has_key(atObserved): #if observing control A[i][j] = equations(station.point, control[atObserved], at_wrt, 'direction') print str(i) + " " + str(j) + " :" + str(A[i][j]) A[i + 1][j] = equations(station.point, control[atObserved], at_wrt, 'distance') print str(i) + " " + str(j) + " :" + str(A[i][j]) j += 1 else: #if observing provisional A[i][j] = equations(station.point, provis[atObserved], at_wrt, 'direction') print str(i) + " " + str(j) + " :" + str(A[i][j]) A[i + 1][j] = equations(station.point, provis[atObserved], at_wrt, 'distance') print str(i) + " " + str(j) + " :" + str(A[i][j]) j += 1 else: for at_wrt in unknowns: if at_wrt[-1] == 'o': if at == at_wrt[0:-2]: A[i][j] = -1. print str(i) + " " + str(j) + " :" + str(A[i][j]) j += 1 continue else: A[i][j] = 0 j += 1 continue if not atObserved == at_wrt[0:-2] and not at == at_wrt[ 0:-2]: # print t # print at_wrt[0:-2] A[i][j] = 0 print str(i) + " " + str(j) + " :" + str(A[i][j]) j += 1 continue if control.has_key(atObserved): #if observing control A[i][j] = equations(station.point, control[atObserved], at_wrt, observ.type) print str(i) + " " + str(j) + " :" + str(A[i][j]) j += 1 else: #if observing provisional A[i][j] = equations(station.point, provis[atObserved], at_wrt, observ.type) print str(i) + " " + str(j) + " :" + str(A[i][j]) j += 1 if doub == True: i += 2 print "i: " + str(i) doub = False else: i += 1 print "i: " + str(i) print "" print " U1_y', 'U1_x', 'U3_y', 'U3_x', 'SUR12_o', 'U2_o', 'U2_x', 'U2_y', 'U1_o', 'U3_o', 'SUR09_o' " names = [] for name, ob in obs.iteritems(): for na, tar in ob.iteritems(): if tar.type == "both": names.append(name + "-" + na + "D") names.append(name + "-" + na + "d") else: names.append(name + "-" + na + "D") row_labels = ['SUR09-T013', 'Y', 'N', 'W'] for row_label, row in zip(names, A): print '%s [%s]' % (row_label, ' '.join('%01f' % i for i in row)) # except: # print "trying" # A[i][j]=equations(station.point,provis[t],at_wrt[-1],types[i]) # # # i+=1 # print A print "============== Calculate Least squares =========================================" Pob = Weights() Pob.setDirectionWeight(1) Pob.setDistanceWeight(1) P = Pob.matrix(obs, A) A = numpy.asmatrix(A) N = (((A.T) * A)**(-1)) * A.T * L print "now" print A.T * P * L for row_label, row in zip(unknowns, N): print '%7s [%s]' % (row_label, ' '.join('%07f' % i for i in row)) j = 0 # for name in unknowns: # print name[0:-2] + str(+N[i]) # # print name + str(ob.y+N[i]) # i+=1 # print ob.x # print ob.y print unknowns print provis finalX = Points() orientations = {} for i in unknowns: name = i[0:-2] variable = i[-1] if variable == "o": orientations[name] = float64(N[j]) j += 1 continue x = provis[name].x y = provis[name].y h = provis[name].h if not finalX.has_key(name): finalX[name] = Point(0, 0, 0, False, name) if variable == "x": finalX[name].ChangeVariable(variable, float64(x + N[j])) j += 1 continue if variable == "y": finalX[name].ChangeVariable(variable, float64(y + N[j])) j += 1 continue if variable == "h": finalX[name].ChangeVariable(variable, float64(h + N[j])) j += 1 continue print finalX[name] # T=numpy.matrix([[1,2,3],[3,2,3],[3,2,1],[3,2,1]]) # S=numpy.matrix([[3,2,3],[3,2,1],[3,2,1],[1,2,3]]) # M=numpy.matrix([[3,2,3],[3,2,1],[1,2,3],[3,2,1]]) # print T # print T.T*T # print S.T*S # print M.T*M # print A.T*P*L # print T*T.T for i, j in finalX.iteritems(): print i + ": " print("Y: %.2f" % j.y) print("N: %.2f" % j.x) print "Orientations :\n" for i, ob in orientations.iteritems(): print str.format("{0} {1}", i, round(ob, 1)) V = A * N - L for i in range(size(V)): print str(obsList[i]) + ": " + str(V[i]) return finalX, obs, control
def resec(y0, x0, a0, y1, x1, a1, y2, x2, a2, u): Y = [] N = [] A = [] Y.append(y0) Y.append(y1) Y.append(y2) N.append(x0) N.append(x1) N.append(x2) A.append(a0) A.append(a1) A.append(a2) # # % calculation of provisional coordinates using observations........... # %===================================================================== alpha = A[1] - A[0] if (alpha < 0): alpha = alpha + 360 * math.pi / 180 beta = A[2] - A[1] if (beta < 0): beta = beta + 360 * math.pi / 180 charlie = A[0] - A[2] if (charlie < 0): charlie = charlie + 360 * math.pi / 180 Talpha = math.tan(alpha) Tbeta = math.tan(beta) if 0 <= Talpha < 0.05 or -0.05 < Talpha <= 0 or 0 <= Tbeta < 0.05 or -0.05 < Tbeta <= 0: print '==== Unsafe Geometry ===' # %coord differences BAX: B minus A in N & BAY: B minus A in Y BAX = N[1] - N[0] BAY = Y[1] - Y[0] BCX = N[1] - N[2] BCY = Y[1] - Y[2] ACX = N[1] - N[2] ACY = Y[1] - Y[2] # # %=======BLUNTS METHOD FORMULA========================================== def cot(x): return 1 / (math.tan(x)) deltaY = -(N[2] - N[0]) + (Y[2] - Y[1]) * cot(beta) + ( Y[0] - Y[1]) * cot(alpha) deltaX = (Y[2] - Y[0]) + (N[2] - N[1]) * cot(beta) + ( N[0] - N[1]) * cot(alpha) tNB = math.atan(deltaY / deltaX) # %check quadrant========== if (deltaY > 0) and (deltaX < 0): tNB = tNB + math.pi elif ((deltaY < 0) and (deltaX < 0)): tNB = tNB + math.pi elif (deltaY < 0) and (deltaX > 0): tNB = tNB + 2 * math.pi # %========================= Dcorrection = tNB - A[1] # % display(degrees2dms(radtodeg(Dcorrection))); Ac = [[], [], []] Ac[0] = A[0] + Dcorrection Ac[1] = A[1] + Dcorrection Ac[2] = A[2] + Dcorrection t1N = Ac[0] + math.pi t2N = Ac[1] + math.pi t3N = Ac[2] + math.pi # # %========calculate intersection for provisional point========= # t= Intersection; # NX1,NY1 = t.intersect (Y[0],N[0],A[0],Y[1],N[1],A[1]); # NX1= N(1)+((Y(2)-Y(1))-(N(2)-N(1))*tan(t2N))/(tan(t1N)-tan(t2N)); # NY1= Y(1) + (NX1-N(1))*tan(t1N); NX1 = N[0] + ((Y[1] - Y[0]) - (N[1] - N[0]) * math.tan(t2N)) / ( math.tan(t1N) - math.tan(t2N)) NY1 = Y[0] + (NX1 - N[0]) * math.tan(t1N) NH1 = 0 p = Point(NX1, NY1, NH1, False, u) return p
def Read(self, inputControl, inputObservations): control = Points("control points") control.read(inputControl) # print control provis = Points("provisional points") # print provis np.set_printoptions(precision=12) np.set_printoptions(suppress=True) np.set_printoptions(linewidth=2000) numpy.set_printoptions(threshold=1000) print "Reading Obs" obs = SurveyData() count, N, pos = obs.read( inputObservations, control ) #reads in file into the surveyData dictionary which contains Target object with two variables print obs edge_weight = {} # for u,v,d in N.edges(data=True): # print u # print v # edge_weight[u][v]=d['direction'] # dict([((u,v,),int(d['distance'])) for u,v,d in N.edges(data=True)]) nx.draw_networkx_nodes(N, pos, node_color='y', node_size=800, alpha=0.8) nx.draw_networkx_nodes(N, pos, nodelist=control, node_color='r', node_size=800, alpha=0.8) edges = {} for v, u, d in N.edges(data=True): # print d if d.has_key("distance") and d.has_key('direction'): edges[v, u] = 'b' nx.draw(N, pos) nx.draw_networkx_edges(N, pos, edgelist=edges, width=8, alpha=0.5, edge_color='b') plt.show() OBS = ObsSplit("Individual Observations 2014 Survey") OBS = OBS.read(obs, control) # print OBS # N.add_nodes_from(obs.keys()) # for n, p in control.iteritems(): # N.node[n]['pos'] = p # # nx.draw(N,'pos') # plt.show() # determine adjustment information unknowns2 = set() # set of text items obsList = [] for i, sta in obs.iteritems(): for j, k in sta.iteritems(): if k.type == 'both': obsList.append(i + "-" + "direction-" + " " + j) obsList.append(i + "-" + "distance-" + " " + j) else: obsList.append(i + "-" + k.type + " " + j) # knowns = [] for station_name, station in obs.iteritems(): unknowns2.add(station_name + '_o') for target_name, target in station.iteritems(): if not control.has_key(target_name): unknowns2.add(target_name + '_x') unknowns2.add(target_name + '_y') pass unknowns = [] # print obsList for i in unknowns2: unknowns.append(i) # Means all distances between points # print "=== Calculate Mean Distance ObsSplit ==================" # for sn1,station1 in obs.iteritems(): # for sn2,station2 in obs.iteritems(): # for tn1,target1 in station1.iteritems(): # for tn2,target2 in station2.iteritems(): # if (not target2.distance==None) and (not target1.distance==None) : # if tn1==sn2 and tn2==sn1: # print tn1,sn1,tn2,sn2 # print "distance 1: "+ str(target1.distance) + "\ndistance 2 :" + str(target2.distance) # temp=target1.distance # target1.distance = (target1.distance+target2.distance)/2.0 # target2.distance = (temp+target2.distance)/2.0 # print "mean: "+ str(target2.distance) print "=================================================================================" print "=== Calculate Provisional Coordinates ==================" for sta, station in obs.iteritems(): if control.has_key(sta): continue else: provis.add(sta, station.point.x, station.point.y, station.point.h, False) # print provis #give stations coordinates if they're control points # for name,obj in control.iteritems(): # if obs.has_key(name): # obs[name].setPoint(obj) # # # for sn1,station1 in obs.iteritems(): # # for tn1,target1 in station1.iteritems(): # if not control.has_key(tn1) and not station1[tn1].distance==None and not station1[tn1].direction==None and not station1.point==None: # d= station1[tn1].distance # t= station1[tn1].direction # x,y,h=station1.point.polar(d,t) # provis.add(tn1,x,y,h,False) # obs[tn1].setPoint(provis[tn1]) print "=================================================================================" print "====== Truncate Distances ===========================================================================" temp = Points() for i, obj in provis.iteritems(): temp.add(i, obj.x, obj.y, obj.h, False) for p, obj in temp.iteritems(): provis.replace(p, floor(obj.x), floor(obj.y), floor(obj.h), False) # print provis[p] print "====================== TESTING =====================================================" # provis.add('SUR10', 58961., 49666.4, 0., False) provis.add('RU4A', 59120.6, 49687.0, 0., False) provis.add('SUR11', 59295.0, 49732.0, 0., False) print "=================================================================================" print "====== Calculate Misclosure L ===========================================" L = numpy.zeros(shape=(count, 1)) Lnames = Points("L vector name pairs") i = 0 for sn1, station in OBS.iteritems(): for tn1, target in station.iteritems(): tn1 = tn1[0:-2] # tn1=tn1[0:-2] if target.type == "direction": if control.has_key(tn1): calc = obs[sn1].point.join(control[tn1]) temp = obs[sn1].point elif provis.has_key(tn1): calc = obs[sn1].point.join(provis[tn1]) else: print "error" calc = 0 observed = obs[sn1][tn1].direction target.setMisclosure(observed - calc) L[i][0] = ((observed - calc) * 3600. * 180. / pi) Lnames[sn1 + " to " + tn1 + " direc"] = round( ((observed - calc) * 3600. * 180. / pi), 1) i += 1 # continue elif target.type == "distance": if control.has_key(tn1): calc = obs[sn1].point.joinS(control[tn1]) elif provis.has_key(tn1): calc = obs[sn1].point.joinS(provis[tn1]) else: print "error" observed = obs[sn1][tn1].distance target.setMisclosure(observed - calc) L[i][0] = round((observed - calc), 3) Lnames[sn1 + " to " + tn1 + " distance"] = L[i][0] i += 1 # print str(sn1) + " " + str(tn1) # print observed # print ('%0.1f' % float64(target.misclosure*180./math.pi*3600.)) # print Lnames # print L print "============== A Matrix =========================================" A = numpy.zeros(shape=(count, len(unknowns))) A[0][0] = 3 i = 0 j = 0 for station_name, station in OBS.iteritems(): if control.has_key(station_name): current_station = control[station_name] elif provis.has_key(station_name): current_station = provis[station_name] for tname, target in station.iteritems(): tname = tname[0:-2] j = 0 # tname=tname[0:-2] if target.type == 'direction' or target.type == 'distance': for diff_wrt in unknowns: if diff_wrt[-1] == 'o' and target.type == 'distance': A[i][j] = 0 continue if diff_wrt[-1] == 'o' and target.type == 'direction': if station_name == diff_wrt[0:-2]: A[i][j] = -1. j += 1 continue else: A[i][j] = 0 j += 1 continue if not tname == diff_wrt[ 0:-2] and not station_name == diff_wrt[0:-2]: A[i][j] = 0 j += 1 continue if control.has_key(tname): #if observing control if target.type == "direction": A[i][j] = equations(current_station, control[tname], diff_wrt, 'direction') else: A[i][j] = equations(current_station, control[tname], diff_wrt, 'distance') j += 1 continue else: #if observing provisional if target.type == "direction": A[i][j] = equations(current_station, provis[tname], diff_wrt, 'direction') else: A[i][j] = equations(current_station, provis[tname], diff_wrt, 'distance') j += 1 continue else: for diff_wrt in unknowns: if diff_wrt[-1] == 'o': if station_name == diff_wrt[0:-2]: A[i][j] = -1. j += 1 continue else: A[i][j] = 0 j += 1 continue if not tname == diff_wrt[ 0:-2] and not station_name == diff_wrt[0:-2]: A[i][j] = 0 j += 1 continue if control.has_key(tname): #if observing control A[i][j] = equations(current_station, control[tname], diff_wrt, target.type) j += 1 else: #if observing provisional A[i][j] = equations(current_station, provis[tname], diff_wrt, target.type) j += 1 i += 1 # print "i: " +str(i) #print "" print "SUR10_o', 'RU4A_y', 'RU4A_x', 'SUR11_x', 'SUR11_y', 'SUR12_o', 'SUR10_y', 'SUR10_x', 'RU4A_o', 'SUR11_o', 'SUR09_o'" # print A # print OBS names = [] for name, ob in obs.iteritems(): for na, tar in ob.iteritems(): if tar.type == "both": names.append(name + "-" + na + "D") names.append(name + "-" + na + "d") else: names.append(name + "-" + na + "D") row_labels = ['SUR09-T013', 'Y', 'N', 'W'] # for row_label, row in zip(names, A): #print '%s [%s]' % (row_label, ' '.join('%01f' % i for i in row)) # except: # print "trying" # A[i][j]=equations(station.point,provis[t],diff_wrt[-1],types[i]) # # # i+=1 # #print A print "============== Calculate Least squares =========================================" Pob = Weights() Pob.setDirectionWeight(1) Pob.setDistanceWeight(1) P = Pob.matrix(obs, A) A = numpy.asmatrix(A) N = (((A.T) * P * A)**(-1)) * (A.T * P * L) Xtemp = Points("N correction pairs") i = 0 for name in unknowns: Xtemp[name] = float64(N[i]) i += 1 finalX = Points("final Coordinates:") orientations = {} j = 0 for i in unknowns: name = i[0:-2] variable = i[-1] if variable == "o": orientations[name] = float64(N[j]) j += 1 continue x = provis[name].x y = provis[name].y h = provis[name].h if not finalX.has_key(name): finalX[name] = Point(0, 0, 0, False, name) if variable == "x": finalX[name].ChangeVariable(variable, float64(x + N[j])) j += 1 continue if variable == "y": finalX[name].ChangeVariable(variable, float64(y + N[j])) j += 1 continue if variable == "h": finalX[name].ChangeVariable(variable, float64(h + N[j])) j += 1 continue # print finalX V = A * N - L # print V # print A.T*V posteriori = float((V.T * P * V) / (count - size(unknowns))) # print posteriori covarience_mat = posteriori * (A.T * A)**(-1) precisions = Points("Precisions of Unknowns") i = 0 # print "awek" # print N # print covarience_mat[1,1] for name, value in Xtemp.iteritems(): # print value # print N[i] precisions[name] = sqrt(float(covarience_mat[i, i])) i += 1 # print precisions print "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" return A, Xtemp, provis, OBS, control, unknowns, V, P