MixIons#

class braincell.MixIons(*ions, name=None, **channels)#

A pool for channels whose current depends on more than one ion.

A calcium-dependent potassium channel needs both the potassium reversal potential and the calcium concentration, so it cannot hang off either pool alone. It declares a joint root_type and is registered here instead; each of its owner ions then sees its current through Ion.register_external_current().

Parameters:
  • *ions (Ion) – Two or more ion pools to mix. All must have the same size.

  • name (str | None) – The name of the instance. A default is generated when omitted.

  • **channels – Channel instances to add, keyed by attribute name.

Variables:
  • ions (tuple of Ion) – The mixed ion pools, in the order given.

  • ion_types (tuple of type) – The type of each entry in ions.

  • channels (dict of str to Channel) – Channels registered with this pool.

Raises:

AssertionError – If fewer than two ions are given, if any is not an Ion, or if their sizes differ.

add(**elements)[source]#

Register new children with the container.

Parameters:
  • *elems – Positional elements to add, for subclasses that accept them.

  • **elements – Named elements to add, keyed by the name to register them under.

Raises:

NotImplementedError – Always, in the base class. Subclasses must override.

compute_derivative(V)[source]#

Forward derivative computation to every dependent child channel.

current(V)[source]#

Sum the current carried by every channel in this mixed pool.

Returns:

The summed current, or None when the pool holds no channels. None is the same “nothing to contribute” sentinel Ion.current() returns; this used to be a bare, unitless 0.0, which made summing over a pool crash with a unit mismatch instead.

Return type:

brainunit.Quantity or None

ind_update(V, *args, **kwargs)[source]#

Let every self-integrating child in this pool advance itself.

init_state(V, batch_size=None)[source]#

Allocate the state of every channel in this mixed pool.

property ion_types: Tuple[Type[Ion], ...]#

Types of ions in this mixed channel.

post_integral(V)[source]#

Forward post-integration to every dependent child channel.

pre_integral(V)[source]#

Forward pre-integration to every dependent child channel.

reset_state(V, batch_size=None)[source]#

Return every channel in this mixed pool to its initial state.

root_type#

alias of HHTypedNeuron