Esempio n. 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
Esempio n. 2
0
#    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)