def getMD5OfMorphology(m): #assert False # Is this Cruft?? Added Jan 2011 treemd5 = getMD5OfSection(m._dummysection) nameMD5 = getStringMD5Checksum(m.name) assert not m.metadata regionsMD5 = ",".join( [ getMD5OfRegion(r) for r in m.getRegions() ]) return getStringMD5Checksum(treemd5 + nameMD5 + regionsMD5)
def getMD5OfSection(s): #assert False # Is this Cruft?? Added Jan 2011 sectionString = " %2.2f %2.2f %2.2f %2.2f " regionsString = getMD5OfRegion(s.region) if s.region else "" childrenString = ",".join( [getMD5OfSection(s) for s in s.children] ) idString = "" if not s.idTag else getStringMD5Checksum(s.idTag) return getStringMD5Checksum( sectionString + regionsString + childrenString + idString)
def prepareSimBundle(cls, sim): simstring = cPickle.dumps(sim) simmd5sum = getStringMD5Checksum(simstring) simlocation = LocMgr.EnsureMakeDirs(LocMgr.getSimulationTmpDir() + simmd5sum[0:2]) simfilename = Join(simlocation, simmd5sum + cls.simsuffix) WriteToFile(s=simstring, filename=simfilename) b = SimMetaDataBundle(sim) return b
def getNeuronSuffix(self): # Cache the result: (We shouldn't have to do this, but there is a bug # with EqnSetChlNeuron::getModFileChangeble(), which is not returning the same thing # on each call for some reason. if self.cachedNeuronSuffix is None: # We take the hash off the parameters that will change the mod-file. # This means we don't duplicate millions of mod-files #print 'At getNeuronSuffix' mod_file_changeables = self.getModFileChangeables() mod_file_changeables[None] = str( type(mod_file_changeables).__str__ ) md5 = getStringMD5Checksum ( pickle.dumps(mod_file_changeables ) ) self.cachedNeuronSuffix = 'MIKETMP%sChl'%md5 #return 'MIKETMP%sChl'%md5 return self.cachedNeuronSuffix # Old Version: assert False return "MIKETMP%s%sChl" % (self.name, self.mm_neuronNumber)
def getMD5Hash(self): return getStringMD5Checksum(self.modtxt)
def __init__(self, sim): super(SimMetaDataBundleBase, self).__init__(sim=sim) self.simmd5sum = getStringMD5Checksum(cPickle.dumps(sim)) self.postsimulationactions = []
def getMD5OfRegion(r): #assert False # Is this Cruft?? Added Jan 2011 return getStringMD5Checksum(r.name)