RuntimeDevice class¶
(Shortest import: from brian2.devices import RuntimeDevice)
- class brian2.devices.device.RuntimeDevice[source]¶
Bases:
DeviceThe default device used in Brian, state variables are stored as numpy arrays in memory.
Attributes
Mapping from
Variableobjects to numpy arrays (orDynamicArrayobjects).Methods
add_array(var)Add an array to this device.
fill_with_array(var, arr)Fill an array with the values given in another array.
get_array_name(var[, access_data])Return a globally unique name for
var().Return a (pickable) representation of the current random number generator state.
get_value(var[, access_data])init_with_arange(var, start, dtype)Initialize an array with an integer range.
init_with_zeros(var, dtype)Initialize an array with zeros.
resize(var, new_size)Resize a
DynamicArrayVariable.resize_along_first(var, new_size)seed([seed])Set the seed for the random number generator.
set_random_state(state)Reset the random number generator state to a previously stored state (see
Device.get_random_state).set_value(var, value)spike_queue(source_start, source_end)Create and return a new
SpikeQueuefor thisDevice.Details
- arrays¶
Mapping from
Variableobjects to numpy arrays (orDynamicArrayobjects). Arrays in this dictionary will disappear as soon as the last reference to theVariableobject used as a key is gone
- get_random_state()[source]¶
Return a (pickable) representation of the current random number generator state. Providing the returned object (e.g. a dict) to
Device.set_random_stateshould restore the random number generator state.
- set_random_state(state)[source]¶
Reset the random number generator state to a previously stored state (see
Device.get_random_state).