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

neurom.load_morphologies does not resolve paths #1046

Closed
eleftherioszisis opened this issue Jun 13, 2022 · 0 comments
Closed

neurom.load_morphologies does not resolve paths #1046

eleftherioszisis opened this issue Jun 13, 2022 · 0 comments
Assignees

Comments

@eleftherioszisis
Copy link
Contributor

eleftherioszisis commented Jun 13, 2022

Works:

import neurom
pop = neurom.load_morphologies("tests/data/valid_set")
[m.name for m in pop]

Fails:

import neurom
pop = neurom.load_morphologies("tests/data/valid_set")
cd ..
[m.name for m in pop]

with:

RawDataError                              Traceback (most recent call last)
File ~/Projects/NEUROM/NeuroM/neurom/core/population.py:87, in Population._load_file(self, f)
     86 try:
---> 87     return neurom.load_morphology(f)
     88 except (NeuroMError, MorphioError) as e:

File ~/Projects/NEUROM/NeuroM/neurom/io/utils.py:168, in load_morphology(morph, reader)
    166     return Morphology(_get_file(morph, reader))
--> 168 return Morphology(morph, Path(morph).name)

File ~/Projects/NEUROM/NeuroM/neurom/core/morphology.py:516, in Morphology.__init__(self, filename, name)
    510 """Morphology constructor.
    511 
    512 Args:
    513     filename (str|Path): a filename or morphio.{mut}.Morphology object
    514     name (str): an optional morphology name
    515 """
--> 516 self._morphio_morph = morphio.mut.Morphology(filename).as_immutable()
    517 self.name = name if name else 'Morphology'

RawDataError: File: tests/data/valid_set/Neuron_slice.h5 does not exist.

The above exception was the direct cause of the following exception:

NeuroMError                               Traceback (most recent call last)
Input In [8], in <cell line: 1>()
----> 1 [m.name for m in pop]

Input In [8], in <listcomp>(.0)
----> 1 [m.name for m in pop]

File ~/Projects/NEUROM/NeuroM/neurom/core/population.py:98, in Population.__iter__(self)
     96 """Iterator to populations's morphs."""
     97 for f in self._files:
---> 98     m = self._load_file(f)
     99     if m is None:
    100         continue

File ~/Projects/NEUROM/NeuroM/neurom/core/population.py:92, in Population._load_file(self, f)
     90         L.info('Ignoring exception "%s" for file %s', e, f.name)
     91     else:
---> 92         raise NeuroMError('`load_morphologies` failed') from e
     93 return None

NeuroMError: `load_morphologies` failed

Reported by @lidakanari

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant