tmd.io.io

Python module that contains the functions about reading and writing files.

Functions

load_neuron(input_file[, line_delimiter, ...])

I/O method to load an swc or h5 file into a Neuron object.

load_neuron_from_morphio(path_or_obj[, ...])

Create Neuron object from morphio object or from path loaded via morphio.

load_population(neurons[, user_tree_types, ...])

Load all data of recognised format (swc, h5) into a Population object.

make_tree(data)

Make tree structure from loaded data.

redefine_types([user_types])

Return tree types depending on the customized types selected by the user.

Exceptions

LoadNeuronError

Captures the exception of failing to load a single neuron.

exception tmd.io.io.LoadNeuronError

Bases: TmdError

Captures the exception of failing to load a single neuron.

tmd.io.io.load_neuron(input_file, line_delimiter='\n', soma_type=None, user_tree_types=None, remove_duplicates=True)

I/O method to load an swc or h5 file into a Neuron object.

tmd.io.io.load_neuron_from_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.

Parameters:

path_or_obj (Union[str, morphio.Morphology]) – Filepath or morphio object

Returns:

tmd Neuron object

Return type:

neuron (Neuron)

tmd.io.io.load_population(neurons, user_tree_types=None, name=None, use_morphio=False)

Load all data of recognised format (swc, h5) into a Population object.

Takes as input a directory or a list of files to load.

tmd.io.io.make_tree(data)

Make tree structure from loaded data.

tmd.io.io.redefine_types(user_types=None)

Return tree types depending on the customized types selected by the user.

Parameters:

user_types (dictionary or None)

Returns:

tree types for the construction of Neuron.

Return type:

final_types (dict)