equations package

Module handling equations and “code strings”, expressions or statements, used for example for the reset and threshold definition of a neuron.

Exported members: Equations, Expression, Statements

codestrings module

Module defining CodeString, a class for a string of code together with information about its namespace. Only serves as a parent class, its subclasses Expression and Statements are the ones that are actually used.

Exported members: Expression, Statements

Classes

CodeString(code) A class for representing “code strings”, i.e.
Expression(code) Class for representing an expression.
Statements(code) Class for representing statements.

equations module

Differential equations for Brian models.

Exported members: Equations

Classes

EquationError Exception type related to errors in an equation definition.
Equations(eqns, **kwds) Container that stores equations from which models can be created.
SingleEquation(type, varname, unit[, ...]) Class for internal use, encapsulates a single equation or parameter.

Functions

check_identifier_basic(identifier) Check an identifier (usually resulting from an equation string provided by the user) for conformity with the rules.
check_identifier_constants(identifier) Make sure that identifier names do not clash with function names.
check_identifier_functions(identifier) Make sure that identifier names do not clash with function names.
check_identifier_reserved(identifier) Check that an identifier is not using a reserved special variable name.
check_identifier_units(identifier) Make sure that identifier names do not clash with unit names.
parse_string_equations(eqns) Parse a string defining equations.
unit_and_type_from_string(unit_string) Returns the unit that results from evaluating a string like “siemens / metre ** 2”, allowing for the special string “1” to signify dimensionless units, the string “boolean” for a boolean and “integer” for an integer variable.

refractory module

Module implementing Brian’s refractory mechanism.

Exported members: add_refractoriness

Functions

add_refractoriness(eqs) Extends a given set of equations with the refractory mechanism.
check_identifier_refractory(identifier) Check that the identifier is not using a name reserved for the refractory mechanism.

unitcheck module

Utility functions for handling the units in Equations.

Exported members: unit_from_expression, check_unit, check_units_statements

Functions

check_unit(expression, unit, variables) Compares the unit for an expression to an expected unit in a given namespace.
check_units_statements(code, variables) Check the units for a series of statements.