MixIons#

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

A class for mixing multiple ion channels in neuronal simulations.

This class combines multiple Ion instances to create a composite ion channel that can handle the dynamics of multiple ion types simultaneously.

Parameters:
  • *ions – Variable number of Ion instances. These define the types of ions that will be mixed in this channel.

  • name (str | None) – The name of the MixIons instance. Defaults to None.

  • **channels – Additional keyword arguments for specifying Channel instances.

ions#

A tuple of Ion instances that are part of this mixed channel.

Type:

Sequence[‘Ion’]

ion_types#

A tuple of the types of the Ion instances.

Type:

tuple

channels#

A dictionary of Channel instances associated with this mixed channel.

Type:

Dict[str, Channel]

Raises:

AssertionError – If fewer than two ions are provided, if any provided ion is not an Ion instance, or if the sizes of all provided ions are not identical.

add(**elements)[source]#

Add new elements to the container.

This method is intended to be implemented by subclasses to define how new elements are added to the container. The base implementation raises a NotImplementedError.

Parameters:
  • *elems – Variable length argument list of elements to be added.

  • **elements – Arbitrary keyword arguments representing named elements to be added.

Raises:

NotImplementedError – This method must be implemented by the subclass.

Note

Subclasses should override this method to provide specific implementation for adding elements to the container.

compute_derivative(V)[source]#

Compute the derivative of the channel’s state variables.

This method should be implemented by subclasses to calculate how the channel’s state changes over time.

Parameters:
  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Raises:

NotImplementedError – This method must be implemented by subclasses.

current(V)[source]#

Calculate the current for this ion channel.

This method should be implemented by subclasses to compute the current based on the channel’s specific properties and state.

Parameters:
  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Raises:

NotImplementedError – This method must be implemented by subclasses.

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

Initialize the state of the ion channel.

This method should set up the initial state of all variables for the channel.

Parameters:
  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

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

Types of ions in this mixed channel.

post_integral(V)[source]#

Perform post-integration operations.

This method is called after the integration step in simulations. It should be used to update the channel’s state based on the results of integration.

Parameters:
  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Raises:

NotImplementedError – This method must be implemented by subclasses.

pre_integral(V)[source]#

Perform pre-integration operations.

This method is called before the integration step in simulations. It can be used to prepare the channel’s state or perform any necessary calculations before integration.

Parameters:
  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

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

Reset the state of the ion channel.

This method should reset all state variables of the channel to their initial values.

Parameters:
  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

root_type#

alias of HHTypedNeuron