Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Use MorphIO by default and fallback to internal loader in case of failure #71

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Feat: Use MorphIO by default and fallbacks to internal loader in case…

f41fed4
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Draft

Feat: Use MorphIO by default and fallback to internal loader in case of failure #71

Feat: Use MorphIO by default and fallbacks to internal loader in case…
f41fed4
Select commit
Loading
Failed to load commit list.
GitHub Actions / JUnit Test Report failed Sep 28, 2023 in 0s

92 tests run, 88 passed, 0 skipped, 4 failed.

Annotations

Check failure on line 174 in .tox/docs/lib/python3.9/site-packages/numpy/lib/tests/test_io.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_io.test_upper_case[True]

ValueError: The file extension must be in ['asc', 'h5', 'swc']
Raw output
DATA_PATH = '/home/runner/work/TMD/TMD/tests/data', use_morphio = True

    @pytest.mark.parametrize("use_morphio", [True, False])
    def test_upper_case(DATA_PATH, use_morphio):
        """Read files with upper-case extensions."""
        path = Path(DATA_PATH) / "upper_case_names"
        if use_morphio:
            files = path
        else:
            files = [i for i in path.iterdir() if i.suffix.lower() != ".asc"]
>       io.load_population(files, use_morphio=use_morphio)

tests/test_io.py:174: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tmd/io/io.py:252: in load_population
    pop.append_neuron(load_neuron(filename, user_tree_types=user_tree_types))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

input_file = '/home/runner/work/TMD/TMD/tests/data/upper_case_names/Sample2.SwC'
user_tree_types = None

    def load_neuron(
        input_file, user_tree_types=None, *, line_delimiter="\n", soma_type=None, remove_duplicates=True
    ):
        """I/O method to load an 'asc', 'h5' or 'swc' file into a Neuron object.
    
        Args:
            input_file (Union[str, morphio.Morphology]):
                Filepath or morphio object
    
        Returns:
            neuron (Neuron): tmd Neuron object
    
        """
        ext = os.path.splitext(input_file)[-1][1:]
        if ext not in ("h5", "swc", "asc"):
>           raise ValueError("The file extension must be in ['asc', 'h5', 'swc']")
E           ValueError: The file extension must be in ['asc', 'h5', 'swc']

tmd/io/io.py:196: ValueError

Check failure on line 174 in .tox/docs/lib/python3.9/site-packages/numpy/lib/tests/test_io.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_io.test_upper_case[False]

ValueError: The file extension must be in ['asc', 'h5', 'swc']
Raw output
DATA_PATH = '/home/runner/work/TMD/TMD/tests/data', use_morphio = False

    @pytest.mark.parametrize("use_morphio", [True, False])
    def test_upper_case(DATA_PATH, use_morphio):
        """Read files with upper-case extensions."""
        path = Path(DATA_PATH) / "upper_case_names"
        if use_morphio:
            files = path
        else:
            files = [i for i in path.iterdir() if i.suffix.lower() != ".asc"]
>       io.load_population(files, use_morphio=use_morphio)

tests/test_io.py:174: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tmd/io/io.py:252: in load_population
    pop.append_neuron(load_neuron(filename, user_tree_types=user_tree_types))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

input_file = PosixPath('/home/runner/work/TMD/TMD/tests/data/upper_case_names/Sample2.SwC')
user_tree_types = None

    def load_neuron(
        input_file, user_tree_types=None, *, line_delimiter="\n", soma_type=None, remove_duplicates=True
    ):
        """I/O method to load an 'asc', 'h5' or 'swc' file into a Neuron object.
    
        Args:
            input_file (Union[str, morphio.Morphology]):
                Filepath or morphio object
    
        Returns:
            neuron (Neuron): tmd Neuron object
    
        """
        ext = os.path.splitext(input_file)[-1][1:]
        if ext not in ("h5", "swc", "asc"):
>           raise ValueError("The file extension must be in ['asc', 'h5', 'swc']")
E           ValueError: The file extension must be in ['asc', 'h5', 'swc']

tmd/io/io.py:196: ValueError

Check failure on line 169 in tests/test_neuron_conversion.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_neuron_conversion.test_neuron_building_consistency__h5

AttributeError: type object 'morphio._morphio.Option' has no attribute 'allow_root_bifurcations'
Raw output
def test_neuron_building_consistency__h5():
        # noqa: D103 ; pylint: disable=missing-function-docstring
        path = f"{DATA_PATH}/valid/C010398B-P2.h5"
    
        neuron1 = load_neuron(path)
>       neuron2 = _load_neuron_morphio(path)

tests/test_neuron_conversion.py:169: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

path_or_obj = '/home/runner/work/TMD/TMD/tests/data/valid/C010398B-P2.h5'
user_tree_types = None

    def _load_neuron_morphio(path_or_obj, user_tree_types=None):
        """Create Neuron object from morphio object or from path loaded via morphio.
    
        Supported file formats: h5, swc, asc.
    
        Args:
            path_or_obj (Union[str, morphio.Morphology]):
                Filepath or morphio object
    
        Returns:
            neuron (Neuron): tmd Neuron object
        """
        tree_types = redefine_types(user_tree_types)
    
        if isinstance(path_or_obj, (str, Path)):
            obj = Morphology(
                path_or_obj,
>               Option.allow_root_bifurcations
                | Option.allow_soma_bifurcations
                | Option.allow_custom_root_id
                | Option.allow_multiple_somata,
            )
E           AttributeError: type object 'morphio._morphio.Option' has no attribute 'allow_root_bifurcations'

tmd/io/io.py:167: AttributeError

Check failure on line 183 in tests/test_neuron_conversion.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_neuron_conversion.test_neuron_building_consistency__swc

AttributeError: type object 'morphio._morphio.Option' has no attribute 'allow_root_bifurcations'
Raw output
def test_neuron_building_consistency__swc():
        # noqa: D103 ; pylint: disable=missing-function-docstring
        path = f"{DATA_PATH}/valid/C010398B-P2.CNG.swc"
    
        neuron1 = load_neuron(path)
>       neuron2 = _load_neuron_morphio(path)

tests/test_neuron_conversion.py:183: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

path_or_obj = '/home/runner/work/TMD/TMD/tests/data/valid/C010398B-P2.CNG.swc'
user_tree_types = None

    def _load_neuron_morphio(path_or_obj, user_tree_types=None):
        """Create Neuron object from morphio object or from path loaded via morphio.
    
        Supported file formats: h5, swc, asc.
    
        Args:
            path_or_obj (Union[str, morphio.Morphology]):
                Filepath or morphio object
    
        Returns:
            neuron (Neuron): tmd Neuron object
        """
        tree_types = redefine_types(user_tree_types)
    
        if isinstance(path_or_obj, (str, Path)):
            obj = Morphology(
                path_or_obj,
>               Option.allow_root_bifurcations
                | Option.allow_soma_bifurcations
                | Option.allow_custom_root_id
                | Option.allow_multiple_somata,
            )
E           AttributeError: type object 'morphio._morphio.Option' has no attribute 'allow_root_bifurcations'

tmd/io/io.py:167: AttributeError