How to use the morphio.SomaError function in morphio

To help you get started, we’ve selected a few morphio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BlueBrain / MorphIO / tests / test_9_surfaces.py View on Github external
4 * np.pi, places=2)

    # SWC three points cylinder
    assert_almost_equal(ImmutMorphology(os.path.join(_path, "soma_three_points_cylinder.swc")).soma.surface,
                        4 * np.pi * 81, places=2)
    assert_almost_equal(Morphology(os.path.join(_path, "soma_three_points_cylinder.swc")).soma.surface,
                        4 * np.pi * 81, places=2)

    # SWC consecutive cylinders  (3 cylinders along X)
    assert_almost_equal(ImmutMorphology(os.path.join(_path, "soma_cylinders.swc")).soma.surface,
                        2 * np.pi * 40 * 3, places=2)
    assert_almost_equal(Morphology(os.path.join(_path, "soma_cylinders.swc")).soma.surface,
                        2 * np.pi * 40 * 3, places=2)

    # SWC single frustum
    with assert_raises(SomaError):
        _ = Morphology(os.path.join(_path, "soma_single_frustum.swc")).soma.surface

    # SWC multiple frustums
    assert_almost_equal(ImmutMorphology(os.path.join(_path, "soma_multiple_frustums.swc")).soma.surface,
                        4164.610254415956, places=3)
    assert_almost_equal(Morphology(os.path.join(_path, "soma_multiple_frustums.swc")).soma.surface,
                        4164.610254415956, places=3)

    # SWC complex
    assert_almost_equal(ImmutMorphology(os.path.join(_path, "complexe.swc")).soma.surface,
                        13.980, places=2)
github BlueBrain / MorphIO / tests / test_1_swc.py View on Github external
def test_multiple_soma():
    with assert_raises(SomaError) as obj:
        Morphology(os.path.join(_path, 'multiple_soma.swc'))
    assert_substring(
        ''.join(['Multiple somata found: \n\n',
                 os.path.join(_path, 'multiple_soma.swc:2:error\n\n\n'),
                 os.path.join(_path, 'multiple_soma.swc:11:error')]),
        strip_color_codes(str(obj.exception)))
github BlueBrain / MorphIO / tests / test_8_all_morphologies.py View on Github external
from nose.tools import ok_, nottest
import subprocess

from morphio import Morphology, SomaError, RawDataError, MorphioError
from morphio.mut import Morphology as MutMorphology


bad_files = {'MorphologyRepository/Vincent Delattre/vd100714C/vd100714C_idA.ASC': SomaError,
             'MorphologyRepository/Vincent Delattre/vd100714B/vd100714B_idB.ASC': RawDataError,
             'MorphologyRepository/Shruti Muralidhar/sm100614a2/sm100614a2.ASC': RawDataError,
             'MorphologyRepository/Rodrigo Perin/rp120607_P_1-2/rp120607_P_1-2_idE.ASC': SomaError,
             'MorphologyRepository/Shruti Muralidhar/sm080904a1-6/._sm080904a1.asc': SomaError,
             'MorphologyRepository/Rodrigo Perin/rp110616_C1/rp110616_C1_idB.ASC': SomaError,

             'MorphologyRepository/Thomas Berger/tkb070202a2/tkb070202a2_ch0_cc2_n_tb_100x_3.asc': RawDataError,
             'MorphologyRepository/Thomas Berger/tkb061122a2/tkb061122a2_ch1_ct_n_rm_100x_1.asc': RawDataError,
             'MorphologyRepository/Thomas Berger/tkb051201b1/tkb051201b1_ch7_ct_n_es_100x_1.asc': RawDataError,

             'MorphologyRepository/Thomas Berger/tkb060123a2/tkb060123a2_ch2_ct_x_db_60x_2.asc': RawDataError,
             'MorphologyRepository/Cristina Radaelli/cr161021_A/cr161021_A_idB.ASC': RawDataError,
             'MorphologyRepository/Cristina Radaelli/cr161027_A/cr161027_A_idA.ASC': SomaError,
             'MorphologyRepository/Olivier Gschwend/og060829a1-4/og060829a1-4_idB.asc': RawDataError,
             'MorphologyRepository/Ani Gupta/C271097A/C271097A-I4.asc': RawDataError,
             'MorphologyRepository/Ani Gupta/C030397A/C030397A-P3.asc': RawDataError,
             'MorphologyRepository/Ani Gupta/C310897B/C310897B-P3.asc': RawDataError,
             'MorphologyRepository/Ani Gupta/C250298A/C250298A-I4.asc': RawDataError,
             'MorphologyRepository/Ani Gupta/C180298A/C180298A-I4.asc': RawDataError,
             'MorphologyRepository/Ani Gupta/C261296A/C261296A-P1.asc': RawDataError,
             'MorphologyRepository/Ani Gupta/C260897C/C260897C-P4.asc': RawDataError,
github BlueBrain / MorphIO / tests / test_1_swc.py View on Github external
def test_neurite_followed_by_soma():
    # Capturing the output to keep the unit test suite stdout clean
    with captured_output() as (_, err):
        with ostream_redirect(stdout=True, stderr=True):
            _test_swc_exception('''# An orphan neurite with a soma child
                           1 3 0 0 1 0.5 -1
                           2 3 0 0 2 0.5 1
                           3 3 0 0 3 0.5 2
                           4 3 0 0 4 0.5 3
                           5 3 0 0 5 0.5 4
                           6 1 0 0 0 3.0 5 # <-- soma child''',
                                SomaError,
                                'Found a soma point with a neurite as parent',
                                ':7:error')
github BlueBrain / MorphIO / tests / test_2_neurolucida.py View on Github external
def test_multiple_soma():
    _test_asc_exception('''
                             ("CellBody"
                             (Color Red)
                             (CellBody)
                             (1 1 0 1 S1)
                             (-1 1 0 1 S2)
                             )

                            ("CellBody"
                             (Color Red)
                             (CellBody)
                             (1 1 0 1 S1)
                             (-1 1 0 1 S2)
                             )''',
                        SomaError,
                        'A soma is already defined',
                        ':14:error')