Ejemplo n.º 1
0
 def _buildMODFile(cls, modfile):
     outputFilename = modfile.getBuiltFilenameFull(ensureBuilt=False)
     
     if not Exists(outputFilename):
         LogMgr.info("Does not exist: building: %s" % outputFilename)
         modTxtFilename = WriteToFile(modfile.modtxt, suffix=".mod")
         ModFileCompiler.CheckModFileUnits(modTxtFilename)
         modDynFilename = BuildModFile(modTxtFilename, modfile=modfile)
         Move(modDynFilename, outputFilename) 
         
     else:
         LogMgr.info("Already Built") 
     return outputFilename
Ejemplo n.º 2
0
    def build_modfile(cls, modfile):
        output_filename = modfile.get_built_filename_full(ensure_built=False)

        if not os.path.exists(output_filename):
            LogMgr.info("Does not exist: building: %s" % output_filename)

            mod_txt_filename = FileIO.write_to_file(modfile.modtxt, suffix=".mod")
            ModFileCompiler.check_modfile_units(mod_txt_filename)
            mod_dyn_filename = _build_mod_file(mod_txt_filename, modfile=modfile)
            shutil.move(mod_dyn_filename, output_filename)
        else:

            LogMgr.info("Already Built")
        return output_filename
Ejemplo n.º 3
0
    def build_modfile(cls, modfile):
        output_filename = modfile.get_built_filename_full(ensure_built=False)

        if not os.path.exists(output_filename):
            LogMgr.info('Does not exist: building: %s' % output_filename)

            mod_txt_filename = FileIO.write_to_file(modfile.modtxt,
                                                    suffix='.mod')
            ModFileCompiler.check_modfile_units(mod_txt_filename)
            mod_dyn_filename = _build_mod_file(mod_txt_filename,
                                               modfile=modfile)
            shutil.move(mod_dyn_filename, output_filename)
        else:

            LogMgr.info('Already Built')
        return output_filename
Ejemplo n.º 4
0
def _pca(X):

    # Refactored out 'map' in August 2012
    # x_mean = array(map(sum, X.T)) / len(X)
    x_mean = array([sum(col) for col in X.T]) / len(X)

    x_ = X - x_mean
    x_t = numpy.dot(x_.T, x_) / len(X)
    (lam, vec) = linalg.eig(x_t)
    ans = zip(lam, vec.T)
    print ans
    try:
        ans.sort(reverse=True, key=lambda t: t[0])
    except Exception, e:
        print e
        assert False, 'What is the exception raised?!'
        LogMgr.warning('Unable to sort eigenvectors')
Ejemplo n.º 5
0
def _pca(X):

    # Refactored out 'map' in August 2012
    # x_mean = array(map(sum, X.T)) / len(X)
    x_mean = array([sum(col) for col in X.T])/len(X)

    x_ = X - x_mean
    x_t = numpy.dot(x_.T, x_) / len(X)
    (lam, vec) = linalg.eig(x_t)
    ans = zip(lam, vec.T)
    print ans
    try:
        ans.sort(reverse=True, key=lambda t: t[0])
    except Exception, e:
        print e
        assert False, 'What is the exception raised?!'
        LogMgr.warning('Unable to sort eigenvectors')
Ejemplo n.º 6
0
def main():
    
    bundleFilename = sys.argv[1]
    print "Loading Bundle from ", bundleFilename
    bundle = SimMetaDataBundle.loadFromFile(bundleFilename)
    
    # Load the random number seed
    if bundle.random_seed is not None:
        mfrandom.MFRandom.seed(bundle.random_seed) # = morphforge.core.mfrandom.MFRandom._seed
    
    
    result = bundle.getSimulation().Run(doSpawn=False)
    result.setSimulationTime(tStart, time.time())

    LogMgr.info("Simulation Ran OK. Post Processing:")
    
    bundle.doPostProcessingActions()
    LogMgr.info("Bundle Completed OK")
Ejemplo n.º 7
0
    def ensure_built(self):
        LogMgr.info("Ensuring Modfile is built")
        from morphforge.simulation.neuron.biophysics.modfilecompiler import ModFileCompiler

        ModFileCompiler().build_modfile(self, self.strict_modlunit)
Ejemplo n.º 8
0
 def ensureBuilt(self):
     LogMgr.info("Ensuring Modfile is built")
     from modfilecompiler import ModFileCompiler
     ModFileCompiler()._buildMODFile(self)
Ejemplo n.º 9
0
 def ensure_built(self):
     LogMgr.info('Ensuring Modfile is built')
     from modfilecompiler import ModFileCompiler
     ModFileCompiler().build_modfile(self)