Neo objects utilities

Tools to manipulate Neo objects.

elephant.neo_tools.extract_neo_attributes(neo_object, parents=True, child_first=True, skip_array=False, skip_none=False)[source]

Given a Neo object, return a dictionary of attributes and annotations.

Parameters:
neo_objectneo.BaseNeo

Object to get attributes and annotations.

parentsbool, optional

If True, also include attributes and annotations from parent Neo objects (if any). Default: True.

child_firstbool, optional

If True, values of child attributes are used over parent attributes in the event of a name conflict. If False, parent attributes are used. This parameter does nothing if parents is False. Default: True.

skip_arraybool, optional

If True, skip attributes that store non-scalar array values. Default: False.

skip_nonebool, optional

If True, skip annotations and attributes that have a value of None. Default: False.

Returns:
dict

A dictionary where the keys are annotations or attribute names and the values are the corresponding annotation or attribute value.

elephant.neo_tools.get_all_epochs(container)[source]

Get all neo.Epoch objects from a container.

The objects can be any list, dict, or other iterable or mapping containing epochs, as well as any neo object that can hold epochs: neo.Block and neo.Segment.

Containers are searched recursively, so the objects can be nested (such as a list of blocks).

Parameters:
containerlist, tuple, iterable, dict, neo.Block, neo.Segment

The container for the epochs.

Returns:
list

A list of the unique neo.Epoch objects in container.

elephant.neo_tools.get_all_events(container)[source]

Get all neo.Event objects from a container.

The objects can be any list, dict, or other iterable or mapping containing events, as well as any neo object that can hold events: neo.Block and neo.Segment.

Containers are searched recursively, so the objects can be nested (such as a list of blocks).

Parameters:
containerlist, tuple, iterable, dict, neo.Block, neo.Segment

The container for the events.

Returns:
list

A list of the unique neo.Event objects in container.

elephant.neo_tools.get_all_spiketrains(container)[source]

Get all neo.Spiketrain objects from a container.

The objects can be any list, dict, or other iterable or mapping containing spiketrains, as well as any Neo object that can hold spiketrains: neo.Block, neo.ChannelIndex, neo.Unit, and neo.Segment.

Containers are searched recursively, so the objects can be nested (such as a list of blocks).

Parameters:
containerlist, tuple, iterable, dict, neo.Block, neo.Segment, neo.Unit,

neo.ChannelIndex The container for the spiketrains.

Returns:
list

A list of the unique neo.SpikeTrain objects in container.