pymaid.rename_neurons(x, new_names, remote_instance=None, no_prompt=False)[source]

Rename neuron(s).

  • x

    Neuron(s) to rename. Can be either:

    1. list of skeleton ID(s) (int or str)

    2. list of neuron name(s) (str, exact match)

    3. an annotation: e.g. ‘annotation:PN right’

    4. CatmaidNeuron or CatmaidNeuronList object

  • new_names (str | list | dict) – New name(s). If renaming multiple neurons this needs to be a dict mapping skeleton IDs to new names or a list of the same size as provided skeleton IDs.

  • no_prompt (bool, optional) – By default, you will be prompted to confirm before renaming neuron(s). Set this to True to skip that step.

  • remote_instance (CatmaidInstance, optional) – If not passed directly, will try using global.


Add your initials to a set of neurons

>>> # Get their current names
>>> names = pymaid.get_names('annotation:Philipps neurons')
>>> # Add initials to names
>>> new_names = {skid: name + ' PS' for skid, name in names.items()}
>>> # Rename neurons
>>> pymaid.rename_neurons(list(names.keys()), new_names)
Return type

Server response