neurom.io.utils¶
Utility functions and for loading neurons.
Functions
Get a file or set of files from a file path. |
|
Get a list of all morphology files in a directory. |
|
Unpack data into a raw data wrapper. |
|
Build section trees from an h5 or swc file. |
|
Create a population object. |
Classes
Class holding a raw data block and section information. |
|
Class representing a neuron. |
|
Caching morphology loader. |
|
Neuron Population Class. |
Exceptions
Base class for all NeuroM exceptions. |
|
Exception class for raw data errors. |
-
class
neurom.io.utils.
DataWrapper
(data_block, fmt, sections=None)[source]¶ Bases:
object
Class holding a raw data block and section information.
-
class
neurom.io.utils.
FstNeuron
(data_wrapper, name='Neuron')[source]¶ Bases:
neurom.core._neuron.Neuron
Class representing a neuron.
-
exception
neurom.io.utils.
NeuroMError
[source]¶ Bases:
Exception
Base class for all NeuroM exceptions.
-
class
neurom.io.utils.
NeuronLoader
(directory, file_ext=None, cache_size=None)[source]¶ Bases:
object
Caching morphology loader.
- Parameters
directory – path to directory with morphology files
file_ext – file extension to look for (if not set, will pick any of .swc|.h5|.asc)
cache_size – size of LRU cache (if not set, no caching done)
-
class
neurom.io.utils.
Population
(neurons, name='Population')[source]¶ Bases:
object
Neuron Population Class.
- Features:
flattened collection of neurites.
collection of somas, neurons.
iterable-like iteration over neurons.
-
exception
neurom.io.utils.
RawDataError
[source]¶ Bases:
neurom.exceptions.NeuroMError
Exception class for raw data errors.
-
neurom.io.utils.
get_files_by_path
(path)[source]¶ Get a file or set of files from a file path.
Return list of files with path
-
neurom.io.utils.
get_morph_files
(directory)[source]¶ Get a list of all morphology files in a directory.
- Returns
list with all files with extensions ‘.swc’ , ‘h5’ or ‘.asc’ (case insensitive)
-
neurom.io.utils.
load_neuron
(handle, reader=None)[source]¶ Build section trees from an h5 or swc file.
-
neurom.io.utils.
load_neurons
(neurons, neuron_loader=<function load_neuron>, name=None, population_class=<class 'neurom.core.population.Population'>, ignored_exceptions=())[source]¶ Create a population object.
From all morphologies in a directory of from morphologies in a list of file names.
- Parameters
neurons – directory path or list of neuron file paths
neuron_loader – function taking a filename and returning a neuron
population_class – class representing populations
name (str) – optional name of population. By default ‘Population’ or filepath basename depending on whether neurons is list or directory path respectively.
- Returns
neuron population object