# SpatialNeuron class

(Shortest import: `from brian2 import SpatialNeuron)`

class brian2.spatialneuron.spatialneuron.SpatialNeuron(*args, **kw)

  Bases: `NeuronGroup`

  A single neuron with a morphology and possibly many compartments.

  Parameters:

    morphology : `Morphology`

    > The morphology of the neuron.

    model : str, `Equations`

    > The equations defining the group.

    method : str, function, optional

    > The numerical integration method. Either a string with the name of a registered method (e.g. “euler”) or a function that receives an `Equations` object and returns the corresponding abstract code. If no method is specified, a suitable method will be chosen automatically.

    threshold : str, optional

    > The condition which produces spikes. Should be a single line boolean expression.

    threshold_location : (int, `Morphology`), optional

    > Compartment where the threshold condition applies, specified as an integer (compartment index) or a `Morphology` object corresponding to the compartment (e.g. `morpho.axon[10*um]`). If unspecified, the threshold condition applies at all compartments.

    Cm : `Quantity`, optional

    > Specific capacitance in uF/cm**2 (default 0.9). It can be accessed and modified later as a state variable. In particular, its value can differ in different compartments.

    Ri : `Quantity`, optional

    > Intracellular resistivity in ohm.cm (default 150). It can be accessed as a shared state variable, but modified only before the first run. It is uniform across the neuron.

    reset : str, optional

    > The (possibly multi-line) string with the code to execute on reset.

    events : dict, optional

    > User-defined events in addition to the “spike” event defined by the `threshold`. Has to be a mapping of strings (the event name) to strings (the condition) that will be checked.

    refractory : {str, `Quantity`}, optional

    > Either the length of the refractory period (e.g. `2*ms`), a string expression that evaluates to the length of the refractory period after each spike (e.g. `'(1 + rand())*ms'`), or a string expression evaluating to a boolean value, given the condition under which the neuron stays refractory after a spike (e.g. `'v > -20*mV'`)

    namespace : dict, optional

    > A dictionary mapping identifier names to objects. If not given, the namespace will be filled in at the time of the call of `Network.run`, with either the values from the `namespace` argument of the `Network.run` method or from the local context, if no such argument is given.

    dtype : (`dtype`, `dict`), optional

    > The `numpy.dtype` that will be used to store the values, or a dictionary specifying the type for variable names. If a value is not provided for a variable (or no value is provided at all), the preference setting core.default_float_dtype is used.

    dt : `Quantity`, optional

    > The time step to be used for the simulation. Cannot be combined with the `clock` argument.

    clock : `Clock`, optional

    > The update clock to be used. If neither a clock, nor the `dt` argument is specified, the `defaultclock` will be used.

    order : int, optional

    > The priority of of this group for operations occurring at the same time step and in the same scheduling slot. Defaults to 0.

    name : str, optional

    > A unique name for the group, otherwise use `spatialneuron_0`, etc.

  Attributes

  `user_equations` | The original equations as specified by the user (i.e. before inserting point-currents into the membrane equation, before adding all the internally used variables and constants, etc.).

  Methods

  `spatialneuron_attribute`(neuron, name) | Selects a subtree from `SpatialNeuron` neuron and returns a `SpatialSubgroup`.
  `spatialneuron_segment`(neuron, item) | Selects a segment from `SpatialNeuron` neuron, where item is a slice of either compartment indexes or distances.

  Details

  user_equations

    The original equations as specified by the user (i.e. before inserting point-currents into the membrane equation, before adding all the internally used variables and constants, etc.).

  static spatialneuron_attribute(neuron, name)

    Selects a subtree from `SpatialNeuron` neuron and returns a `SpatialSubgroup`. If it does not exist, returns the `Group` attribute.

  static spatialneuron_segment(neuron, item)

    Selects a segment from `SpatialNeuron` neuron, where item is a slice of either compartment indexes or distances. Note a: segment is not a `SpatialNeuron`, only a `Group`.

## Tutorials and examples using this

- Example compartmental/bipolar_cell

- Example compartmental/bipolar_with_inputs

- Example compartmental/bipolar_with_inputs2

- Example compartmental/cylinder

- Example compartmental/hh_with_spikes

- Example compartmental/hodgkin_huxley_1952

- Example compartmental/infinite_cable

- Example compartmental/lfp

- Example compartmental/morphotest

- Example compartmental/rall

- Example compartmental/spike_initiation

- Example frompapers/Brette_2012/Fig1

- Example frompapers/Brette_2012/Fig3AB

- Example frompapers/Brette_2012/Fig3CF

- Example frompapers/Brette_2012/Fig4

- Example frompapers/Brette_2012/Fig5A

- Example frompapers/Destexhe_et_al_1998