Equations class
(Shortest import: from brian2 import Equations)
- class brian2.equations.equations.Equations(eqns, **kwds)[source]
-
Container that stores equations from which models can be created.
String equations can be of any of the following forms:
dx/dt = f : unit (flags)
(differential equation)x = f : unit (flags)
(equation)x : unit (flags)
(parameter)
String equations can span several lines and contain Python-style comments starting with
#
Attributes
Cache for equations with the subexpressions substituted
Calculate the dependencies of all differential equations and subexpressions.
A list of (variable name, expression) tuples of all differential equations.
All differential equation names.
Dictionary of all internal variables and their corresponding physical dimensions.
A list of (variable name, expression) tuples of all equations.
All equation names (including subexpressions).
A set of functions that are used to check identifiers (class attribute).
Set of all identifiers used in the equations, excluding the variables defined in the equations
Whether the equations are stochastic.
All variable names defined in the equations.
A list of all equations, sorted according to the order in which they should be updated
All parameter names.
Returns the type of stochastic differential equations (additivive or multiplicative).
All subexpression names.
Methods
check_flags
(allowed_flags[, incompatible_flags])Check the list of flags.
check_identifier
(identifier)Perform all the registered checks.
Check all identifiers for conformity with the rules.
check_units
(group, run_namespace)Check all the units for consistency.
get_substituted_expressions
([variables, ...])Return a list of
(varname, expr)
tuples, containing all differential equations (and optionally subexpressions) with all the subexpression variables substituted with the respective expressions.Register a function for checking identifiers.
substitute
(**kwds)Details
- _substituted_expressions
Cache for equations with the subexpressions substituted
- dependencies
Calculate the dependencies of all differential equations and subexpressions.
- diff_eq_expressions
A list of (variable name, expression) tuples of all differential equations.
- diff_eq_names
All differential equation names.
- dimensions
Dictionary of all internal variables and their corresponding physical dimensions.
- eq_expressions
A list of (variable name, expression) tuples of all equations.
- eq_names
All equation names (including subexpressions).
- identifier_checks
A set of functions that are used to check identifiers (class attribute). Functions can be registered with the static method
Equations.register_identifier_check
and will be automatically used when checking identifiers
- identifiers
Set of all identifiers used in the equations, excluding the variables defined in the equations
- is_stochastic
Whether the equations are stochastic.
- names
All variable names defined in the equations.
- ordered
A list of all equations, sorted according to the order in which they should be updated
- parameter_names
All parameter names.
- stochastic_type
Returns the type of stochastic differential equations (additivive or multiplicative). The system is only classified as
additive
if all equations have only additive noise (or no noise).
- stochastic_variables
- subexpr_names
All subexpression names.
- static check_identifier(identifier)[source]
Perform all the registered checks. Checks can be registered via
Equations.register_identifier_check
.