core package

Essential Brian modules, in particular base classes for all kinds of brian objects.

Built-in preferences

Core Brian preferences

core.default_scalar_dtype = float64

Default dtype for all arrays of scalars (state variables, weights, etc.).’

base module

All Brian objects should derive from BrianObject.

Exported members: BrianObject, clear(), weakproxy_with_fallback()

Classes

BrianObject([when, name]) All Brian objects derive from this class, defines magic tracking and update.

Functions

clear([erase]) Stops all Brian objects from being automatically detected
weakproxy_with_fallback(obj) Attempts to create a weakproxy to the object, but falls back to the object if not possible.

clocks module

Clocks for the simulator.

Exported members: Clock, defaultclock

Classes

Clock([dt, name]) An object that holds the simulation time and the time step.

Objects

defaultclock An object that holds the simulation time and the time step.

core_preferences module

Definitions, documentation, default values and validation functions for core Brian preferences.

Functions

dtype_repr(dtype)

functions module

Exported members: DEFAULT_FUNCTIONS, Function, make_function()

Classes

Function(pyfunc[, sympy_func, arg_units, ...]) An abstract specification of a function that can be used as part of model equations, etc.
FunctionImplementation([name, code, ...]) A simple container object for function implementations.
FunctionImplementationContainer(function) Helper object to store implementations and give access in a dictionary-like fashion, using CodeGenerator implementations as a fallback for CodeObject implementations.
SymbolicConstant(name, sympy_obj, value) Class for representing constants (e.g.
log10

Functions

make_function([codes, namespaces, discard_units]) A simple decorator to extend user-written Python functions to work with code generation in other languages.

magic module

Exported members: MagicNetwork, magic_network, MagicError, run(), reinit(), stop()

Classes

MagicError Error that is raised when something goes wrong in MagicNetwork
MagicNetwork() Network that automatically adds all Brian objects

Functions

reinit() Reinitialises all Brian objects.
run(duration[, report, report_period, namespace]) Runs a simulation with all Brian objects for the given duration.
stop() Stops all running simulations.

Objects

magic_network Network that automatically adds all Brian objects

names module

Exported members: Nameable

Classes

Nameable(name) Base class to find a unique name for an object

Functions

find_name(name)

namespace module

Implementation of the namespace system, used to resolve the identifiers in model equations of NeuronGroup and Synapses

Exported members: get_local_namespace(), DEFAULT_FUNCTIONS, DEFAULT_UNITS, DEFAULT_CONSTANTS

Functions

get_local_namespace(level) Get the surrounding namespace.

network module

Exported members: Network

Classes

Network(*objs[, name]) The main simulation controller in Brian

operations module

Exported members: NetworkOperation, network_operation()

Classes

NetworkOperation(function[, when]) Object with function that is called every time step.

Functions

network_operation([when]) Decorator to make a function get called every time step of a simulation.

preferences module

Brian global preferences are stored as attributes of a BrianGlobalPreferences object brian_prefs.

Exported members: PreferenceError, BrianPreference, brian_prefs

Classes

BrianGlobalPreferences() Class of the brian_prefs object.
BrianGlobalPreferencesView(basename, all_prefs) A class allowing for accessing preferences in a subcategory.
BrianPreference(default, docs[, validator, ...]) Used for defining a Brian preference.
DefaultValidator(value) Default preference validator
PreferenceError Exception relating to the Brian preferences system.

Functions

check_preference_name(name) Make sure that a preference name is valid.
parse_preference_name(name) Split a preference name into a base and end name.

Objects

brian_prefs Preference categories:

scheduler module

Exported members: Scheduler

Classes

Scheduler([clock, when, order]) Defines which BrianObject gets called in what order in Network.run().

spikesource module

Exported members: SpikeSource

Classes

SpikeSource A source of spikes.

tracking module

Exported members: Trackable

Classes

InstanceFollower Keep track of all instances of classes derived from Trackable
InstanceTrackerSet A set of weakref.ref to all existing objects of a certain class.
Trackable Classes derived from this will have their instances tracked.

variables module

Classes used to specify the type of a function, variable or common sub-expression.

Exported members: Variable, Constant, AttributeVariable, ArrayVariable, DynamicArrayVariable, Subexpression, AuxiliaryVariable, VariableView, Variables

Classes

ArrayVariable(name, unit, owner, size, device) An object providing information about a model variable stored in an array (for example, all state variables).
AttributeVariable(name, unit, obj, ...[, ...]) An object providing information about a value saved as an attribute of an object.
AuxiliaryVariable(name, unit[, dtype, ...]) Variable description for an auxiliary variable (most likely one that is added automatically to abstract code, e.g.
Constant(name, unit, value) A scalar constant (e.g.
DynamicArrayVariable(name, unit, owner, ...) An object providing information about a model variable stored in a dynamic array (used in Synapses).
Subexpression(name, unit, owner, expr, device) An object providing information about a named subexpression in a model.
Variable(name, unit[, dtype, scalar, ...]) An object providing information about model variables (including implicit variables such as t or xi).
VariableView(name, variable, group[, unit]) A view on a variable that allows to treat it as an numpy array while allowing special indexing (e.g.
Variables(owner[, default_index]) A container class for storing Variable objects.

Functions

default_dtype(dtype[, is_bool]) Helper function to return the default dtype.
get_dtype(obj) Helper function to return the numpy.dtype of an arbitrary object.