示例#1
0
    def __init__(self, src_zip_file, dst_zip_file):
        self.color_aliases = {}
        self.region_color_defaults = {}
        self.currentplyscope = None

        self.global_options = {
                    #MeshGenerationOptions.minimum_diameter: 1.0
                    }

        self.src_zip_file = src_zip_file
        self.dst_zip_file = dst_zip_file
        self.op_files = []
        self.op_dir = '/tmp/mf/meshbuilder/'
        LocMgr.ensure_dir_exists(self.op_dir)
示例#2
0
    def __init__(self, src_zip_file, dst_zip_file):
        self.color_aliases = {}
        self.region_color_defaults = {}
        self.currentplyscope = None

        self.global_options = {
            #MeshGenerationOptions.minimum_diameter: 1.0
        }

        self.src_zip_file = src_zip_file
        self.dst_zip_file = dst_zip_file
        self.op_files = []
        self.op_dir = '/tmp/mf/meshbuilder/'
        LocMgr.ensure_dir_exists(self.op_dir)
示例#3
0
    def testComparisonFailureTransplantingALeafNode(self):
        """Remap each leaf node in a complex swc file, onto
        different internal nodes of the morphology,
        and check that the morphology is considered different
        """

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

        m = MorphologyArray.fromSWC(srcSWCFile)

        # Find the leaf nodes:
        leaf_nodes = m.get_leaf_vertices_indices()

        for new_parent in [0, 10, 20, leaf_nodes[-1]]:

            for l in leaf_nodes[:-1]:
                v = m._vertices.copy()
                c = m._connectivity.copy()

                # Rewrite the connectivity matrix, mapping the
                # leaf to a new_parent:
                c[c == l] = new_parent

                mNew = MorphologyArray(vertices=v, connectivity=c)
                assert not MorphArrayComparison.are_same(
                    m, mNew, max_node_distance=0.00001)
示例#4
0
    def testComparisonFailureAddingEpsilon2(self):
        """Load and complex .swc file, and
        change each [x, y, z, r] value in the vertices matrix
        individually, to check that it is not the same.
        """
        testSrcsPath = LocMgr().get_test_srcs_path()
        srcSWCFile = Join(testSrcsPath, "swc_srcs/28o_spindle20aFI.CNG.swc")

        m = MorphologyArray.fromSWC(srcSWCFile)
        MFRandom.seed(0)
        for i in range(len(m)):
            print i, len(m)
            for j in range(4):

                # Only test 2% of cases:
                if not np.random.rand() < 0.02:
                    continue

                m1 = MorphologyArray.fromSWC(srcSWCFile)
                m1._vertices[i, j] = m1._vertices[i, j] + 0.01
                assert MorphArrayComparison.are_same(m,
                                                     m1,
                                                     max_node_distance=0.02)
                assert not MorphArrayComparison.are_same(
                    m, m1, max_node_distance=0.005)
示例#5
0
    def config(cls):
        from morphforge.core.mgrs.locmgr import LocMgr

        if cls._initialised_state == LogMgrState.Configuring:
            return
        if cls._initialised_state == LogMgrState.Ready:
            return

        cls._initialised_state = LogMgrState.Configuring

        logfilename = os.path.join(LocMgr.get_log_path(), 'log.html')
        logging.basicConfig(filename=logfilename, level=logging.INFO)

        cls._initialised_state = LogMgrState.Ready

        cls.info_from_logger('Logger Started OK')
示例#6
0
import subprocess
import glob
import re
import itertools
from glob import glob as Glob
from os.path import join as Join

from Cheetah.Template import Template



import mreorg
from morphforge.core.mgrs.locmgr import LocMgr


root = os.path.normpath( os.path.join( LocMgr.get_root_path(), "..") )
examples_src_dir = os.path.join(root, "src/morphforgeexamples/")


#"/home/michael/hw/morphforge/doc"
doc_src_dir = os.path.normpath( os.path.join(root, "doc") )

examples_dst_dir =  os.path.join(root, "doc/srcs_generated_examples")
examples_dst_dir_images =  os.path.join(root, "doc/srcs_generated_examples/images/")

examples_build_dir = os.path.join( LocMgr.get_tmp_path(), "mf_doc_build")
examples_build_dir_image_out = os.path.join( examples_build_dir,  "images/")


dirs = ['morphology', 'singlecell_simulation', 'multicell_simulation', 'advanced_examples']#, 'assorted' ]
example_subdirs = [ d for d in os.listdir(examples_src_dir) if d.startswith("""exset""") ]
def parse_tagselector_string(s):
    if not _ParseCache.lex:
        _ParseCache.lex = ply.lex.lex()
    if not _ParseCache.yacc:
        _ParseCache.yacc = ply.yacc.yacc(tabmodule='tagselectorparser_parsetab', outputdir=LocMgr.ensure_dir_exists('/tmp/parsetabs/'), debug=0, write_tables=1, optimize=1)
    return _ParseCache.yacc.parse(s, lexer=_ParseCache.lex.clone())