all

Contents

all#

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

Get all current environment settings.

This function returns a dictionary containing all active environment settings, with context values taking precedence over global settings.

Parameters:

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

Returns:

Dictionary of all current environment settings.

Return type:

Dict[str, Any]

Examples

>>> import brainstate.environ as env
>>>
>>> # Set various parameters
>>> env.set(precision=32, dt=0.01, debug=True)
>>>
>>> # Get all settings
>>> settings = env.all()
>>> print(settings)
{'precision': 32, 'dt': 0.01, 'debug': True}

>>> # Context overrides
>>> with env.context(precision=64, new_param='test'):
...     settings = env.all()
...     print(settings['precision'])  # 64
...     print(settings['new_param'])  # 'test'

Using custom environment:

>>> import brainstate.environ as env
>>>
>>> custom_env = env.EnvironmentState()
>>> env.set(param1='value1', env=custom_env)
>>> print(env.all(env=custom_env))  # {'precision': 32, 'param1': 'value1'}

Notes

The returned dictionary is a snapshot and modifying it does not affect the environment settings.