示例#1
0
文件: Base.py 项目: tubapala/peat
 def printMeta(self):
     """print current meta data"""
     if not hasattr(self, '__meta_data__'):
         print 'No Meta data'
         return
     M = MetaData(data=self.__meta_data__)
     M.prettyPrint()
     return
示例#2
0
文件: Base.py 项目: yongwangCPH/peat
 def printMeta(self):
     """print current meta data"""
     if not hasattr(self, "__meta_data__"):
         print "No Meta data"
         return
     M = MetaData(data=self.__meta_data__)
     M.prettyPrint()
     return
示例#3
0
文件: Base.py 项目: tubapala/peat
 def checkMeta(self):
     """Load old style meta data if present and then remove"""
     if not hasattr(self, '__meta_data__'):
         M = MetaData(project=self)
         if hasattr(self, '__Exp_Meta_Dat__'):
             print 'old meta data - converting'
             M.convertfromOld()
             del self.__Exp_Meta_Dat__
         self.setMetaData(M.data)
     return
示例#4
0
文件: Base.py 项目: yongwangCPH/peat
 def checkMeta(self):
     """Load old style meta data if present and then remove"""
     if not hasattr(self, "__meta_data__"):
         M = MetaData(project=self)
         if hasattr(self, "__Exp_Meta_Dat__"):
             print "old meta data - converting"
             M.convertfromOld()
             del self.__Exp_Meta_Dat__
         self.setMetaData(M.data)
     return
示例#5
0
文件: Base.py 项目: tubapala/peat
    def loadData(self, data=None):
        """Load the data into self.data and update selector etc"""

        # Did we get data or should we just add an empty data window?
        if data == None or type(data) is types.StringType:
            self.data = {}
            self.datasets = []
            self.__datatabs_fits__ = {}
            M = MetaData()
            self.__meta_data__ = M.data
        else:
            self.data = copy.deepcopy(data)
            self.datasets = []
            # Set mode if present
            if self.data.has_key('mode'):
                self.currentmode = self.data['mode']
                del self.data['mode']
            #we now load the special dicts directly, so same names
            for name in self.ekinfields:
                if data.has_key(name):
                    self.__dict__[name] = copy.deepcopy(self.data[name])
                    del self.data[name]
            #populate list of datasets
            for dataset in self.data.keys():
                if dataset in self.ekinfields:
                    continue
                self.datasets.append(dataset)
        self.length = len(self.datasets)
        self.checkMeta()
        return