morphoclass.transforms.helper module

Various helper and utility functions used in the data transforms.

morphoclass.transforms.helper.attribute_bytes_tree_hash(tree)

Compute a heuristic hash for a neurite based on its attributes.

Parameters

tree (tmd.Tree.Tree) – An apical tree.

Returns

The hash of the given tree.

Return type

int

morphoclass.transforms.helper.raise_no_attribute(attribute)

Raise an error for a missing attribute.

Parameters

attribute (str) – The missing attribute

Raises

ValueError – Always raised as intended.

morphoclass.transforms.helper.require_field(field_name)

Decorate a function with the check if data parameter has given field.

This decorator can only be used for functions with arguments (self, data), and the data object must be instance of the Data class.

Parameters

field_name – The name of the field to be required in data.

Returns

Decorated function.

Return type

callable