Equations class¶
(Shortest import: from brian2 import Equations)
-
class
brian2.equations.equations.Equations(eqns, **kwds)[source]¶ Bases:
collections.abc.Hashable,collections.abc.MappingContainer 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
_substituted_expressionsCache for equations with the subexpressions substituted dependenciesCalculate the dependencies of all differential equations and subexpressions. diff_eq_expressionsA list of (variable name, expression) tuples of all differential equations. diff_eq_namesAll differential equation names. dimensionsDictionary of all internal variables and their corresponding physical dimensions. eq_expressionsA list of (variable name, expression) tuples of all equations. eq_namesAll equation names (including subexpressions). identifier_checksA set of functions that are used to check identifiers (class attribute). identifiersSet of all identifiers used in the equations, excluding the variables defined in the equations is_stochasticWhether the equations are stochastic. namesAll variable names defined in the equations. orderedA list of all equations, sorted according to the order in which they should be updated parameter_namesAll parameter names. stochastic_typeReturns the type of stochastic differential equations (additivive or multiplicative). stochastic_variablessubexpr_namesAll subexpression names. Methods
check_flags(allowed_flags[, incompatible_flags])Check the list of flags. check_identifier(identifier)Perform all the registered checks. check_identifiers()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_identifier_check(func)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_checkand 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
additiveif 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.