コード例 #1
0
def _build_mod_file(modfilename,
                    output_dir=None,
                    build_dir=None,
                    modfile=None):

    build_dir = LocMgr().get_default_mod_builddir(
    ) if not build_dir else build_dir
    output_dir = LocMgr().get_default_mod_outdir(
    ) if not output_dir else output_dir

    if SettingsMgr.simulator_is_verbose():
        print ' - Building: ', modfilename

    modfilenamebase = os.path.basename(modfilename)
    sofilenamebase = modfilenamebase.replace('.mod', '.so')

    shutil.copyfile(modfilename, os.path.join(build_dir, modfilenamebase))

    so_filename_output = os.path.join(output_dir, sofilenamebase)

    # Move to new directory to build:
    initial_cwd = os.getcwd()
    os.chdir(build_dir)
    so_filename_build_short = _build_modfile_local(
        mod_filename_short=modfilenamebase, modfile=modfile)
    os.chdir(initial_cwd)

    # CopyFile to output cell_location:
    so_filename_build = os.path.join(build_dir, so_filename_build_short)
    if so_filename_build != so_filename_output:
        shutil.move(so_filename_build, so_filename_output)
    return so_filename_output
コード例 #2
0
def main():

    # Clear out the old directory:
    if os.path.exists(html_output_dir):
        shutil.rmtree(html_output_dir)
    LocMgr.ensure_dir_exists(html_output_dir)

    root_html = Join(html_output_dir, "index.html")

    data = []
    for xmlfile in NeuroMLDataLibrary.get_channelMLV1FilesWithSingleChannel():


        #class NeuroMLDataLibrary(object):
#
#            def get_channelMLV1Files(self):


        #if xmlfile != "/home/michael/hw_to_come/morphforge/src/test_data/NeuroML/V1/example_simulations/GranCellLayer_NeuroML/Golgi_NaF_CML.xml":
        #        continue


        #if xmlfile != "/home/michael/hw_to_come/morphforge/src/test_data/NeuroML/V1/example_simulations/MainenEtAl_PyramidalCell_NeuroML/K_ChannelML.xml":
        #        continue
        #if xmlfile != "/home/michael/hw_to_come/morphforge/src/test_data/NeuroML/V1/example_simulations/CA1PyramidalCell_NeuroML/kdr.xml":
        #    continue

        # Compare:
        data.append(compareNeuroMLChl(xmlfile))

        # Re-update the html:
        with open(root_html, "w") as f:
            f.write(Template(root_html_tmpl, {'data': data}).respond())
コード例 #3
0
    def _write_to_file(self, bundlefilename=None):
        bundleloc = LocMgr.get_simulation_tmp_dir()
        bundlesuffix = '.bundle'

        if bundlefilename is None:
            bundle_dir = bundleloc + '/' + self.get_sim_md5sum()[0:2] + '/'
            bundle_dir = LocMgr.ensure_dir_exists(bundle_dir)
            bundle_fname = self.get_sim_md5sum() + bundlesuffix
            bundlefilename = os.path.join(bundle_dir, bundle_fname)

        FileIO.write_to_file(txt=cPickle.dumps(self), filename=bundlefilename)
        # print 'bundlefilename', bundlefilename
        return bundlefilename
コード例 #4
0
ファイル: builders.py プロジェクト: bmerrison/morphforge
    def prepare_sim_bundle(cls, sim):

        simstring = cPickle.dumps(sim)
        simmd5sum = StrUtils.get_hash_md5(simstring)

        simloc = LocMgr.get_simulation_tmp_dir() + simmd5sum[0:2]
        simloc = LocMgr.ensure_dir_exists(simloc)
        simfilename = Join(simloc, simmd5sum + cls.simsuffix)

        FileIO.write_to_file(txt=simstring, filename=simfilename)

        bundle = SimMetaDataBundle(sim)
        return bundle
コード例 #5
0
    def prepare_sim_bundle(cls, sim):

        simstring = cPickle.dumps(sim)
        simmd5sum = StrUtils.get_hash_md5(simstring)

        simloc = LocMgr.get_simulation_tmp_dir() + simmd5sum[0:2]
        simloc = LocMgr.ensure_dir_exists(simloc)
        simfilename = Join(simloc, simmd5sum + cls.simsuffix)

        FileIO.write_to_file(txt=simstring, filename=simfilename)

        bundle = SimMetaDataBundle(sim)
        return bundle
コード例 #6
0
ファイル: simbundle.py プロジェクト: NeuroArchive/morphforge
    def _write_to_file(self, bundlefilename=None):
        bundleloc = LocMgr.get_simulation_tmp_dir()
        bundlesuffix = '.bundle'

        if bundlefilename is None:
            bundle_dir = bundleloc + '/' + self.get_sim_md5sum()[0:2] + '/'
            bundle_dir = LocMgr.ensure_dir_exists(bundle_dir)
            bundle_fname = self.get_sim_md5sum() + bundlesuffix
            bundlefilename = os.path.join(bundle_dir, bundle_fname)

        FileIO.write_to_file(txt=cPickle.dumps(self),
                             filename=bundlefilename)
        # print 'bundlefilename', bundlefilename
        return bundlefilename
コード例 #7
0
ファイル: __init__.py プロジェクト: bmerrison/morphforge
 def save_dot(cls, graph, format, **kwargs):
     from morphforge.core import ObjectLabeller
     name = ObjectLabeller.get_next_unamed_object_name(type(graph))
     tmp_dir = LocMgr.get_tmp_path()
     fname = '%s/dotout_%s.%s' % (tmp_dir, name, format)
     graph.write_pdf(fname, **kwargs)
     return fname
コード例 #8
0
ファイル: __init__.py プロジェクト: NeuroArchive/morphforge
 def save_dot(cls, graph, format, **kwargs):
     from morphforge.core import ObjectLabeller
     name = ObjectLabeller.get_next_unamed_object_name(type(graph))
     tmp_dir = LocMgr.get_tmp_path()
     fname = '%s/dotout_%s.%s' % (tmp_dir, name, format)
     graph.write_pdf(fname, **kwargs)
     return fname
コード例 #9
0
ファイル: simbundle.py プロジェクト: unidesigner/morphforge
    def __init__(self, sim, location=LocMgr.getSimulationTmpDir(), suffix=".neuronsim.pickle"):
        
        super(MixinSimLoc_AsFile, self).__init__()
        
        self.location = location
        self.suffix = suffix
        self.picklestring = cPickle.dumps(sim)

        self.simfilename = None
        self.sim_postload = None
コード例 #10
0
    def write_to_file_and_get_exec_string(
            self,
            bundlefilename=None,
            simulation_binary_file='SimulateBundle.py'):

        bundle_fname = self._write_to_file(bundlefilename=bundlefilename)
        bundle_exec_bin = os.path.join(LocMgr.get_bin_path(),
                                       simulation_binary_file)
        sim_cmd = '%s %s' % (bundle_exec_bin, bundle_fname)
        return (bundle_fname, sim_cmd)
コード例 #11
0
ファイル: simbundle.py プロジェクト: NeuroArchive/morphforge
    def write_to_file_and_get_exec_string(self,
            bundlefilename=None,
            simulation_binary_file='SimulateBundle.py'):

        bundle_fname = self._write_to_file(
                        bundlefilename=bundlefilename)
        bundle_exec_bin = os.path.join(
                               LocMgr.get_bin_path(),
                               simulation_binary_file)
        sim_cmd = '%s %s' % (bundle_exec_bin, bundle_fname)
        return (bundle_fname, sim_cmd)
コード例 #12
0
ファイル: simbundle.py プロジェクト: unidesigner/morphforge
    def writeToFile(self, bundlefilename=None):
        bundleloc = LocMgr.getSimulationTmpDir()
        bundlesuffix = ".bundle"
        
        if not bundlefilename:            
            loc = bundlefilename = LocMgr.EnsureMakeDirs(bundleloc + "/" + self.getSimMD5Sum()[0:2])
            bundlefilename = loc + "/" + self.getSimMD5Sum() + bundlesuffix
            #print "Bundle Filename", bundlefilename

        WriteToFile(s=cPickle.dumps(self) , filename=bundlefilename)
        return bundlefilename
コード例 #13
0
ファイル: builders.py プロジェクト: unidesigner/morphforge
 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
コード例 #14
0
def main():

    # Clear out the old directory:
    if os.path.exists(html_output_dir):
        shutil.rmtree(html_output_dir)
    LocMgr.ensure_dir_exists(html_output_dir)

    root_html = Join(html_output_dir, "index.html")

    data = []
    for xmlfile in NeuroMLDataLibrary.get_channelMLV1FilesWithSingleChannel():

        # Compare:
        data.append(compareNeuroMLChl(xmlfile))

        # Re-update the html:
        with open(root_html, "w") as f:
            f.write(Template(root_html_tmpl, {'data': data}).respond())

        #break
    print 'Done'
コード例 #15
0
ファイル: builders.py プロジェクト: NeuroArchive/morphforge
    def build_std_pickler(cls, sim):

        reslocation = LocMgr.get_simulation_results_tmp_dir()

        bundle = MetaDataBundleBuilder.prepare_sim_bundle(sim)
        # Save the random number seed
        bundle.random_seed = morphforge.core.mfrandom.MFRandom.get_seed()
        md5sum = bundle.get_sim_md5sum()
        resfilename = Join(reslocation, '%s/' % md5sum[:2]+'/', md5sum
                           + cls.ressuffix)

        # Save the results to pickle file:
        bundle.add_postprocessing_action(PostSimulationActionPickleSimulation(resfilename))

        return (bundle, resfilename)
コード例 #16
0
    def build_std_pickler(cls, sim):

        reslocation = LocMgr.get_simulation_results_tmp_dir()

        bundle = MetaDataBundleBuilder.prepare_sim_bundle(sim)
        # Save the random number seed
        bundle.random_seed = morphforge.core.mfrandom.MFRandom.get_seed()
        md5sum = bundle.get_sim_md5sum()
        resfilename = Join(reslocation, '%s/' % md5sum[:2] + '/',
                           md5sum + cls.ressuffix)

        # Save the results to pickle file:
        bundle.add_postprocessing_action(
            PostSimulationActionPickleSimulation(resfilename))

        return (bundle, resfilename)
コード例 #17
0
ファイル: builders.py プロジェクト: unidesigner/morphforge
    def buildStdPickler(cls, sim):
 
        from morphforge.simulation.simulationmetadatabundle.postsimulation import PostSimulationActionPickleSimulation
         
        reslocation = LocMgr.getSimulationResultsTmpDir() 
        

        b = MetaDataBundleBuilder.prepareSimBundle(sim)
        # Save the random number seed
        b.random_seed = morphforge.core.mfrandom.MFRandom._seed
        md5sum = b.getSimMD5Sum()
        resfilename = Join(reslocation, '%s/'%(md5sum[:2]) , md5sum + cls.ressuffix)
        
        # Save the results to pickle file:
        b.addPostProcessingAction(PostSimulationActionPickleSimulation(resfilename))
        
        return b, resfilename
コード例 #18
0
    def _trace_from_string(cls, srcstr):
        parser = ply.yacc.yacc(tabmodule='tracestring_parsetab',
                                outputdir=LocMgr.ensure_dir_exists('/tmp/parsetabs/'),
                                debug=SettingsMgr.get_ply_yacc_debug_flag())

        (unit, trace_prototypes) = parser.parse(srcstr, lexer=l)

        # Copy accross the start values:
        start_value = 0
        for prototype in trace_prototypes:
            prototype.start_value = start_value
            piece = prototype.toTracePiece()
            start_value = piece.get_end_value()

        # Convert to pieces
        pieces = [trace_prototype.toTracePiece() for trace_prototype in trace_prototypes]
        trace = TracePiecewise(pieces=pieces, comment='Src: %s' % srcstr)
        trace = trace * (1.0 * unit)
        return trace
コード例 #19
0
    def _trace_from_string(cls, srcstr):
        parser = ply.yacc.yacc(
            tabmodule='tracestring_parsetab',
            outputdir=LocMgr.ensure_dir_exists('/tmp/parsetabs/'),
            debug=SettingsMgr.get_ply_yacc_debug_flag())

        (unit, trace_prototypes) = parser.parse(srcstr, lexer=l)

        # Copy accross the start values:
        start_value = 0
        for prototype in trace_prototypes:
            prototype.start_value = start_value
            piece = prototype.toTracePiece()
            start_value = piece.get_end_value()

        # Convert to pieces
        pieces = [
            trace_prototype.toTracePiece()
            for trace_prototype in trace_prototypes
        ]
        trace = TracePiecewise(pieces=pieces, comment='Src: %s' % srcstr)
        trace = trace * (1.0 * unit)
        return trace
コード例 #20
0
ファイル: modfile.py プロジェクト: mikehulluk/morphforge
 def get_built_filename_full(self, ensure_built=True):
     if ensure_built:
         self.ensure_built()
     return Join(LocMgr.get_default_mod_outdir(), self.get_built_filename_short(ensure_built=ensure_built))
コード例 #21
0
    
def p_unit_simple(p):
    'unit : ID'
    p[0] = unit_from_string( p[1] )
    

def p_unit_simplenumber(p):
    'unit : ID NUMBER'
    u = unit_from_string( p[1] )
    p[0] = np.power(u, p[2] )


def p_error(p):
    print "Syntax error in input!"
    assert False
    


parser = yacc.yacc(tabmodule = 'unitsparser_parsetab.py', outputdir=LocMgr.getPLYParseTabLocation('unitsparser'), debug=SettingsMgr.getPLYYaccDebugFlag()  )


def parse(s):
    r = parser.parse(s, lexer=lexer, )
    return r


 
                   


コード例 #22
0
def compareNeuroMLChl(xmlFile):
    model, chl_type = os.path.splitext(xmlFile)[0].split("/")[-2:]
    print model, chl_type

    op_dir = LocMgr.ensure_dir_exists(Join(html_output_dir, model, chl_type))
    op_html = Join(op_dir, "index.html")
    c = ComparisonResult(xmlfile=xmlFile, op_file = op_html, same_chl=True, exception=None)

    try:

        # Make the NeuroUnits channel:
        chl_neuro = NeuroML_Via_NeuroUnits_ChannelNEURON(xml_filename=xmlFile,  )
        c.chl_neurounits = chl_neuro


        op_pdf_file = Join(op_dir, 'Op1.pdf')
        #WriteToPDF(eqnset = chl_neuro.eqnset, filename = op_pdf_file)
        c.chl_neurounits_pdf = op_pdf_file


        # Make the NeuroML channel:
        xsl_file = "/home/michael/srcs/neuroml/CommandLineUtils/ChannelMLConverter/ChannelML_v1.8.1_NEURONmod.xsl"
        chl_xsl = NeuroML_Via_XSL_ChannelNEURON(xml_filename=xmlFile, xsl_filename=xsl_file,  )
        c.chl_xsl = chl_xsl
        c.chl_xsl_hoc = []


        chl_neuro_res = simulate_chl_all(chl_neuro)
        chl_xsl_res = simulate_chl_all(chl_xsl)
        c.chl_neurounit_hoc = []


        for i, (rN, rX) in enumerate(zip(chl_neuro_res, chl_xsl_res)):

            c.chl_neurounit_hoc.append(rN.hocfilename )
            c.chl_xsl_hoc.append(rX.hocfilename )

            tN = rN.get_trace("CurrentClamp").convert_to_fixed(dt=unit("1.01:ms"))
            tX = rX.get_trace("CurrentClamp").convert_to_fixed(dt=unit("1.01:ms"))

            # Compare current traces:
            tN._data[np.fabs(tN.time_pts_ms - 0) <0.05] *=0
            tX._data[np.fabs(tX.time_pts_ms - 0) <0.05] *=0
            tN._data[np.fabs(tN.time_pts_ms - 200) <0.05] *=0
            tX._data[np.fabs(tX.time_pts_ms - 200) <0.05] *=0
            tN._data[np.fabs(tN.time_pts_ms - 700) <0.05] *=0
            tX._data[np.fabs(tX.time_pts_ms - 700) <0.05] *=0
            print "TR1"
            f = QuantitiesFigure()
            ax1 = f.add_subplot(4, 1, 1)
            ax2 = f.add_subplot(4, 1, 2)
            ax3 = f.add_subplot(4, 1, 3)
            ax4 = f.add_subplot(4, 1, 4)
            ax1.plotTrace(tN, color='b')
            ax1.plotTrace(tX, color='g', linewidth=20, alpha=0.2)
            ax2.plotTrace(tN.window((200, 250)*pq.ms), color='b')
            ax2.plotTrace(tX.window((200, 250)*pq.ms), color='g', linewidth=20, alpha=0.2)

            num = (tN-tX)
            denom = (tN+tX)
            diff = num/denom
            ax3.plotTrace(diff, color='r')

            ax4.plotTrace(rN.get_trace('SomaVoltage'), color='m')
            ax4.plotTrace(rX.get_trace('SomaVoltage'), color='m', linewidth=20, alpha=0.2)

            if num.max()[1] > unit("0.1:pA"):
                c.same_chl = False

            out_im = Join(op_dir, "out_im%03d" % i)
            pylab.savefig(out_im+".png")
            pylab.savefig(out_im+".pdf")
            c.output_image_files.append(out_im)
            pylab.close()

        c.finished_ok=True



    except NeuroUnitsImportNeuroMLNotImplementedException, e:
        print 'Exception caught:', e

        s = StringIO.StringIO()
        traceback.print_exc(file=s)
        c.exception_long=s.getvalue()
        c.exception="%s (%s)"%(str(e), str(type(e)))
        c.same_chl = False
        c.finished_ok=False
コード例 #23
0
ファイル: modfile.py プロジェクト: unidesigner/morphforge
 def getBuiltFilenameFull(self, ensureBuilt=True):
     if ensureBuilt: self.ensureBuilt()
     return Join(LocMgr.getDefaultModOutDir(), self.getBuiltFilenameShort(ensureBuilt=ensureBuilt))  
コード例 #24
0
    def buildsectionsurface(cls, s):
        import gts
        from morphforge.core import LocMgr
        from os.path import join as Join
        print 'Building Mesh'

        working_dir = LocMgr.ensure_dir_exists('/tmp/mf/mesh/')
        fTemp1 = Join(working_dir, 'pts.txt')
        fTemp2 = Join(working_dir, 'pts.off')
        fTemp3 = Join(working_dir, 'pts.stl')
        fTemp2b = Join(working_dir, 'pts_postSub.off')
        fTemp4 = Join(working_dir, 'pts.gts')

        nstep = 5
        print 'Building Spheres'
        distal_offset = np.array((0.05, 0.05, 0.05))
        ptsP = GeomTools.produce_sphere(centre=s.get_proximal_npa3(),
                radius=s.p_r, n_steps=nstep)
        ptsD = GeomTools.produce_sphere(centre=s.get_distal_npa3()
                + distal_offset, radius=s.d_r, n_steps=nstep)

        print 'Removing Close Points'
        pts = cls.only_pts_at_min_dist(ptsP + ptsD, min_dist=0.01)

        print 'Writing:', fTemp2
        with open(fTemp1, 'w') as f:
            f.write('3 %d\n' % len(pts))
            np.savetxt(f, np.array(pts))

        if os.path.exists(fTemp2):
            os.unlink(fTemp2)
        os.system('qhull T1 QJ o < %s > %s' % (fTemp1, fTemp2))

        # Don't do the subdivision, just copy the files:
        os.system('cp %s %s' % (fTemp2, fTemp2b))
        # fTemp2 = fTemp2b

        f = open(fTemp2b).read().split()
        (nVertex, nFace, nEdge) = [int(i) for i in f[1:4]]
        assert nVertex > 5
        vertices = np.array([float(t) for t in f[4:4 + nVertex
                            * 3]]).reshape(nVertex, 3)

        triangles = np.array([int(t) for t in f[4 + nVertex * 3:]])
        triangles = triangles.reshape((nFace, 4))
        triangles = triangles[:, (1, 2, 3)]

        print 'Writing STL'
        with open(fTemp3, 'w') as fSTL:
            fSTL.write('solid name\n')
            for i in range(triangles.shape[0]):
                (a, b, c) = triangles[i, :]

                fSTL.write('facet normal 0 0 0\n')
                fSTL.write('outer loop \n')
                fSTL.write('vertex %f %f %f\n' % (vertices[a, 0], vertices[a, 1], vertices[a, 2]))
                fSTL.write('vertex %f %f %f\n' % (vertices[b, 0], vertices[b, 1], vertices[b, 2]))
                fSTL.write('vertex %f %f %f\n' % (vertices[c, 0], vertices[c, 1], vertices[c, 2]))
                fSTL.write('endloop \n')
                fSTL.write('endfacet\n')

            fSTL.write('solid end')

        print 'Running stl2gts...'
        if os.path.exists(fTemp4):
            os.unlink(fTemp4)

        os.system('stl2gts < %s > %s' % (fTemp3, fTemp4))

        assert os.path.exists(fTemp4)

        import gts
        f = open(fTemp4)
        s = gts.Surface()
        s = gts.read(f)

        s.cleanup()
        assert s.is_closed()
        assert s.is_orientable()

        # s.tessellate()
        return s
コード例 #25
0
    def buildsectionsurface(cls, s):
        import gts
        from morphforge.core import LocMgr
        from os.path import join as Join
        print 'Building Mesh'

        working_dir = LocMgr.ensure_dir_exists('/tmp/mf/mesh/')
        fTemp1 = Join(working_dir, 'pts.txt')
        fTemp2 = Join(working_dir, 'pts.off')
        fTemp3 = Join(working_dir, 'pts.stl')
        fTemp2b = Join(working_dir, 'pts_postSub.off')
        fTemp4 = Join(working_dir, 'pts.gts')

        nstep = 5
        print 'Building Spheres'
        distal_offset = np.array((0.05, 0.05, 0.05))
        ptsP = GeomTools.produce_sphere(centre=s.get_proximal_npa3(),
                                        radius=s.p_r,
                                        n_steps=nstep)
        ptsD = GeomTools.produce_sphere(centre=s.get_distal_npa3() +
                                        distal_offset,
                                        radius=s.d_r,
                                        n_steps=nstep)

        print 'Removing Close Points'
        pts = cls.only_pts_at_min_dist(ptsP + ptsD, min_dist=0.01)

        print 'Writing:', fTemp2
        with open(fTemp1, 'w') as f:
            f.write('3 %d\n' % len(pts))
            np.savetxt(f, np.array(pts))

        if os.path.exists(fTemp2):
            os.unlink(fTemp2)
        os.system('qhull T1 QJ o < %s > %s' % (fTemp1, fTemp2))

        # Don't do the subdivision, just copy the files:
        os.system('cp %s %s' % (fTemp2, fTemp2b))
        # fTemp2 = fTemp2b

        f = open(fTemp2b).read().split()
        (nVertex, nFace, nEdge) = [int(i) for i in f[1:4]]
        assert nVertex > 5
        vertices = np.array([float(t) for t in f[4:4 + nVertex * 3]
                             ]).reshape(nVertex, 3)

        triangles = np.array([int(t) for t in f[4 + nVertex * 3:]])
        triangles = triangles.reshape((nFace, 4))
        triangles = triangles[:, (1, 2, 3)]

        print 'Writing STL'
        with open(fTemp3, 'w') as fSTL:
            fSTL.write('solid name\n')
            for i in range(triangles.shape[0]):
                (a, b, c) = triangles[i, :]

                fSTL.write('facet normal 0 0 0\n')
                fSTL.write('outer loop \n')
                fSTL.write('vertex %f %f %f\n' %
                           (vertices[a, 0], vertices[a, 1], vertices[a, 2]))
                fSTL.write('vertex %f %f %f\n' %
                           (vertices[b, 0], vertices[b, 1], vertices[b, 2]))
                fSTL.write('vertex %f %f %f\n' %
                           (vertices[c, 0], vertices[c, 1], vertices[c, 2]))
                fSTL.write('endloop \n')
                fSTL.write('endfacet\n')

            fSTL.write('solid end')

        print 'Running stl2gts...'
        if os.path.exists(fTemp4):
            os.unlink(fTemp4)

        os.system('stl2gts < %s > %s' % (fTemp3, fTemp4))

        assert os.path.exists(fTemp4)

        import gts
        f = open(fTemp4)
        s = gts.Surface()
        s = gts.read(f)

        s.cleanup()
        assert s.is_closed()
        assert s.is_orientable()

        # s.tessellate()
        return s
コード例 #26
0
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
#  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ----------------------------------------------------------------------


from morphforge.core import LocMgr, Join

hostlistfilename = Join(LocMgr.get_bin_path(), "DellMachines.txt")
hostlistfile = open(hostlistfilename)

hosts = [l.strip() for l in hostlistfile.readlines() if not l.startswith("#") and l.strip() != ""]
hosts = []


print len(hosts)

print hosts
#assert False


import os
import re
import time
コード例 #27
0
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
#  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ----------------------------------------------------------------------

from morphforge.core import LocMgr, Join

hostlistfilename = Join(LocMgr.get_bin_path(), "DellMachines.txt")
hostlistfile = open(hostlistfilename)

hosts = [
    l.strip() for l in hostlistfile.readlines()
    if not l.startswith("#") and l.strip() != ""
]
hosts = []

print len(hosts)

print hosts
#assert False

import os
import re
コード例 #28
0
 def save_to_file(self, filename):
     res_string = pickle.dumps(self)
     return FileIO.write_to_file(
         res_string,
         filename=filename,
         filedirectory=LocMgr.get_simulation_tmp_dir())
コード例 #29
0
ファイル: morphology020.py プロジェクト: bmerrison/morphforge
#    distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
#  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ----------------------------------------------------------------------
"""Loading from SWC and rendering with Matplotlib.
This example shows loading in a morphology from an SWC file and then viewing it in matplotlib,
using Principle Component Analysis (PCA) to align the features of the morphology to the plot
window.
"""

from morphforge.core import LocMgr, Join
from morphforge.morphology.ui import MatPlotLibViewer
from morphforge.morphology.core import MorphologyTree

testSrcsPath = LocMgr().get_test_srcs_path()
srcSWCFile = Join(testSrcsPath, "swc_files/28o_spindle20aFI.CNG.swc")

m = MorphologyTree.fromSWC(src=open(srcSWCFile))
MatPlotLibViewer(m, use_pca=False)
MatPlotLibViewer(m, use_pca=True)
コード例 #30
0
ファイル: simbundle.py プロジェクト: unidesigner/morphforge
 def writeToFileAndGetExecString(self, bundlefilename=None, simBinFile="SimulateBundle.py"):
     
     bundlefilename = self.writeToFile(bundlefilename=bundlefilename)
     simCmd = Join(LocMgr.getBinPath(), simBinFile) + " " + bundlefilename
     return bundlefilename, simCmd
コード例 #31
0
 def save_to_file(self, filename):
     res_string = pickle.dumps(self)
     return FileIO.write_to_file(
             res_string,
             filename=filename,
             filedirectory=LocMgr.get_simulation_tmp_dir())
コード例 #32
0
 def get_built_filename_full(self, ensure_built=True):
     if ensure_built:
         self.ensure_built()
     return Join(LocMgr.get_default_mod_outdir(),
                 self.get_built_filename_short(ensure_built=ensure_built))
コード例 #33
0
ファイル: SummariseChls.py プロジェクト: bmerrison/morphforge
# are met:
#
#  - Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#  - Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
#  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ----------------------------------------------------------------------

from morphforge.simulationanalysis.summaries.mmsummariser import MembraneMechanismSummariser
from morphforge.core import LocMgr

import morphforgecontrib
import modelling.rbmodelling2

loc = LocMgr.get_default_channel_summary_output_dir()
MembraneMechanismSummariser.summarise_all(loc)