- class brainpy.math.environment(mode=None, membrane_scaling=None, dt=None, x64=None, complex_=None, float_=None, int_=None, bool_=None)#
Context-manager that sets a computing environment for brain dynamics computation.
In BrainPy, there are several basic computation settings when constructing models, including
modefor controlling model computing behavior,
dtfor numerical integration,
int_for integer precision, and
float_for floating precision.
environment`provides a context for model construction and computation. In this temporal environment, models are constructed with the given
int_, etc., environment settings.
>>> import brainpy as bp >>> import brainpy.math as bm >>> >>> with bm.environment(mode=bm.training_mode, dt=0.1): >>> lif1 = bp.neurons.LIF(1) >>> >>> with bm.environment(mode=bm.nonbatching_mode, dt=0.05, float_=bm.float64): >>> lif2 = bp.neurons.LIF(1)