def loadStats(self,**KwargsDict): #MetaDict And DataDict self.setDataDict() self.SimulationsH5pyFile=SYS.H5pyFileClass().update( { 'FileString':ModelString, 'FolderPathString':DataPathString } ) self.StatsDict=self.SimulationsH5pyFile.FilePointer[SYS.getIdStringWithDict(self.DataDict)]
def foundSimulations(self,**Kwargs): ###H5PY PART !!!!!!!! #MetaDict And DataDict self.setDataDict() #SYS._print(self.DataDict) #Open the hdf5 self.SimulationsH5pyFile=SYS.H5pyFileClass().update( { 'FileString':ModelString, 'FolderPathString':DataPathString }); if SYS.getIdStringWithDict(self.DataDict) in self.SimulationsH5pyFile.FilePointer: self.Simulations=self.SimulationsH5pyFile.FilePointer[SYS.getIdStringWithDict(self.DataDict)] self.SimulationsInt=len(self.Simulations['IFOutput']['&SpikesList']); else: print(self.SimulationsH5pyFile.FilePointer.keys()) self.SimulationsInt=0 print(str(self.SimulationsInt)+" Simulations were Found") self.SimulationsH5pyFile.FilePointer.close()
def loadSimulations(self,**Kwargs): ###H5PY PART !!!!!!!! #MetaDict And DataDict self.setDataDict() #Open the hdf5 self.SimulationsH5pyFile=SYS.H5pyFileClass().update( { 'FileString':ModelString, 'FolderPathString':DataPathString }); self.Simulations=self.SimulationsH5pyFile.FilePointer[SYS.getIdStringWithDict(self.DataDict)] self.SimulationsInt=len(self.Simulations['IFOutput']['&SpikesList']); #load the Outputs SimulationOutputs={} #Parse the data for SimulationInt in xrange(self.SimulationsInt): #Get the Data SimulationData=SYS.getListingDict(SYS.getDataDictWithDictAndIndexInt(self.Simulations,SimulationInt)) #convert into numpy array for OutputKey in ['RateOutput','IFOutput']: SimulationOutputs[OutputKey]={} for Key in SimulationData[OutputKey].keys(): SimulationOutputs[OutputKey][Key]=[] if type(SimulationData[OutputKey][Key]).__name__=="Dataset": SimulationOutputs[OutputKey][Key]=SimulationData[OutputKey][Key].value for ThingIdx in xrange(len(SimulationData[OutputKey][Key])): #if type(SimulationData[OutputKey][Key][ThingIdx])==list: if type(SimulationData[OutputKey][Key][ThingIdx]).__name__=="Dataset": SimulationOutputs[OutputKey][Key].append(SimulationOutputs[OutputKey][Key][ThingIdx].value); elif type(SimulationData[OutputKey][Key][ThingIdx])==dict: SimulationOutputs[OutputKey][Key].append({}) for _Key in SimulationData[OutputKey][Key][ThingIdx].keys(): SimulationOutputs[OutputKey][Key][ThingIdx][_Key]={} #if type(SimulationData[OutputKey][Key][ThingIdx][_Key])==list: if type(SimulationData[OutputKey][Key][ThingIdx][_Key]).__name__=="Dataset": #SimulationOutputs[OutputKey][Key][ThingIdx][_Key]=np.array(SimulationData[OutputKey][Key][ThingIdx][_Key]); SimulationOutputs[OutputKey][Key][ThingIdx][_Key]=SimulationData[OutputKey][Key][ThingIdx][_Key].value #print("end",SYS.getDictedDictWithVariable(SimulationOutputs)) #put in the SimulationList self.SimulationsList.append(Simulation(SimulationOutputs['RateOutput'],SimulationOutputs['IFOutput'])) #SYS._print(SYS.getDictedDictWithVariable(self.SimulationsList[0].__dict__)) self.SimulationsH5pyFile.FilePointer.close() #Transfer inputs self.IFNetwork.RateOutput=self.SimulationsList[0].RateOutput self.IFNetwork.IFOutputsList=map(lambda SimulationInt: self.SimulationsList[SimulationInt].IFOutput,xrange(len(self.SimulationsList)))
def deleteSimulations(self,**Kwargs): ###H5PY PART !!!!!!!! #MetaDict And DataDict #NewSimulationParameterSet=dict(map(lambda TagName:(TagName,getattr(self,TagName)),TagNames)) self.setDataDict() #SYS._print(self.DataDict) #Open the hdf5 self.SimulationsH5pyFile=SYS.H5pyFileClass().update( { 'FileString':ModelString, 'FolderPathString':DataPathString }) IdString=SYS.getIdStringWithDict(self.DataDict) #SimulationH5pyFile #print(SimulationH5pyFile.FilePointer.keys()) #print(SimulationH5pyFile.FilePointer[IdString]) self.SimulationsH5pyFile.delete(IdString) self.SimulationsH5pyFile.FilePointer.close()