pymaid.CatmaidNeuronList¶
- class pymaid.CatmaidNeuronList(x, make_copy=False, **kwargs)[source]¶
Compilation of
CatmaidNeuron
that allow quick access to neurons’ attributes/functions. They are designed to work in many ways much like a pandas.DataFrames by, for example, supporting.iloc[ ]
,.itertuples()
,.empty
or.copy()
.CatmaidNeuronList can be minimally constructed from just skeleton IDs. Other parameters (nodes, connectors, neuron name, annotations, etc.) will then be retrieved from the server ‘on-demand’.
The easiest way to get a CatmaidNeuronList is by using
get_neuron()
(see examples).- skeleton_id¶
- Type:
array of str
- name¶
- Type:
array of str
- nodes¶
Merged node table.
- Type:
pandas.DataFrame
- connectors¶
Merged connector table. This also works for presynapses, postsynapses and gap_junctions.
- Type:
pandas.DataFrame
- tags¶
Node tags.
- Type:
np.array of dict
- annotations¶
- Type:
np.array of list
- partners¶
Connectivity table for these neurons.
- Type:
pd.DataFrame
- graph¶
- Type:
np.array of
networkx
graph objects
- igraph¶
- Type:
np.array of
igraph
graph objects
- review_status¶
- Type:
np.array of int
- n_connectors¶
- Type:
np.array of int
- n_presynapses¶
- Type:
np.array of int
- n_postsynapses¶
- Type:
np.array of int
- n_branch_nodes¶
- Type:
np.array of int
- n_end_nodes¶
- Type:
np.array of int
- n_open_ends¶
- Type:
np.array of int
- cable_length¶
Cable lengths in micrometers [um].
- Type:
np.array of float
- soma¶
- Type:
np.array of node IDs
- root¶
- Type:
np.array of node IDs
- n_cores¶
Number of cores to use. Default
os.cpu_count()-1
.- Type:
int
- use_threading¶
If True, will use parallel threads. Should be slightly up to a lot faster depending on the numbers of cores. Switch off if you experience performance issues.
- Type:
bool (default=True)
Examples
>>> # Initialize with just a Skeleton ID >>> nl = pymaid.CatmaidNeuronList([123456, 45677]) >>> # Retrieve review status from server on-demand >>> nl.review_status array([90, 23]) >>> # Initialize with skeleton data >>> nl = pymaid.get_neuron([123456, 45677]) >>> # Get annotations from server >>> nl.annotations [['annotation1', 'annotation2'], ['annotation3', 'annotation4']] >>> Index using node count >>> subset = nl[nl.n_nodes > 6000] >>> # Get neuron by its skeleton ID >>> n = nl.skid[123456] >>> # Index by multiple skeleton ID >>> subset = nl[['123456', '45677']] >>> # Index by neuron name >>> subset = nl['name1'] >>> # Index using annotation >>> subset = nl['annotation:uPN right'] >>> # Concatenate lists >>> nl += pymaid.get_neuron([912345])
Methods
__init__
(x[, make_copy])append
(v)Add neuron(s) to this list.
apply
(func, *[, parallel, n_cores, ...])Apply function across all neurons in this NeuronList.
copy
(**kwargs)Make copy of this neuronlist.
from_selection
(fname)Generate NeuronList from CATMAID JSON file.
get_annotations
([skip_existing])Get/update annotations for neurons.
get_names
([skip_existing])Get/update neuron names.
get_review
([skip_existing])Get/update review status.
get_skeletons
([skip_existing])Fill in/update skeleton data of neurons.
has_annotation
(x[, intersect, partial, ...])Filter neurons by their annotations.
head
([N])Return summary for top N neurons.
Helper to mimic
pandas.DataFrame.itertuples()
.mean
()Return mean numeric and boolean values over all neurons.
memory_usage
([deep, estimate, sample])Return estimated size in memory of this NeuronList.
plot2d
(**kwargs)Plot neuron in 2D using
plot2d()
.plot3d
(**kwargs)Plot neuron in 3D using
plot3d()
.reload
()Update neuron skeletons from server.
remove_duplicates
([key, inplace])Remove duplicate neurons from list.
sample
([N])Return random subset of neurons.
set_neuron_attributes
(x, name[, register, na])Set attributes of neurons contained in the NeuronList.
set_remote_instance
([remote_instance, ...])Assign remote_instance to all neurons.
sort_values
(key[, ascending])Sort neurons by given key.
sum
()Return sum numeric and boolean values over all neurons.
summary
([N, add_props])Get summary over all neurons in this NeuronList.
tail
([N])Return summary for bottom N neurons.
to_dataframe
()Turn this CatmaidneuronList into a pandas DataFrame.
to_selection
([save_to])Generate JSON file which can be loaded in CATMAID selection tables.
unmix
()Split into NeuronLists of the same neuron type.
Attributes
bbox
Bounding box across all neurons in the list.
empty
Return True if NeuronList is empty.
is_degenerated
Return True if contains neurons with non-unique IDs.
is_mixed
Return True if contains more than one type of neuron.
neurons
Neurons contained in this NeuronList.
shape
Shape of NeuronList (N, ).
types
Return neuron types present in this list.