MagicNetwork class

(Shortest import: from brian2 import MagicNetwork)

class brian2.core.magic.MagicNetwork(*args, **kw)[source]

Bases: Network

Network that automatically adds all Brian objects

In order to avoid bugs, this class will occasionally raise MagicError when the intent of the user is not clear. See the notes below for more details on this point. If you persistently see this error, then Brian is not able to safely guess what you intend to do, and you should use a Network object and call Network.run explicitly.

Note that this class cannot be instantiated by the user, there can be only one instance magic_network of MagicNetwork.

Methods

add(*objs)

You cannot add objects directly to MagicNetwork

after_run()

check_dependencies()

get_states([units, format, subexpressions, ...])

See Network.get_states.

remove(*objs)

You cannot remove objects directly from MagicNetwork

restore([name, filename, ...])

See Network.restore.

run(duration[, report, report_period, ...])

Runs the simulation for the given duration.

set_states(values[, units, format, level])

See Network.set_states.

store([name, filename, level])

See Network.store.

Details

add(*objs)[source]

You cannot add objects directly to MagicNetwork

after_run()[source]
check_dependencies()[source]
get_states(units=True, format='dict', subexpressions=False, level=0)[source]

See Network.get_states.

remove(*objs)[source]

You cannot remove objects directly from MagicNetwork

restore(name='default', filename=None, restore_random_state=False, level=0)[source]

See Network.restore.

run(duration, report=None, report_period=60 * second, namespace=None, level=0)[source]

Runs the simulation for the given duration.

set_states(values, units=True, format='dict', level=0)[source]

See Network.set_states.

store(name='default', filename=None, level=0)[source]

See Network.store.