reset

Contents

reset#

class brainstate.environ.reset(*, env=None)[source]#

Reset the environment to default settings.

This function clears all custom settings and restores the environment to its initial state. Useful for testing or when starting fresh.

Parameters:

env (EnvironmentState | None) – The environment state to reset. If None, resets the global environment.

Return type:

None

Examples

>>> import brainstate.environ as env
>>>
>>> # Set custom values
>>> env.set(dt=0.1, custom_param='value')
>>> print(env.get('custom_param'))  # 'value'
>>>
>>> # Reset to defaults
>>> env.reset()
>>> print(env.get('custom_param', default=None))  # None

Using custom environment:

>>> import brainstate.environ as env
>>>
>>> custom_env = env.EnvironmentState()
>>> env.set(param='value', env=custom_env)
>>> env.reset(env=custom_env)
>>> print(env.get('param', default=None, env=custom_env))  # None

Notes

This operation cannot be undone. All custom settings will be lost.