示例#1
0
    def __init__(self, id,
                 x=None, y=None, z=None,
                 status=GamaCoordStatus.unused,
                 covmat=None, index=None,
                 dx=None, dy=None, dz=None,
                 dcovmat=None, dindex=None,
                 testStat=None,
                 testPassed=None, 
                 testPValue=None,
                 testReliability=None,
                 testType=DisplacementTestType.none,
                 textTable=None,
                 epochIndex=None):

        if isinstance(id, PointLocalGama):
            p = id
            id = p.id; x = p.x; y = p.y; z = p.z;
            status = p.status; covmat = p.covmat; index = p.index
        
        if textTable == None:
            textTable = displ_test_text_table()

        PointLocalGama.__init__(self, id=id, x=x, y=y, z=z,
                                status=status, covmat=covmat, index=index)

        PointDisplBase.__init__(self, id=id, dx=dx, dy=dy, dz=dz,
                                covmat=dcovmat, index=dindex)
        
        TestResult.__init__(self, testStat=testStat, testPassed=testPassed,
                            testPValue=testPValue,
                            testReliability=testReliability,
                            testType=testType, textTable=textTable)

        self.epochIndex = epochIndex
示例#2
0
    def _handle_end_element_all(self, name):
        '''end element handler for method all'''

        if name=="description":
            self.data.description=self._characterData.strip()
            
        elif name=="id":
            self._id=self._characterData.strip()

        elif name=="x":
            self._coordX=float(self._characterData)
            self._coordType += name
            #if self._tagLLast == "fixed":
            #    self._coordType |= GamaCoordStatus.fix_x
            #else: # "adjusted"
            #    self._coordType |= GamaCoordStatus.adj_x

        elif name=="X":
            self._coordX=float(self._characterData)
            self._coordType += name
            #if self._tagLLast == "fixed":
            #    self._coordType |= GamaCoordStatus.fix_x
            #else: # "adjusted"
            #    self._coordType |= GamaCoordStatus.adj_X

        elif name=="y":
            self._coordY=float(self._characterData)
            self._coordType += name
            #if self._tagLLast == "fixed":
            #    self._coordType |= GamaCoordStatus.fix_y
            #else: # "adjusted"
            #    self._coordType |= GamaCoordStatus.adj_y

        elif name=="Y":
            self._coordY=float(self._characterData)
            self._coordType += name
            #if self._tagLLast == "fixed":
            #    self._coordType |= GamaCoordStatus.fix_y
            #else: # "adjusted"
            #    self._coordType |= GamaCoordStatus.adj_Y

        elif name=="z":
            self._coordZ=float(self._characterData)
            self._coordType += name
            #if self._tagLLast == "fixed":
            #    self._coordType |= GamaCoordStatus.fix_z
            #else: # "adjusted"
            #    self._coordType |= GamaCoordStatus.adj_z

        elif name=="Z":
            self._coordZ=float(self._characterData)
            self._coordType += name
            #if self._tagLLast == "fixed":
            #    self._coordType |= GamaCoordStatus.fix_z
            #else: # "adjusted"
            #    self._coordType |= GamaCoordStatus.adj_Z

        elif name=="point":
            # add point to PointDict

            point=PointLocalGama(id=self._id, 
                                  x=self._coordX, 
                                  y=self._coordY, 
                                  z=self._coordZ)

            if self._tagLast=="adjusted":
                point.status = gama_coord_status_attr_adj(self._coordType)
                # adds point with covmat
                index = [None, None, None] # rows in covmat
                if self._coordX != None: 
                    index[0] = self._covmatrow
                    self._covmatrow += 1
                if self._coordY != None: 
                    index[1] = self._covmatrow
                    self._covmatrow += 1
                if self._coordZ != None: 
                    index[2] = self._covmatrow
                    self._covmatrow += 1
                point.index = index
                self.data.pointListAdjCovMat.add_point(point)
            
            #elif self._tagLast=="approximate":
            #    # adds point without covmat 
            #    point.texttable = text_table_coor()
            #    self.data["pointApp"].add_point(point)
            #
            elif self._tagLast=="fixed":
                point.status = gama_coord_status_attr_fix(self._coordType)
                # adds point without covmat 
                self.data.pointListFix.add_point(point)

            # erase data
            self._coordX, self._coordY, self._coordZ = None, None, None
            self._coordType, self._coordNum = "", 0

        # orientation shifts
        #elif name=="approx": pass
            #self._orientationApprox=float(self._characterData)
        #elif name=="adj": pass
            #self._orientationAdj=float(self._characterData)
        #elif name=="orientation": pass
            # add orientation shift as point with status ori
            # approx "approximate" 
            # adj    "adjusted"
            
            #self.data["approximate"].add_ori_with_index(self._id, self._orientationApprox)
            #self.data["adjusted"   ].add_ori_with_index(self._id, self._orientationAdj)
        
        # stdev
        elif name=="apriori":
            self.data.pointListAdjCovMat.covmat.apriori = float(self._characterData)
        
        elif name=="aposteriori":
            self.data.pointListAdjCovMat.covmat.aposteriori = float(self._characterData)
        
        elif name=="used":
            self._characterData = self._characterData.strip()
            if self._characterData == "apriori":
                self.data.pointListAdjCovMat.covmat.useApriori = True
            elif self._characterData == "aposteriori":
                self.data.pointListAdjCovMat.covmat.useApriori = False
            else:
                print "*%s*" % self._characterData
                raise GamaLocalAdjParserError, "unknown data in tag <used>"

        elif name=="probability":
            self.data.stdev["probability"] = float(self._characterData)
        
        elif name=="degrees-of-freedom":
            self.data.stdev["df"] = int(self._characterData)
        
        # project equations
        elif name=="equations" or\
             name=="unknowns" or\
             name=="defect": 
            self.data.projEqn[name] = int(self._characterData)
        elif name=="sum-of-squares":
            self.data.projEqn[name] = float(self._characterData)
        
        # observation summary
        elif name=="distances" or\
             name=="directions" or\
             name=="angles" or\
             name=="xyz-coords" or\
             name=="h-diffs" or\
             name=="z-angles" or\
             name=="s-dists" or\
             name=="vectors":
            self.data.obsSummary[name] = int(self._characterData)
        
        # dim and band of covariance matrix
        elif name=="dim":
            self.data.pointListAdjCovMat.covmat.dim = int(self._characterData)
        elif name=="band":
            self.data.pointListAdjCovMat.covmat.band = int(self._characterData)

        # covariance matrix float numbers
        elif name=="flt":
            self.data.pointListAdjCovMat.covmat.append_value(\
                                float(self._characterData)/(Unit.distStdev**2))

        # cut of orientation shifts in covariance matrix
        elif name=="cov-mat":
            self.data.pointListAdjCovMat.covmat.slice(self.data.pointListAdjCovMat.get_num_coord())
        
            #for p in self.data.pointListAdjCovMat:
            #    print p.id, ">", p.index
            #    print p.id, "vc", p.var, p.cov
        
        self._characterData=""
        self._tagName=self._tagLast
        self._tagLast=self._tagLLast