get_objects_in_namespace function

(Shortest import: from brian2.core.magic import get_objects_in_namespace)

brian2.core.magic.get_objects_in_namespace(level)[source]

Get all the objects in the current namespace that derive from BrianObject. Used to determine the objects for the MagicNetwork.

Parameters:

level : int, optional

How far to go back to get the locals/globals. Each function/method call should add 1 to this argument, functions/method with a decorator have to add 2.

Returns:

objects : set

A set with weak references to the BrianObjects in the namespace.