AllenInstitute / neuron_morphology

Tools for working with single-neuron morphological reconstructions
https://neuron-morphology.readthedocs.io/en/latest/
Other
19 stars 8 forks source link

ZeroDivisionError on fMOST registered reconstructions #182

Open wbwakeman opened 4 years ago

wbwakeman commented 4 years ago

Many (not all) of the registered fMOST swc files that are candidates for next release fail feature extraction with this error:

Traceback (most recent call last):
  File "fmost_feature_extraction_list.py", line 1084, in <module>
    feature_extraction_run = fe.extract(test_data)
  File "/allen/aibs/technology/waynew/conda/neuron_morphology_pypi_37/lib/python3.7/site-packages/neuron_morphology/feature_extractor/feature_extractor.py", line 97, in extract
    only_marks=only_marks
  File "/allen/aibs/technology/waynew/conda/neuron_morphology_pypi_37/lib/python3.7/site-packages/neuron_morphology/feature_extractor/feature_extraction_run.py", line 112, in extract
    self.results[feature.name] = feature(self.data)
  File "/allen/aibs/technology/waynew/conda/neuron_morphology_pypi_37/lib/python3.7/site-packages/neuron_morphology/feature_extractor/marked_feature.py", line 83, in __call__
    return self.feature(*args, **kwargs)
  File "/allen/aibs/technology/waynew/conda/neuron_morphology_pypi_37/lib/python3.7/site-packages/neuron_morphology/features/intrinsic.py", line 209, in mean_fragmentation
    morphology, root, node_types=node_types)
  File "/allen/aibs/technology/waynew/conda/neuron_morphology_pypi_37/lib/python3.7/site-packages/neuron_morphology/features/intrinsic.py", line 180, in calculate_mean_fragmentation_from_root
    mean_fragmentation = counter['num_compartments'] / counter['num_branches']
ZeroDivisionError: division by zero

An example file is: /allen/programs/celltypes/workgroups/mouse_full_morphology/elise.shen/1708_registered_20200521/17302_00116.semi_r.swc

Need to understand why these are failing so that we can fix any issue on our side and/or provide feedback to them so that they can give us files that will successfully get features extracted.

This probably affects other features also. The task here is to investigate and fix for every feature that might be affected.