def initComponentDB(): defaultcomponent='empty' liste=h5m.getNbrfromFile(h5m.listFiles()) DB=dict() for x in liste: DB[x]=defaultcomponent pickle.dump( DB, open( env.DBpath+"ComponentDB.bin", "wb" ) )
def initializeDB(self): listAttr=self.wrapper.getAttrList(detail='all') headers=listAttr['Name'].tolist() listshot=h5.getNbrfromFile(h5.listFiles()) listattrs=[] for shot in listshot: print shot paths=self.wrapper.getPath(headers,shot) #print paths #print h5.listAttrs(shot,paths) attrs=h5.listAttrs(shot,paths) listattrs.append(attrs) df=pd.DataFrame(listattrs,index=listshot,columns=headers) #print listAttr['Name'] for x in listAttr.Name.values: attr=listAttr.Processing.values[listAttr.Name.values==x][0] if attr=='datetime': df[x]=pd.to_datetime(df[x]) if attr=='str': df[x]=df[x].astype('S32') if attr=='float': df[x]=df[x].astype(float) if attr=='bool': df[x]=df[x].astype(bool) #df.convert_objects() df.to_hdf(self.store,'shotDB',format='table',nan_rep='nan',data_columns=True)