From 0e00ff0e38b175e6e4bcd9ceaf63226518bc16fd Mon Sep 17 00:00:00 2001 From: Sebastian Spreizer Date: Tue, 10 Jan 2023 16:48:49 +0100 Subject: [PATCH 1/3] Add `userdict` in nest --- pynest/nest/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pynest/nest/__init__.py b/pynest/nest/__init__.py index a54cec6ed1..90a1cdc62b 100644 --- a/pynest/nest/__init__.py +++ b/pynest/nest/__init__.py @@ -77,6 +77,8 @@ class NestModule(types.ModuleType): from . import logic # noqa from .ll_api import set_communicator + userdict = {} + def __init__(self, name): super().__init__(name) # Copy over the original module attributes to preserve all interpreter-given From 052987cbfbf10cb6c28fb3dabbccd5674a0a608b Mon Sep 17 00:00:00 2001 From: Sebastian Spreizer Date: Wed, 11 Jan 2023 11:00:54 +0100 Subject: [PATCH 2/3] Relocate userdict --- pynest/nest/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pynest/nest/__init__.py b/pynest/nest/__init__.py index 90a1cdc62b..4054a1645e 100644 --- a/pynest/nest/__init__.py +++ b/pynest/nest/__init__.py @@ -77,8 +77,6 @@ class NestModule(types.ModuleType): from . import logic # noqa from .ll_api import set_communicator - userdict = {} - def __init__(self, name): super().__init__(name) # Copy over the original module attributes to preserve all interpreter-given @@ -428,6 +426,8 @@ def __dir__(self): k for k, v in vars().items() if isinstance(v, KernelAttribute) and v._readonly ) + userdict = {} + def _setattr_error(self, attr, val): """ From 0ba7a8bad62ed10b9818e05b11fcb8526c9e66fd Mon Sep 17 00:00:00 2001 From: Sebastian Spreizer Date: Thu, 12 Jan 2023 14:40:43 +0100 Subject: [PATCH 3/3] Add doucumentation --- pynest/nest/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pynest/nest/__init__.py b/pynest/nest/__init__.py index 4054a1645e..47aca7862d 100644 --- a/pynest/nest/__init__.py +++ b/pynest/nest/__init__.py @@ -427,6 +427,11 @@ def __dir__(self): ) userdict = {} + """ + The variable userdict allows users to store custom data with the NEST kernel. + + Example: nest.userdict["nodes"] = [1,2,3,4] + """ def _setattr_error(self, attr, val):